Skip to content

Commit 123458f

Browse files
committed
Sync identical files.
1 parent a6b4a18 commit 123458f

File tree

4 files changed

+68
-48
lines changed

4 files changed

+68
-48
lines changed

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ module HeuristicNames {
5454
* Gets a regular expression that identifies strings that may indicate the presence of secret
5555
* or trusted data.
5656
*/
57-
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
57+
string maybeSecret() {
58+
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter)|confidential).*"
59+
}
5860

5961
/**
6062
* Gets a regular expression that identifies strings that may indicate the presence of
6163
* user names or other account information.
6264
*/
6365
string maybeAccountInfo() {
64-
result = "(?is).*acc(ou)?nt.*" or
65-
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
6667
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6768
}
6869

@@ -71,8 +72,9 @@ module HeuristicNames {
7172
* a password or an authorization key.
7273
*/
7374
string maybePassword() {
74-
result = "(?is).*pass(wd|word|code|.?phrase)(?!.*question).*" or
75-
result = "(?is).*(auth(entication|ori[sz]ation)?).?key.*"
75+
result =
76+
"(?is).*(pass(wd|word|code|.?phrase)(?!.*question)|(auth(entication|ori[sz]ation)?).?key|oauth|"
77+
+ "api.?(key|token)|([_-]|\\b)mfa([_-]|\\b)).*"
7678
}
7779

7880
/**
@@ -88,7 +90,7 @@ module HeuristicNames {
8890
string maybePrivate() {
8991
result =
9092
"(?is).*(" +
91-
// Inspired by the list on https://cwe.mitre.org/data/definitions/359.html
93+
// Inspired by multiple sources including the list on https://cwe.mitre.org/data/definitions/359.html
9294
// Government identifiers, such as Social Security Numbers
9395
"social.?security|employer.?identification|national.?insurance|resident.?id|" +
9496
"passport.?(num|no)|([_-]|\\b)ssn([_-]|\\b)|" +
@@ -100,17 +102,19 @@ module HeuristicNames {
100102
// Geographic location - where the user is (or was)
101103
"latitude|longitude|nationality|" +
102104
// Financial data - such as credit card numbers, salary, bank accounts, and debts
103-
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|" +
104-
"salary|billing|credit.?(rating|score)|([_-]|\\b)ccn([_-]|\\b)|" +
105+
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|routing.?num|"
106+
+ "salary|billing|beneficiary|credit.?(rating|score)|([_-]|\\b)(ccn|cvv|iban)([_-]|\\b)|" +
105107
// Communications - e-mail addresses, private e-mail messages, SMS text messages, chat logs, etc.
106108
// "e(mail|_mail)|" + // this seems too noisy
107109
// Health - medical conditions, insurance status, prescription records
108-
"birth.?da(te|y)|da(te|y).?(of.?)?birth|" +
109-
"medical|(health|care).?plan|healthkit|appointment|prescription|" +
110+
"birth.?da(te|y)|da(te|y).?(of.?)?birth|gender|([_-]|\\b)sex([_-]|\\b)|" +
111+
"medical|(health|care).?plan|healthkit|appointment|prescription|patient.?(id|record)|" +
110112
"blood.?(type|alcohol|glucose|pressure)|heart.?(rate|rhythm)|body.?(mass|fat)|" +
111113
"menstrua|pregnan|insulin|inhaler|" +
112114
// Relationships - work and family
113-
"employ(er|ee)|spouse|maiden.?name" +
115+
"employ(er|ee)|spouse|maiden.?name|" +
116+
// Device information
117+
"([_-]|\\b)ip.?addr|mac.?addr|finger.?print" +
114118
// ---
115119
").*"
116120
}
@@ -144,7 +148,8 @@ module HeuristicNames {
144148
*/
145149
string notSensitiveRegexp() {
146150
result =
147-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|certain|concert|secretar|accountant|accountab).*"
151+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|"
152+
+ "certain|concert|secretar|account(ant|ab|ing|ed)|file|path|([_-]|\\b)url).*"
148153
}
149154

