Skip to content

Commit 9fbd293

Browse files
committed
Ruby: avoid making notSensitiveRegexp always flag instance/class variables as not sensitive
1 parent 15cab6e commit 9fbd293

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ 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+
*`@` is not considered to be a special character as it may appear in the names of class or instance variables.
99100
*
100101
* We also filter out common words like `certain` and `concert`, since otherwise these could
101102
* be matched by the certificate regular expressions. Same for `accountable` (account), or
102103
* `secretarial` (secret).
103104
*/
104105
string notSensitiveRegexp() {
105106
result =
106-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)|certain|concert|secretar|accountant|accountab).*"
107+
"(?is).*([^\\w$.-@]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|code)|certain|concert|secretar|accountant|accountab).*"
107108
}
108109

109110
/**

0 commit comments

Comments
 (0)