Skip to content

Commit 0c10927

Browse files
authored
Merge pull request github#9261 from erik-krogh/passport
JS: remove support for passport in the session-fixation query
2 parents d3ebc81 + aadbc98 commit 0c10927

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

javascript/ql/src/Security/CWE-384/SessionFixation.ql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import javascript
1919
*/
2020
pragma[inline]
2121
predicate isLoginSetup(Express::RouteSetup setup) {
22-
// either some path that contains "login" with a write to `req.session`
22+
// some path that contains "login" with a write to `req.session`
2323
setup.getPath().matches("%login%") and
2424
exists(
2525
setup
@@ -30,9 +30,7 @@ predicate isLoginSetup(Express::RouteSetup setup) {
3030
.getAPropertyRead("session")
3131
.getAPropertyWrite()
3232
)
33-
or
34-
// or an authentication method is used (e.g. `passport.authenticate`)
35-
setup.getARouteHandler().(DataFlow::CallNode).getCalleeName() = "authenticate"
33+
// passport used to be recognized, but they have since added built-in protection against session fixation
3634
}
3735

3836
/**
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
| tst.js:9:1:14:2 | app.get ... n');\\n}) | Route handler does not invalidate session following login |
2-
| tst.js:27:1:29:2 | app.get ... n');\\n}) | Route handler does not invalidate session following login |

javascript/ql/test/query-tests/Security/CWE-384/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ app.get('/login2', function (req, res) { // OK
2424
});
2525

2626
// using passport
27-
app.get('/passport', passport.authenticate('local'), function (req, res) { // NOT OK - no regenerate
27+
app.get('/passport', passport.authenticate('local'), function (req, res) { // OK - passport is safe
2828
res.send('logged in');
2929
});
3030

0 commit comments

Comments
 (0)