Files
opencode-power-pack/skills/variant-analysis/resources/semgrep/javascript.yaml
Wayner Barrios ab04919087 Add 10 more piolium security skills (MIT)
GitHub Actions prompt-injection audit, threat modeling, differential
review, variant analysis, SARIF parsing, Semgrep/CodeQL scanning and
rule authoring, and WooYun-derived web vuln methodology. Generalized
semgrep's piolium-specific subagent references. Skill count 45 -> 55.
2026-08-02 15:54:18 -04:00

61 lines
1.7 KiB
YAML

rules:
- id: variant-taint-js
message: "Potential variant: user input flows to dangerous sink"
severity: ERROR
languages: [javascript, typescript]
mode: taint
pattern-sources:
# Express
- pattern: req.query.$PARAM
- pattern: req.body.$PARAM
- pattern: req.params.$PARAM
- pattern: req.cookies.$PARAM
# URL/Location
- pattern: window.location.$PROP
- pattern: document.location.$PROP
- pattern: location.search
- pattern: location.hash
pattern-sinks:
# Command injection
- pattern: child_process.exec($SINK, ...)
- pattern: child_process.execSync($SINK, ...)
- pattern: child_process.spawn($SINK, ...)
# Code execution
- pattern: eval($SINK)
- pattern: Function($SINK)
- pattern: setTimeout($SINK, ...)
- pattern: setInterval($SINK, ...)
# SQL
- pattern: $DB.query($SINK, ...)
- pattern: $DB.raw($SINK)
# XSS
- pattern: $EL.innerHTML = $SINK
- pattern: document.write($SINK)
pattern-sanitizers:
- pattern: parseInt($X, ...)
- pattern: encodeURIComponent($X)
- pattern: escape($X)
- pattern: $DB.escape($X)
paths:
exclude:
- "**/*.test.js"
- "**/*.spec.js"
- "**/test/**"
- "**/node_modules/**"
- id: variant-pattern-js
message: "Suspicious pattern matching known vulnerability"
severity: WARNING
languages: [javascript, typescript]
patterns:
- pattern-either:
- pattern: eval(...)
- pattern: Function(...)
- pattern: child_process.exec(...)
- pattern-not: eval("...")
- pattern-not: Function("...")