Shell command built from dynamic input
A shell command is executed with interpolated variables (exec/execSync/spawn with shell, os.system, subprocess with shell=True). If input is user-controlled, an attacker can run arbitrary commands on the server.
What the check contributes
Rule INJ002runs as part of CodeCordon's deterministic static-analysis pass. When it matches, the finding includes the source file, line number, severity, explanation, and a redacted snippet so the developer can inspect the evidence directly.
Recommended remediation
Use argument-array APIs (execFile / spawn without shell, subprocess.run([...])) so input is never parsed by a shell. Validate and allowlist any value that must reach a command line.
How to use this result
- 1. Open the reported line. Confirm the match is active application code rather than a fixture, example, or false positive.
- 2. Apply the remediation in context. Preserve the intended behavior while removing the dangerous pattern.
- 3. Scan again. Verify the known pattern no longer appears, then continue with tests and any runtime or human security review appropriate to the application.
Limits of this check
A match is a review signal, not proof of exploitability. No match means only that this specific known pattern was not found in the applicable files. It does not rule out equivalent code, business-logic flaws, runtime vulnerabilities, or novel attack paths.