Skip to content

Commit 53de828

Browse files
committed
python: rule out test code for CSRF
1 parent 0f2c21c commit 53de828

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/ql/src/Security/CWE-352/CSRFProtectionDisabled.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ import semmle.python.Concepts
1717
from CSRFProtectionSetting s
1818
where
1919
s.getVerificationSetting() = false and
20-
not exists(CSRFProtection p)
20+
not exists(CSRFProtection p) and
21+
// rule out test code as this is a common place to turn off CSRF protection
22+
not s.getLocation().getFile().getAbsolutePath().matches("%test%")
2123
select s, "Potential CSRF vulnerability due to forgery protection being disabled or weakened."

0 commit comments

Comments
 (0)