Skip to content

Commit fa94fed

Browse files
author
edvraa
committed
simple dataflow for sensitive name
1 parent 97bc7e3 commit fa94fed

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

javascript/ql/src/semmle/javascript/security/InsecureCookie.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ module Cookie {
5858
) and
5959
regexpMatchAuth(val)
6060
)
61+
or
62+
isAuthVariable(expr.getAPredecessor())
6163
}
6264

6365
/**

javascript/ql/test/query-tests/Security/CWE-1004/CookieWithoutHttpOnly.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
| test_responseCookie.js:84:5:84:43 | res.coo ... ptions) | Cookie attribute 'HttpOnly' is not set to true. |
1616
| test_responseCookie.js:95:5:95:41 | res.coo ... ptions) | Cookie attribute 'HttpOnly' is not set to true. |
1717
| test_responseCookie.js:106:5:106:43 | res.coo ... ptions) | Cookie attribute 'HttpOnly' is not set to true. |
18+
| test_responseCookie.js:117:5:117:40 | res.coo ... ptions) | Cookie attribute 'HttpOnly' is not set to true. |

javascript/ql/test/query-tests/Security/CWE-1004/test_responseCookie.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ app.get('/a', function (req, res, next) {
107107
res.end('ok')
108108
})
109109

110+
app.get('/a', function (req, res, next) {
111+
let options = {
112+
maxAge: 9000000000,
113+
httpOnly: false,
114+
}
115+
options.httpOnly = false;
116+
let blabla = "session"
117+
res.cookie(blabla, 'value', options); // BAD, var name likely auth related
118+
res.end('ok')
119+
})
120+
110121
app.get('/a', function (req, res, next) {
111122
let options = {
112123
maxAge: 9000000000,

0 commit comments

Comments
 (0)