Created
September 28, 2021 08:51
-
-
Save inkz/4cc60b80ee92ed205b0e9dc15e1ec9ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules: | |
- id: symfony-permissive-cors | |
languages: | |
- php | |
message: Access-Control-Allow-Origin response header is set to "*". This will | |
disable CORS Same Origin Policy restrictions. | |
metadata: | |
category: security | |
cwe: "CWE-346: Origin Validation Error" | |
license: Commons Clause License Condition v1.0[LGPL-2.1-only] | |
owasp: "A6: Security Misconfiguration" | |
references: | |
- https://developer.mozilla.org/ru/docs/Web/HTTP/Headers/Access-Control-Allow-Origin | |
technology: | |
- symfony | |
patterns: | |
- pattern-inside: | | |
use Symfony\Component\HttpFoundation\Response; | |
... | |
- pattern-either: | |
- patterns: | |
- pattern-either: | |
- pattern: > | |
new Symfony\Component\HttpFoundation\Response($X, $Y, | |
$HEADERS, ...) | |
- pattern: new Response($X, $Y, $HEADERS, ...) | |
- pattern-either: | |
- pattern: new $R($X, $Y, [$KEY => $VALUE], ...) | |
- pattern-inside: | | |
$HEADERS = [$KEY => $VALUE]; | |
... | |
- patterns: | |
- pattern: $RES->headers->set($KEY, $VALUE) | |
- metavariable-regex: | |
metavariable: $KEY | |
regex: (\'|\")\s*(Access-Control-Allow-Origin|access-control-allow-origin)\s*(\'|\") | |
- metavariable-regex: | |
metavariable: $VALUE | |
regex: (\'|\")\s*(\*)\s*(\'|\") | |
severity: WARNING |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment