Why it matters
Characters such as * ( ) change which directory entries it matches.
How to fix it
Build the filter with new EqualityFilter({ attribute, value }) from ldapjs, which escapes the value, instead of a string.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
const express = require("express");
const app = express();
app.get("/people", (req, res) => {
client.search("ou=people,dc=example,dc=com", { filter: "(uid=" + req.query.user + ")", scope: "sub" }, (err, out) => {
res.json({ ok: !err });
});
});const { EqualityFilter } = require("ldapjs");
const express = require("express");
const app = express();
app.get("/people", (req, res) => {
const filter = new EqualityFilter({ attribute: "uid", value: String(req.query.user) });
client.search("ou=people,dc=example,dc=com", { filter: filter, scope: "sub" }, (err, out) => {
res.json({ ok: !err });
});
});What TrustIvan reads
Runs on repository scans of JavaScript source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- XPath injection from request input (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-taint-xpath-injection - XXE from request input (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-taint-xxe - Prototype pollution from request input (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-taint-prototype-pollution - SQL template literal (JavaScript)
JavaScriptSeverity: Medium
trustivan-javascript-sql-template-literal - Template injection from request input (JavaScript)
JavaScriptSeverity: High
trustivan-javascript-taint-template-injection - Helmet CSP disabled (JavaScript)
JavaScriptSeverity: Medium
trustivan-javascript-helmet-csp-disabled
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation