UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

71 lines 2.05 kB
rules: - id: node-mysql-sqli message: >- Detected a `$IMPORT` SQL statement that comes from a function argument. This could lead to SQL injection if the variable is user-controlled and is not properly sanitized. In order to prevent SQL injection, it is recommended to use parameterized queries or prepared statements. metadata: references: - https://www.npmjs.com/package/mysql2 - https://www.npmjs.com/package/mysql - https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html category: security owasp: - A01:2017 - Injection - A03:2021 - Injection cwe: - "CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')" confidence: LOW technology: - mysql - mysql2 - javascript - nodejs cwe2022-top25: true cwe2021-top25: true subcategory: - vuln likelihood: HIGH impact: MEDIUM languages: - javascript - typescript severity: WARNING mode: taint pattern-sources: - patterns: - pattern-inside: function ... (..., $Y,...) {...} - pattern: $Y - pattern-not-inside: | function ... (..., $Y: number,...) {...} - pattern-not-inside: $Y.query - pattern-not-inside: $Y.body - pattern-not-inside: $Y.params - pattern-not-inside: $Y.cookies - pattern-not-inside: $Y.headers pattern-sinks: - patterns: - focus-metavariable: $QUERY - pattern-either: - pattern-inside: $POOL.query($QUERY, ...) - pattern-inside: $POOL.execute($QUERY, ...) - pattern-either: - pattern-inside: | import $S from "$IMPORT" ... - pattern-inside: | import { ... } from "$IMPORT" ... - pattern-inside: | import * as $S from "$IMPORT" ... - pattern-inside: | require("$IMPORT") ... - metavariable-regex: metavariable: $IMPORT regex: (mysql|mysql2) pattern-sanitizers: - patterns: - pattern: parseInt(...)