All rules →
Rules / JavaScript / TypeScript
SHIELD-JS-020

NoSQL injection via user-controlled query object

highJavaScript / TypeScriptCWE-943CVSS 8.1

What it detects

Passing req.params/query/body straight into a Mongo query lets an attacker inject operators ($ne, $gt, $where) to bypass auth or exfiltrate data.

How to fix

Cast/validate user input to the expected scalar type before using it in a query; reject object-valued fields where a string is expected.

Scan your repo freeFull documentation
Back to all rules
SHIELD-JS-020: NoSQL injection via user-controlled query object — Zennoxa Shield