mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
50 lines (49 loc) • 1.33 kB
YAML
rules:
- id: spawn-shell-true
message: >-
Found '$SPAWN' with '{shell: $SHELL}'. This is dangerous because this call will
spawn
the command using a shell process. Doing so propagates current shell settings
and variables, which
makes it much easier for a malicious actor to execute commands. Use '{shell: false}'
instead.
metadata:
owasp:
- A01:2017 - Injection
- A03:2021 - Injection
cwe:
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"
category: security
technology:
- javascript
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: LOW
confidence: LOW
references:
- https://owasp.org/Top10/A03_2021-Injection
languages:
- javascript
- typescript
severity: ERROR
patterns:
- pattern-either:
- pattern: |
spawn(...,{shell: $SHELL})
- pattern: |
spawnSync(...,{shell: $SHELL})
- pattern: |
$CP.spawn(...,{shell: $SHELL})
- pattern: |
$CP.spawnSync(...,{shell: $SHELL})
- pattern-not: |
spawn(...,{shell: false})
- pattern-not: |
spawnSync(...,{shell: false})
- pattern-not: |
$CP.spawn(...,{shell: false})
- pattern-not: |
$CP.spawnSync(...,{shell: false})