File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
javascript/ql/src/Security/CWE-352 Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -129,13 +129,27 @@ predicate isCsrfProtectionRouteHandler(Routing::RouteHandler handler) {
129
129
handler = getAHandlerSettingCsrfCookie ( )
130
130
}
131
131
132
+ /**
133
+ * A call of form `passport.authenticate(..., { session: false })`, implying that the incoming
134
+ * request must carry its credentials rather than relying on cookies.
135
+ *
136
+ * In principle such routes should not be preceded by a cookie-parsing middleware, but to
137
+ * reduce noise we do not want to flag them.
138
+ */
139
+ API:: CallNode nonSessionBasedAuthMiddleware ( ) {
140
+ result = API:: moduleImport ( "passport" ) .getMember ( "authenticate" ) .getACall ( ) and
141
+ result .getParameter ( 1 ) .getMember ( "session" ) .getARhs ( ) .mayHaveBooleanValue ( false )
142
+ }
143
+
132
144
/**
133
145
* Gets an express route handler expression that is either a custom CSRF protection middleware,
134
146
* or a CSRF protecting library.
135
147
*/
136
148
Routing:: Node getACsrfMiddleware ( ) {
137
149
result = Routing:: getNode ( csrfMiddlewareCreation ( ) )
138
150
or
151
+ result = Routing:: getNode ( nonSessionBasedAuthMiddleware ( ) )
152
+ or
139
153
isCsrfProtectionRouteHandler ( result )
140
154
}
141
155
You can’t perform that action at this time.
0 commit comments