Skip to content

Commit 85f1d92

Browse files
yoffRasmusWL
andauthored
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
1 parent ce01739 commit 85f1d92

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

python/ql/lib/semmle/python/Concepts.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ module FileSystemWriteAccess {
106106
}
107107

108108
/**
109-
* A data-flow node that may set or unset Cross-site request forgery protection
109+
* A data-flow node that enables or disables Cross-site request forgery protection
110110
* in a global manner.
111111
*
112112
* Extend this class to refine existing API models. If you want to model new APIs,

python/ql/lib/semmle/python/frameworks/Django.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,8 +2330,12 @@ module PrivateDjango {
23302330
mw.asVar().getName() = "MIDDLEWARE" and
23312331
DataFlow::localFlow(this, mw)
23322332
|
2333-
// it only counts as setting the CSRF protection, if the app uses authentication,
2334-
// so check that the list contains the django authentication middleware.
2333+
// To only include results where CSRF protection matters, we only care about CSRF
2334+
// protection when the django authentication middleware is enabled.
2335+
// Since an active session cookie is exactly what would allow an attacker to perform
2336+
// a CSRF attack.
2337+
// Notice that this does not ensure that this is not a FP, since the authentication
2338+
// middleware might be unused.
23352339
//
23362340
// This also strongly implies that we are actually looking at the `MIDDLEWARE` setting.
23372341
list.getAnElt().(StrConst).getText() =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<overview>
77
<p>
88
Cross-site request forgery (CSRF) is a type of vulnerability in which an
9-
attacker is able to force a user carry out an action that the user did
9+
attacker is able to force a user to carry out an action that the user did
1010
not intend.
1111
</p>
1212

0 commit comments

Comments
 (0)