Skip to content

Commit 834d5ec

Browse files
committed
add session{key,id} as sensitive info
1 parent 1e1e549 commit 834d5ec

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

javascript/ql/lib/semmle/javascript/security/internal/SensitiveDataHeuristics.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module HeuristicNames {
5858
*/
5959
string maybeAccountInfo() {
6060
result = "(?is).*acc(ou)?nt.*" or
61-
result = "(?is).*(puid|username|userid).*" or
61+
result = "(?is).*(puid|username|userid|session(id|key)).*" or
6262
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6363
}
6464

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
| tst-httpOnly.js:289:37:289:59 | `authKe ... {attr}` | Sensitive server cookie is missing 'httpOnly' flag. |
1818
| tst-httpOnly.js:303:9:307:2 | session ... BAD\\n}) | Sensitive server cookie is missing 'httpOnly' flag. |
1919
| tst-httpOnly.js:320:9:324:2 | session ... tter\\n}) | Sensitive server cookie is missing 'httpOnly' flag. |
20+
| tst-httpOnly.js:330:37:330:68 | "sessio ... onKey() | Sensitive server cookie is missing 'httpOnly' flag. |

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,13 @@ app.use(session({
322322
keys: ['key1', 'key2'],
323323
cookie: { httpOnly: false } // BAD, It is a session cookie, name doesn't matter
324324
}))
325+
326+
const http = require('http');
327+
function test10() {
328+
const server = http.createServer((req, res) => {
329+
res.setHeader('Content-Type', 'text/html');
330+
res.setHeader("Set-Cookie", "sessionKey=" + makeSessionKey()); // BAD
331+
res.writeHead(200, { 'Content-Type': 'text/plain' });
332+
res.end('ok');
333+
});
334+
}

python/ql/lib/semmle/python/security/internal/SensitiveDataHeuristics.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module HeuristicNames {
5858
*/
5959
string maybeAccountInfo() {
6060
result = "(?is).*acc(ou)?nt.*" or
61-
result = "(?is).*(puid|username|userid).*" or
61+
result = "(?is).*(puid|username|userid|session(id|key)).*" or
6262
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6363
}
6464

0 commit comments

Comments
 (0)