150155
/**

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ module HeuristicNames {
5454
* Gets a regular expression that identifies strings that may indicate the presence of secret
5555
* or trusted data.
5656
*/
57-
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
57+
string maybeSecret() {
58+
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter)|confidential).*"
59+
}
5860

5961
/**
6062
* Gets a regular expression that identifies strings that may indicate the presence of
6163
* user names or other account information.
6264
*/
6365
string maybeAccountInfo() {
64-
result = "(?is).*acc(ou)?nt.*" or
65-
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
6667
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6768
}
6869

@@ -71,8 +72,9 @@ module HeuristicNames {
7172
* a password or an authorization key.
7273
*/
7374
string maybePassword() {
74-
result = "(?is).*pass(wd|word|code|.?phrase)(?!.*question).*" or
75-
result = "(?is).*(auth(entication|ori[sz]ation)?).?key.*"
75+
result =
76+
"(?is).*(pass(wd|word|code|.?phrase)(?!.*question)|(auth(entication|ori[sz]ation)?).?key|oauth|"
77+
+ "api.?(key|token)|([_-]|\\b)mfa([_-]|\\b)).*"
7678
}
7779

7880
/**
@@ -88,7 +90,7 @@ module HeuristicNames {
8890
string maybePrivate() {
8991
result =
9092
"(?is).*(" +
91-
// Inspired by the list on https://cwe.mitre.org/data/definitions/359.html
93+
// Inspired by multiple sources including the list on https://cwe.mitre.org/data/definitions/359.html
9294
// Government identifiers, such as Social Security Numbers
9395
"social.?security|employer.?identification|national.?insurance|resident.?id|" +
9496
"passport.?(num|no)|([_-]|\\b)ssn([_-]|\\b)|" +
@@ -100,17 +102,19 @@ module HeuristicNames {
100102
// Geographic location - where the user is (or was)
101103
"latitude|longitude|nationality|" +
102104
// Financial data - such as credit card numbers, salary, bank accounts, and debts
103-
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|" +
104-
"salary|billing|credit.?(rating|score)|([_-]|\\b)ccn([_-]|\\b)|" +
105+
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|routing.?num|"
106+
+ "salary|billing|beneficiary|credit.?(rating|score)|([_-]|\\b)(ccn|cvv|iban)([_-]|\\b)|" +
105107
// Communications - e-mail addresses, private e-mail messages, SMS text messages, chat logs, etc.
106108
// "e(mail|_mail)|" + // this seems too noisy
107109
// Health - medical conditions, insurance status, prescription records
108-
"birth.?da(te|y)|da(te|y).?(of.?)?birth|" +
109-
"medical|(health|care).?plan|healthkit|appointment|prescription|" +
110+
"birth.?da(te|y)|da(te|y).?(of.?)?birth|gender|([_-]|\\b)sex([_-]|\\b)|" +
111+
"medical|(health|care).?plan|healthkit|appointment|prescription|patient.?(id|record)|" +
110112
"blood.?(type|alcohol|glucose|pressure)|heart.?(rate|rhythm)|body.?(mass|fat)|" +
111113
"menstrua|pregnan|insulin|inhaler|" +
112114
// Relationships - work and family
113-
"employ(er|ee)|spouse|maiden.?name" +
115+
"employ(er|ee)|spouse|maiden.?name|" +
116+
// Device information
117+
"([_-]|\\b)ip.?addr|mac.?addr|finger.?print" +
114118
// ---
115119
").*"
116120
}
@@ -144,7 +148,8 @@ module HeuristicNames {
144148
*/
145149
string notSensitiveRegexp() {
146150
result =
147-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|certain|concert|secretar|accountant|accountab).*"
151+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|"
152+
+ "certain|concert|secretar|account(ant|ab|ing|ed)|file|path|([_-]|\\b)url).*"
148153
}
149154

150155
/**

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ module HeuristicNames {
5454
* Gets a regular expression that identifies strings that may indicate the presence of secret
5555
* or trusted data.
5656
*/
57-
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
57+
string maybeSecret() {
58+
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter)|confidential).*"
59+
}
5860

