Skip to content

Commit 2ce4b7b

Browse files
committed
SensitiveDataHeuristics: sync
1 parent 4be3755 commit 2ce4b7b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module HeuristicNames {
5050
* Gets a regular expression that identifies strings that may indicate the presence of secret
5151
* or trusted data.
5252
*/
53-
string maybeSecret() { result = "(?is).*((?<!is)secret|(?<!un|is)trusted).*" }
53+
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
5454

5555
/**
5656
* Gets a regular expression that identifies strings that may indicate the presence of
@@ -96,10 +96,14 @@ module HeuristicNames {
9696
* Gets a regular expression that identifies strings that may indicate the presence of data
9797
* that is hashed or encrypted, and hence rendered non-sensitive, or contains special characters
9898
* suggesting nouns within the string do not represent the meaning of the whole string (e.g. a URL or a SQL query).
99+
*
100+
* We also filter out common words like `certain` and `concert`, since otherwise these could
101+
* be matched by the certificate regular expressions. Same for `accountable` (account), or
102+
* `secretarial` (secret).
99103
*/
100104
string notSensitiveRegexp() {
101105
result =
102-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)).*"
106+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)|certain|concert|secretar|accountant|accountab).*"
103107
}
104108

105109
/**

ruby/ql/lib/codeql/ruby/security/internal/SensitiveDataHeuristics.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module HeuristicNames {
5050
* Gets a regular expression that identifies strings that may indicate the presence of secret
5151
* or trusted data.
5252
*/
53-
string maybeSecret() { result = "(?is).*((?<!is)secret|(?<!un|is)trusted).*" }
53+
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
5454

5555
/**
5656
* Gets a regular expression that identifies strings that may indicate the presence of
@@ -96,10 +96,14 @@ module HeuristicNames {
9696
* Gets a regular expression that identifies strings that may indicate the presence of data
9797
* that is hashed or encrypted, and hence rendered non-sensitive, or contains special characters
9898
* suggesting nouns within the string do not represent the meaning of the whole string (e.g. a URL or a SQL query).
99+
*
100+
* We also filter out common words like `certain` and `concert`, since otherwise these could
101+
* be matched by the certificate regular expressions. Same for `accountable` (account), or
102+
* `secretarial` (secret).
99103
*/
100104
string notSensitiveRegexp() {
101105
result =
102-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)).*"
106+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)|certain|concert|secretar|accountant|accountab).*"
103107
}
104108

105109
/**

0 commit comments

Comments
 (0)