Skip to content

Commit c9bbcf9

Browse files
authored
Merge pull request #22962 from LucaCappelletti94/upstream/trusted-schema-not-secret
Shared: Treat `trusted_schema` names as non-sensitive
2 parents c7d6d39 + 1096ebc commit c9bbcf9

7 files changed

Lines changed: 32 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `js/clear-text-logging`).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `py/clear-text-logging-sensitive-data`).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `rb/clear-text-logging-sensitive-data`).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `rust/cleartext-logging`).

‎rust/ql/test/library-tests/sensitivedata/test.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,17 @@ fn get_public_key() -> String { get_string() }
9797
fn get_secret_token() -> String { get_string() }
9898
fn get_next_token() -> String { get_string() }
9999

100+
struct Connection;
101+
102+
impl Connection {
103+
fn set_trusted_schema(&mut self, enabled: bool) -> bool { enabled }
104+
}
105+
100106
fn test_credentials(
101107
account_key: &str, accnt_key: &str, license_key: &str, secret_key: &str, is_secret: bool, num_accounts: i64,
102108
username: String, user_name: String, userid: i64, user_id: i64, my_user_id_64: i64, id: i64, uid: i64, uuid: i64, guid: i64, unique_id: i64,
103109
sessionkey: &[u64; 4], session_key: &[u64; 4], hashkey: &[u64; 4], hash_key: &[u64; 4], sessionkeypath: &[u64; 4], account_key_path: &[u64; 4],
110+
trusted_token: &str, trusted_schema: bool, trustedSchema: bool, conn: &mut Connection,
104111
ms: &MyStruct
105112
) {
106113
// credentials
@@ -125,6 +132,7 @@ fn test_credentials(
125132
sink(get_secure_key()); // $ MISSING: sensitive=secret
126133
sink(get_private_key()); // $ MISSING: sensitive=secret
127134
sink(get_secret_token()); // $ sensitive=secret
135+
sink(trusted_token); // $ sensitive=secret
128136

129137
// not (necessarily) credentials
130138

@@ -146,6 +154,9 @@ fn test_credentials(
146154

147155
sink(get_public_key());
148156
sink(get_next_token());
157+
sink(trusted_schema);
158+
sink(trustedSchema);
159+
sink(conn.set_trusted_schema(false));
149160
}
150161

151162
struct MacAddr {

‎shared/concepts/codeql/concepts/internal/SensitiveDataHeuristics.qll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module HeuristicNames {
5757
* or trusted data.
5858
*/
5959
string maybeSecret() {
60-
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter)|confidential).*"
60+
result = "(?is).*((?<!is|is_)secret|(?<!un|un_|is|is_)trusted(?!_iter|_?schema)|confidential).*"
6161
}
6262

6363
/**
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `swift/cleartext-logging`).

0 commit comments

Comments
 (0)