mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
46 lines (45 loc) • 1.35 kB
YAML
rules:
- id: pyramid-set-cookie-samesite-unsafe-value
patterns:
- pattern-either:
- pattern-inside: |
@pyramid.view.view_config(...)
def $VIEW($REQUEST):
...
$RESPONSE = $REQUEST.response
...
- pattern-inside: |
def $VIEW(...):
...
$RESPONSE = pyramid.httpexceptions.HTTPFound(...)
...
- pattern-not: $RESPONSE.set_cookie(..., **$PARAMS)
- pattern: $RESPONSE.set_cookie(..., samesite=$SAMESITE, ...)
- pattern: $SAMESITE
- metavariable-regex:
metavariable: $SAMESITE
regex: (?!'Lax')
fix: |
'Lax'
message: >-
Found a Pyramid cookie without the samesite option correctly set.
Pyramid cookies should be handled securely by setting samesite='Lax' in response.set_cookie(...).
If this parameter is not properly set, your cookies are not properly protected and
are at risk of being stolen by an attacker.
metadata:
cwe:
- 'CWE-1275: Sensitive Cookie with Improper SameSite Attribute'
owasp:
- A01:2021 - Broken Access Control
category: security
technology:
- pyramid
references:
- https://owasp.org/Top10/A01_2021-Broken_Access_Control
subcategory:
- vuln
likelihood: LOW
impact: LOW
confidence: MEDIUM
languages: [python]
severity: WARNING