Skip to content

Commit 0a5ff1b

Browse files
committed
recognize another kind of dummy passwords to fix an FP in hardcoded-credentials
1 parent 7ffbc73 commit 0a5ff1b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

javascript/ql/lib/semmle/javascript/security/SensitiveActions.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ module PasswordHeuristics {
213213
normalized
214214
.regexpMatch(".*(pass|test|sample|example|secret|root|admin|user|change|auth|fake|(my(token|password))|string|foo|bar|baz|qux|1234|3141|abcd).*")
215215
)
216+
or
217+
// repeats the same char more than 10 times
218+
password.regexpMatch(".*([a-zA-Z0-9])\\1{10,}.*")
216219
}
217220

218221
/**

javascript/ql/test/query-tests/Security/CWE-798/HardcodedCredentials.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,13 @@
284284
require("http").request({auth: "user:fake token"}) // OK
285285
require("http").request({auth: "user:dcba"}) // OK
286286
require("http").request({auth: "user:custom string"}) // OK
287-
});
287+
});
288+
289+
(function () {
290+
// browser API
291+
var headers = new Headers();
292+
headers.append("Authorization", `Basic sdsdag:sdsdag`); // NOT OK
293+
headers.append("Authorization", `Basic sdsdag:xxxxxxxxxxxxxx`); // OK
294+
headers.append("Authorization", `Basic sdsdag:aaaiuogrweuibgbbbbb`); // NOT OK
295+
headers.append("Authorization", `Basic sdsdag:000000000000001`); // OK
296+
});

0 commit comments

Comments
 (0)