Skip to content

Commit 5a1bf94

Browse files
authored
Merge pull request github#2987 from asger-semmle/js/urls-not-sensitive-data
JS: Declassify sensitive exprs with special characters
2 parents 250afda + a9a9c14 commit 5a1bf94

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

change-notes/1.24/analysis-javascript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional ways dangerous paths can be constructed and used. |
6565
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional ways of constructing arguments to `cmd.exe` and `/bin/sh`. |
6666
| Syntax error (`js/syntax-error`) | Lower severity | This results of this query are now displayed with lower severity. |
67+
| Use of password hash with insufficient computational effort (`js/insufficient-password-hash`) | Fewer false positive results | This query now recognizes additional cases that do not require secure hashing. |
6768

6869
## Changes to libraries
6970

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)