Skip to content

Commit 9d60ec0

Browse files
committed
fix casing on the uid regexp
1 parent 662e335 commit 9d60ec0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

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

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

6565
/**

javascript/ql/test/query-tests/Security/CWE-338/InsecureRandomness.expected

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ nodes
8686
| tst.js:118:34:118:46 | Math.random() |
8787
| tst.js:118:34:118:46 | Math.random() |
8888
| tst.js:118:34:118:62 | Math.ra ... 000_000 |
89+
| tst.js:120:16:120:28 | Math.random() |
90+
| tst.js:120:16:120:28 | Math.random() |
91+
| tst.js:120:16:120:28 | Math.random() |
92+
| tst.js:121:18:121:30 | Math.random() |
93+
| tst.js:121:18:121:30 | Math.random() |
94+
| tst.js:121:18:121:30 | Math.random() |
8995
edges
9096
| tst.js:2:20:2:32 | Math.random() | tst.js:2:20:2:32 | Math.random() |
9197
| tst.js:6:31:6:43 | Math.random() | tst.js:6:20:6:43 | "prefix ... andom() |
@@ -150,6 +156,8 @@ edges
150156
| tst.js:118:34:118:46 | Math.random() | tst.js:118:34:118:62 | Math.ra ... 000_000 |
151157
| tst.js:118:34:118:62 | Math.ra ... 000_000 | tst.js:118:23:118:63 | Math.fl ... 00_000) |
152158
| tst.js:118:34:118:62 | Math.ra ... 000_000 | tst.js:118:23:118:63 | Math.fl ... 00_000) |
159+
| tst.js:120:16:120:28 | Math.random() | tst.js:120:16:120:28 | Math.random() |
160+
| tst.js:121:18:121:30 | Math.random() | tst.js:121:18:121:30 | Math.random() |
153161
#select
154162
| tst.js:2:20:2:32 | Math.random() | tst.js:2:20:2:32 | Math.random() | tst.js:2:20:2:32 | Math.random() | Cryptographically insecure $@ in a security context. | tst.js:2:20:2:32 | Math.random() | random value |
155163
| tst.js:6:20:6:43 | "prefix ... andom() | tst.js:6:31:6:43 | Math.random() | tst.js:6:20:6:43 | "prefix ... andom() | Cryptographically insecure $@ in a security context. | tst.js:6:31:6:43 | Math.random() | random value |
@@ -171,3 +179,5 @@ edges
171179
| tst.js:116:22:116:62 | Math.fl ... 00_000) | tst.js:116:33:116:45 | Math.random() | tst.js:116:22:116:62 | Math.fl ... 00_000) | Cryptographically insecure $@ in a security context. | tst.js:116:33:116:45 | Math.random() | random value |
172180
| tst.js:117:15:117:55 | Math.fl ... 00_000) | tst.js:117:26:117:38 | Math.random() | tst.js:117:15:117:55 | Math.fl ... 00_000) | Cryptographically insecure $@ in a security context. | tst.js:117:26:117:38 | Math.random() | random value |
173181
| tst.js:118:23:118:63 | Math.fl ... 00_000) | tst.js:118:34:118:46 | Math.random() | tst.js:118:23:118:63 | Math.fl ... 00_000) | Cryptographically insecure $@ in a security context. | tst.js:118:34:118:46 | Math.random() | random value |
182+
| tst.js:120:16:120:28 | Math.random() | tst.js:120:16:120:28 | Math.random() | tst.js:120:16:120:28 | Math.random() | Cryptographically insecure $@ in a security context. | tst.js:120:16:120:28 | Math.random() | random value |
183+
| tst.js:121:18:121:30 | Math.random() | tst.js:121:18:121:30 | Math.random() | tst.js:121:18:121:30 | Math.random() | Cryptographically insecure $@ in a security context. | tst.js:121:18:121:30 | Math.random() | random value |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,7 @@ function uid() {
116116
var sessionUid = Math.floor(Math.random() * 4_000_000_000); // NOT OK
117117
var uid = Math.floor(Math.random() * 4_000_000_000); // NOT OK
118118
var my_nice_uid = Math.floor(Math.random() * 4_000_000_000); // NOT OK
119+
var liquid = Math.random(); // OK
120+
var UUID = Math.random(); // NOT OK
121+
var MY_UID = Math.random(); // NOK OK
119122
}

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

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

6565
/**

0 commit comments

Comments
 (0)