5961
/**
6062
* Gets a regular expression that identifies strings that may indicate the presence of
6163
* user names or other account information.
6264
*/
6365
string maybeAccountInfo() {
64-
result = "(?is).*acc(ou)?nt.*" or
65-
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
6667
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6768
}
6869

@@ -71,8 +72,9 @@ module HeuristicNames {
7172
* a password or an authorization key.
7273
*/
7374
string maybePassword() {
74-
result = "(?is).*pass(wd|word|code|.?phrase)(?!.*question).*" or
75-
result = "(?is).*(auth(entication|ori[sz]ation)?).?key.*"
75+
result =
76+
"(?is).*(pass(wd|word|code|.?phrase)(?!.*question)|(auth(entication|ori[sz]ation)?).?key|oauth|"
77+
+ "api.?(key|token)|([_-]|\\b)mfa([_-]|\\b)).*"
7678
}
7779

7880
/**
@@ -88,7 +90,7 @@ module HeuristicNames {
8890
string maybePrivate() {
8991
result =
9092
"(?is).*(" +
91-
// Inspired by the list on https://cwe.mitre.org/data/definitions/359.html
93+
// Inspired by multiple sources including the list on https://cwe.mitre.org/data/definitions/359.html
9294
// Government identifiers, such as Social Security Numbers
9395
"social.?security|employer.?identification|national.?insurance|resident.?id|" +
9496
"passport.?(num|no)|([_-]|\\b)ssn([_-]|\\b)|" +
@@ -100,17 +102,19 @@ module HeuristicNames {
100102
// Geographic location - where the user is (or was)
101103
"latitude|longitude|nationality|" +
102104
// Financial data - such as credit card numbers, salary, bank accounts, and debts
103-
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|" +
104-
"salary|billing|credit.?(rating|score)|([_-]|\\b)ccn([_-]|\\b)|" +
105+
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|routing.?num|"
106+
+ "salary|billing|beneficiary|credit.?(rating|score)|([_-]|\\b)(ccn|cvv|iban)([_-]|\\b)|" +
105107
// Communications - e-mail addresses, private e-mail messages, SMS text messages, chat logs, etc.
106108
// "e(mail|_mail)|" + // this seems too noisy
107109
// Health - medical conditions, insurance status, prescription records
108-
"birth.?da(te|y)|da(te|y).?(of.?)?birth|" +
109-
"medical|(health|care).?plan|healthkit|appointment|prescription|" +
110+
"birth.?da(te|y)|da(te|y).?(of.?)?birth|gender|([_-]|\\b)sex([_-]|\\b)|" +
111+
"medical|(health|care).?plan|healthkit|appointment|prescription|patient.?(id|record)|" +
110112
"blood.?(type|alcohol|glucose|pressure)|heart.?(rate|rhythm)|body.?(mass|fat)|" +
111113
"menstrua|pregnan|insulin|inhaler|" +
112114
// Relationships - work and family
113-
"employ(er|ee)|spouse|maiden.?name" +
115+
"employ(er|ee)|spouse|maiden.?name|" +
116+
// Device information
117+
"([_-]|\\b)ip.?addr|mac.?addr|finger.?print" +
114118
// ---
115119
").*"
116120
}
@@ -144,7 +148,8 @@ module HeuristicNames {
144148
*/
145149
string notSensitiveRegexp() {
146150
result =
147-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|certain|concert|secretar|accountant|accountab).*"
151+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|"
152+
+ "certain|concert|secretar|account(ant|ab|ing|ed)|file|path|([_-]|\\b)url).*"
148153
}
149154

150155
/**

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ module HeuristicNames {
5454
* Gets a regular expression that identifies strings that may indicate the presence of secret
5555
* or trusted data.
5656
*/
57-
string maybeSecret() { result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted).*" }
57+
string maybeSecret() {
58+
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter)|confidential).*"
59+
}
5860

