Skip to content

Commit 88e351a

Browse files
committed
Rust: Expand sensitive data test cases.
1 parent 3363235 commit 88e351a

File tree

1 file changed

+27
-5
lines changed
  • rust/ql/test/library-tests/sensitivedata

1 file changed

+27
-5
lines changed

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

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,28 @@ impl MyStruct {
2121
fn get_password() -> String { get_string() }
2222

2323
fn test_passwords(
24-
password: &str, passwd: &str, my_password: &str, password_str: &str, pass_phrase: &str,
25-
auth_key: &str, authenticationkey: &str, authKey: &str,
24+
password: &str, pass_word: &str, passwd: &str, my_password: &str, password_str: &str,
25+
pass_phrase: &str, passphrase: &str, passPhrase: &str,
26+
auth_key: &str, authkey: &str, authKey: &str, authentication_key: &str, authenticationkey: &str, authenticationKey: &str,
2627
harmless: &str, encrypted_password: &str, password_hash: &str,
2728
ms: &MyStruct
2829
) {
2930
// passwords
3031
sink(password); // $ sensitive=password
32+
sink(pass_word); // $ MISSING: sensitive=password
3133
sink(passwd); // $ sensitive=password
3234
sink(my_password); // $ sensitive=password
3335
sink(password_str); // $ sensitive=password
3436
sink(pass_phrase); // $ MISSING: sensitive=password
37+
sink(passphrase); // $ sensitive=password
38+
sink(passPhrase); // $ sensitive=password
39+
3540
sink(auth_key); // $ MISSING: sensitive=password
36-
sink(authenticationkey); // $ sensitive=password
41+
sink(authkey); // $ sensitive=password
3742
sink(authKey); // $ sensitive=password
43+
sink(authentication_key); // $ MISSING: sensitive=password
44+
sink(authenticationkey); // $ sensitive=password
45+
sink(authenticationKey); // $ sensitive=password
3846

3947
sink(ms); // $ MISSING: sensitive=password
4048
sink(ms.password.as_str()); // $ MISSING: sensitive=password
@@ -65,7 +73,9 @@ fn get_secret_token() -> String { get_string() }
6573
fn get_next_token() -> String { get_string() }
6674

6775
fn test_credentials(
68-
account_key: &str, accnt_key: &str, license_key: &str, secret_key: &str, is_secret: bool, num_accounts: i64, uid: i64,
76+
account_key: &str, accnt_key: &str, license_key: &str, secret_key: &str, is_secret: bool, num_accounts: i64,
77+
username: String, user_name: String, userid: i64, user_id: i64, my_user_id_64: i64, unique_id: i64, uid: i64,
78+
sessionkey: &[u64; 4], session_key: &[u64; 4], hashkey: &[u64; 4], hash_key: &[u64; 4],
6979
ms: &MyStruct
7080
) {
7181
// credentials
@@ -74,17 +84,29 @@ fn test_credentials(
7484
sink(license_key); // $ MISSING: sensitive=secret
7585
sink(secret_key); // $ sensitive=secret
7686

87+
sink(username); // $ sensitive=id
88+
sink(user_name); // $ MISSING: sensitive=id
89+
sink(userid); // $ sensitive=id
90+
sink(user_id); // $ MISSING: sensitive=id
91+
sink(my_user_id_64); // $ MISSING: sensitive=id
92+
93+
sink(sessionkey); // $ sensitive=id
94+
sink(session_key); // $ MISSING: sensitive=id
95+
7796
sink(ms.get_certificate()); // $ sensitive=certificate
7897

7998
sink(generate_secret_key()); // $ sensitive=secret
8099
sink(get_secure_key()); // $ MISSING: sensitive=secret
81100
sink(get_private_key()); // $ MISSING: sensitive=secret
82101
sink(get_secret_token()); // $ sensitive=secret
83102

84-
// not credentials
103+
// not (necessarily) credentials
85104
sink(is_secret);
86105
sink(num_accounts); // $ SPURIOUS: sensitive=id
106+
sink(unique_id);
87107
sink(uid); // $ SPURIOUS: sensitive=id
108+
sink(hashkey);
109+
sink(hash_key);
88110

89111
sink(ms.get_certificate_url()); // $ SPURIOUS: sensitive=certificate
90112
sink(ms.get_certificate_file()); // $ SPURIOUS: sensitive=certificate

0 commit comments

Comments
 (0)