UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

63 lines (62 loc) 1.76 kB
rules: - id: node-postgres-sqli message: >- Detected string concatenation with a non-literal variable in a node-postgres JS SQL statement. This could lead to SQL injection if the variable is user-controlled and not properly sanitized. In order to prevent SQL injection, use parameterized queries or prepared statements instead. You can use parameterized statements like so: `client.query('SELECT $1 from table', [userinput])` metadata: owasp: - A08:2021 - Software and Data Integrity Failures cwe: - 'CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes' references: - https://node-postgres.com/features/queries category: security technology: - node-postgres subcategory: - vuln likelihood: MEDIUM impact: MEDIUM confidence: LOW languages: - javascript - typescript severity: WARNING mode: taint pattern-sources: - patterns: - pattern-inside: | function ... (...,$FUNC,...) { ... } - focus-metavariable: $FUNC - pattern-not-inside: | $F. ... .$SOURCE(...) pattern-sinks: - patterns: - pattern-either: - pattern-inside: | const { $CLIENT } = require('pg') ... - pattern-inside: | var { $CLIENT } = require('pg') ... - pattern-inside: | let { $CLIENT } = require('pg') ... - pattern-either: - pattern-inside: | $DB = new $CLIENT(...) ... - pattern-inside: | $NEWPOOL = new $CLIENT(...) ... $NEWPOOL.connect((..., $DB, ...) => { ... }) - pattern: $DB.query($QUERY,...) - focus-metavariable: $QUERY