Skip to content

Commit 8f95e26

Browse files
committed
Rust: Combine regexs where possible (likely better performance).
1 parent 99e62d6 commit 8f95e26

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ module HeuristicNames {
6363
* user names or other account information.
6464
*/
6565
string maybeAccountInfo() {
66-
result = "(?is).*acc(ou)?nt.*" or
67-
result = "(?is).*(puid|user.?name|user.?id|session.?(id|key)).*" or
66+
result = "(?is).*(acc(ou)?nt|puid|user.?(name|id)|session.?(id|key)).*" or
6867
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6968
}
7069

@@ -73,11 +72,9 @@ module HeuristicNames {
7372
* a password or an authorization key.
7473
*/
7574
string maybePassword() {
76-
result = "(?is).*pass(wd|word|code|.?phrase)(?!.*question).*" or
77-
result = "(?is).*(auth(entication|ori[sz]ation)?).?key.*" or
78-
result = "(?is).*([_-]|\\b)mfa([_-]|\\b).*" or
79-
result = "(?is).*oauth.*" or
80-
result = "(?is).*api.?(key|token).*"
75+
result =
76+
"(?is).*(pass(wd|word|code|.?phrase)(?!.*question)|(auth(entication|ori[sz]ation)?).?key|oauth|"
77+
+ "api.?(key|token)|([_-]|\\b)mfa([_-]|\\b)).*"
8178
}
8279

8380
/**

0 commit comments

Comments
 (0)