5961
/**
6062
* Gets a regular expression that identifies strings that may indicate the presence of
6163
* user names or other account information.
6264
*/
6365
string maybeAccountInfo() {
64-
result = "(?is).*acc(ou)?nt.*" or
65-
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
6667
result = "(?s).*([uU]|^|_|[a-z](?=U))([uU][iI][dD]).*"
6768
}
6869

@@ -71,8 +72,9 @@ module HeuristicNames {
7172
* a password or an authorization key.
7273
*/
7374
string maybePassword() {
74-
result = "(?is).*pass(wd|word|code|.?phrase)(?!.*question).*" or
75-
result = "(?is).*(auth(entication|ori[sz]ation)?).?key.*"
75+
result =
76+
"(?is).*(pass(wd|word|code|.?phrase)(?!.*question)|(auth(entication|ori[sz]ation)?).?key|oauth|"
77+
+ "api.?(key|token)|([_-]|\\b)mfa([_-]|\\b)).*"
7678
}
7779

7880
/**
@@ -88,7 +90,7 @@ module HeuristicNames {
8890
string maybePrivate() {
8991
result =
9092
"(?is).*(" +
91-
// Inspired by the list on https://cwe.mitre.org/data/definitions/359.html
93+
// Inspired by multiple sources including the list on https://cwe.mitre.org/data/definitions/359.html
9294
// Government identifiers, such as Social Security Numbers
9395
"social.?security|employer.?identification|national.?insurance|resident.?id|" +
9496
"passport.?(num|no)|([_-]|\\b)ssn([_-]|\\b)|" +
@@ -100,17 +102,19 @@ module HeuristicNames {
100102
// Geographic location - where the user is (or was)
101103
"latitude|longitude|nationality|" +
102104
// Financial data - such as credit card numbers, salary, bank accounts, and debts
103-
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|" +
104-
"salary|billing|credit.?(rating|score)|([_-]|\\b)ccn([_-]|\\b)|" +
105+
"(credit|debit|bank|visa).?(card|num|no|acc(ou)?nt)|acc(ou)?nt.?(no|num|credit)|routing.?num|"
106+
+ "salary|billing|beneficiary|credit.?(rating|score)|([_-]|\\b)(ccn|cvv|iban)([_-]|\\b)|" +
105107
// Communications - e-mail addresses, private e-mail messages, SMS text messages, chat logs, etc.
106108
// "e(mail|_mail)|" + // this seems too noisy
107109
// Health - medical conditions, insurance status, prescription records
108-
"birth.?da(te|y)|da(te|y).?(of.?)?birth|" +
109-
"medical|(health|care).?plan|healthkit|appointment|prescription|" +
110+
"birth.?da(te|y)|da(te|y).?(of.?)?birth|gender|([_-]|\\b)sex([_-]|\\b)|" +
111+
"medical|(health|care).?plan|healthkit|appointment|prescription|patient.?(id|record)|" +
110112
"blood.?(type|alcohol|glucose|pressure)|heart.?(rate|rhythm)|body.?(mass|fat)|" +
111113
"menstrua|pregnan|insulin|inhaler|" +
112114
// Relationships - work and family
113-
"employ(er|ee)|spouse|maiden.?name" +
115+
"employ(er|ee)|spouse|maiden.?name|" +
116+
// Device information
117+
"([_-]|\\b)ip.?addr|mac.?addr|finger.?print" +
114118
// ---
115119
").*"
116120
}
@@ -144,7 +148,8 @@ module HeuristicNames {
144148
*/
145149
string notSensitiveRegexp() {
146150
result =
147-
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|certain|concert|secretar|accountant|accountab).*"
151+
"(?is).*([^\\w$.-]|redact|censor|obfuscate|hash|md5|sha|random|((?<!un)(en))?(crypt|(?<!pass)code)|"
152+
+ "certain|concert|secretar|account(ant|ab|ing|ed)|file|path|([_-]|\\b)url).*"
148153
}
149154

150155
/**

0 commit comments

Comments
 (0)