UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

51 lines (50 loc) 1.68 kB
rules: - id: spring-http-request message: >- Checks for requests sent via Java Spring RestTemplate API to http:// URLS. This is dangerous because the server is attempting to connect to a website that does not encrypt traffic with TLS. Instead, send requests only to https:// URLS. severity: WARNING metadata: likelihood: MEDIUM impact: MEDIUM confidence: MEDIUM category: security cwe: 'CWE-319: Cleartext Transmission of Sensitive Information' owasp: 'A03:2017 - Sensitive Data Exposure' references: - https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html#delete-java.lang.String-java.util.Map- - https://www.baeldung.com/rest-template subcategory: - vuln technology: - spring vulnerability: Insecure Transport languages: - java fix-regex: regex: '[Hh][Tt][Tt][Pp]://' replacement: https:// count: 1 patterns: - pattern-either: - pattern: | $RESTTEMP = new RestTemplate(...); ... $RESTTEMP.$FUNC("=~/[hH][tT][tT][pP]://.*/", ...); - pattern: | $RESTTEMP = new RestTemplate(...); ... String $URL = "=~/[hH][tT][tT][pP]://.*/"; ... $RESTTEMP.$FUNC($URL, ...); - pattern: | $RESTTEMP = new RestTemplate(...); ... $URL = new URI(..., "=~/[hH][tT][tT][pP]://.*/", ...); ... $RESTTEMP.$FUNC($URL, ...); - metavariable-regex: metavariable: $FUNC regex: (delete|doExecute|exchange|getForEntity|getForObject|headForHeaders|optionsForAllow|patchForObject|postForEntity|postForLocation|postForObject|put)