UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

47 lines (46 loc) 1.33 kB
rules: - id: no-direct-write-to-responsewriter languages: - go message: >- Detected directly writing or similar in 'http.ResponseWriter.write()'. This bypasses HTML escaping that prevents cross-site scripting vulnerabilities. Instead, use the 'html/template' package and render data using 'template.Execute()'. metadata: category: security cwe: - "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')" owasp: - A07:2017 - Cross-Site Scripting (XSS) - A03:2021 - Injection references: - https://blogtitle.github.io/robn-go-security-pearls-cross-site-scripting-xss/ technology: - go confidence: LOW cwe2022-top25: true cwe2021-top25: true subcategory: - audit likelihood: LOW impact: MEDIUM patterns: - pattern-either: - pattern-inside: | func $HANDLER(..., $WRITER http.ResponseWriter, ...) { ... } - pattern-inside: | func $HANDLER(..., $WRITER *http.ResponseWriter, ...) { ... } - pattern-inside: | func(..., $WRITER http.ResponseWriter, ...) { ... } - pattern-either: - pattern: $WRITER.Write(...) - pattern: (*$WRITER).Write(...) - pattern-not: $WRITER.Write([]byte("...")) severity: WARNING