python: broaden local protection concept

This commit is contained in:
Rasmus Lerchedahl Petersen
2022-03-25 12:28:33 +01:00
parent 179f77b123
commit 1e9840d779
5 changed files with 34 additions and 24 deletions

View File

@@ -17,7 +17,7 @@ import semmle.python.Concepts
from CsrfProtectionSetting s
where
s.getVerificationSetting() = false and
not exists(CsrfLocalProtection p) and
not exists(CsrfLocalProtectionSetting p | p.csrfEnabled()) and
// rule out test code as this is a common place to turn off CSRF protection
not s.getLocation().getFile().getAbsolutePath().matches("%test%")
select s, "Potential CSRF vulnerability due to forgery protection being disabled or weakened."