Skip to content

Commit 2cd4d98

Browse files
authored
Merge pull request #20002 from geoffw0/moresensitive1
Rust: Add more test cases for sensitive data
2 parents 3debd1a + 3bb3fcc commit 2cd4d98

File tree

2 files changed

+41
-22
lines changed

2 files changed

+41
-22
lines changed

rust/ql/test/library-tests/sensitivedata/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ multipleCallTargets
55
| test.rs:73:7:73:36 | ... .as_str() |
66
| test.rs:74:7:74:34 | ... .as_str() |
77
| test.rs:75:7:75:27 | ... .as_str() |
8-
| test.rs:254:7:254:36 | ... .as_str() |
9-
| test.rs:256:7:256:33 | ... .as_str() |
10-
| test.rs:257:7:257:36 | ... .as_str() |
11-
| test.rs:258:7:258:26 | ... .as_str() |
12-
| test.rs:262:7:262:28 | ... .as_str() |
13-
| test.rs:263:7:263:37 | ... .as_str() |
14-
| test.rs:264:7:264:36 | ... .as_str() |
15-
| test.rs:267:7:267:32 | ... .as_str() |
16-
| test.rs:277:7:277:34 | ... .as_str() |
17-
| test.rs:280:7:280:36 | ... .as_str() |
18-
| test.rs:284:7:284:39 | ... .as_str() |
19-
| test.rs:291:7:291:53 | ... .as_str() |
20-
| test.rs:292:7:292:45 | ... .as_str() |
21-
| test.rs:294:7:294:39 | ... .as_str() |
22-
| test.rs:295:7:295:34 | ... .as_str() |
23-
| test.rs:296:7:296:42 | ... .as_str() |
24-
| test.rs:298:7:298:48 | ... .as_str() |
25-
| test.rs:299:7:299:35 | ... .as_str() |
26-
| test.rs:300:7:300:35 | ... .as_str() |
27-
| test.rs:339:7:339:39 | ... .as_str() |
8+
| test.rs:258:7:258:36 | ... .as_str() |
9+
| test.rs:260:7:260:33 | ... .as_str() |
10+
| test.rs:261:7:261:36 | ... .as_str() |
11+
| test.rs:262:7:262:26 | ... .as_str() |
12+
| test.rs:266:7:266:28 | ... .as_str() |
13+
| test.rs:267:7:267:37 | ... .as_str() |
14+
| test.rs:268:7:268:36 | ... .as_str() |
15+
| test.rs:271:7:271:32 | ... .as_str() |
16+
| test.rs:281:7:281:34 | ... .as_str() |
17+
| test.rs:284:7:284:36 | ... .as_str() |
18+
| test.rs:288:7:288:39 | ... .as_str() |
19+
| test.rs:295:7:295:53 | ... .as_str() |
20+
| test.rs:296:7:296:45 | ... .as_str() |
21+
| test.rs:298:7:298:39 | ... .as_str() |
22+
| test.rs:299:7:299:34 | ... .as_str() |
23+
| test.rs:300:7:300:42 | ... .as_str() |
24+
| test.rs:302:7:302:48 | ... .as_str() |
25+
| test.rs:303:7:303:35 | ... .as_str() |
26+
| test.rs:304:7:304:35 | ... .as_str() |
27+
| test.rs:343:7:343:39 | ... .as_str() |

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn get_next_token() -> String { get_string() }
8888

8989
fn test_credentials(
9090
account_key: &str, accnt_key: &str, license_key: &str, secret_key: &str, is_secret: bool, num_accounts: i64,
91-
username: String, user_name: String, userid: i64, user_id: i64, my_user_id_64: i64, unique_id: i64, uid: i64,
91+
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,
9292
sessionkey: &[u64; 4], session_key: &[u64; 4], hashkey: &[u64; 4], hash_key: &[u64; 4], sessionkeypath: &[u64; 4], account_key_path: &[u64; 4],
9393
ms: &MyStruct
9494
) {
@@ -119,8 +119,12 @@ fn test_credentials(
119119

120120
sink(is_secret);
121121
sink(num_accounts); // $ SPURIOUS: sensitive=id
122-
sink(unique_id);
122+
sink(id);
123123
sink(uid); // $ SPURIOUS: sensitive=id
124+
sink(uuid); // $ SPURIOUS: sensitive=id
125+
sink(guid);
126+
sink(unique_id);
127+
124128
sink(hashkey);
125129
sink(hash_key);
126130
sink(sessionkeypath); // $ SPURIOUS: sensitive=id
@@ -345,3 +349,18 @@ fn test_private_info(
345349

346350
sink(ContactDetails::FavouriteColor("blue".to_string()));
347351
}
352+
353+
struct MyArray {
354+
data: [i32; 10],
355+
}
356+
357+
impl MyArray {
358+
fn from_trusted_iterator(iter: impl Iterator<Item = i32>) -> Self {
359+
MyArray { data: [0; 10] }
360+
}
361+
}
362+
363+
fn test_iterator() {
364+
let iter = std::iter::repeat(1).take(10);
365+
sink(MyArray::from_trusted_iterator(iter)); // $ SPURIOUS: sensitive=secret
366+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy