Skip to content

Commit a1d479e

Browse files
committed
JS: Declassify sensitive exprs with special characters
1 parent 3ae1aad commit a1d479e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ module HeuristicNames {
6363

6464
/**
6565
* Gets a regular expression that identifies strings that may indicate the presence of data
66-
* that is hashed or encrypted, and hence rendered non-sensitive.
66+
* that is hashed or encrypted, and hence rendered non-sensitive, or contains special characters
67+
* suggesting nouns within the string do not represent the meaning of the whole string (e.g. a URL or a SQL query).
6768
*/
6869
string notSensitive() {
69-
result = "(?is).*(redact|censor|obfuscate|hash|md5|sha|((?<!un)(en))?(crypt|code)).*"
70+
result = "(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|((?<!un)(en))?(crypt|code)).*"
7071
}
7172
}
7273

javascript/ql/test/library-tests/SensitiveActions/tst.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ secret;
2222

2323
require("process").exit();
2424
global.process.exit();
25+
26+
get("https://example.com/news?password=true")
27+
get("https://username:[email protected]")
28+
execute("SELECT * FROM users WHERE password=?")

0 commit comments

Comments
 (0)