Rust: Accept test regressions with new format MaD.

This commit is contained in:
Geoffrey White
2025-07-21 13:50:57 +01:00
parent fc8a662f0d
commit 796cb193fc
2 changed files with 16 additions and 33 deletions

View File

@@ -120,20 +120,3 @@ nodes
| test_cipher.rs:74:23:74:44 | ...::new_from_slice | semmle.label | ...::new_from_slice |
| test_cipher.rs:74:46:74:51 | const2 [&ref, element] | semmle.label | const2 [&ref, element] |
subpaths
testFailures
| test_cipher.rs:45:53:45:99 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:47:88:47:96 | //... | Missing result: Sink |
| test_cipher.rs:66:29:66:75 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:67:51:67:59 | //... | Missing result: Sink |
| test_cipher.rs:80:29:80:75 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:81:90:81:98 | //... | Missing result: Sink |
| test_cipher.rs:84:30:84:76 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:85:91:85:99 | //... | Missing result: Sink |
| test_cipher.rs:124:33:124:79 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:125:26:125:72 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:126:49:126:57 | //... | Missing result: Sink |
| test_cipher.rs:127:78:127:86 | //... | Missing result: Sink |
| test_cipher.rs:129:44:129:90 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:131:38:131:84 | //... | Missing result: Alert[rust/hard-coded-cryptographic-value] |
| test_cipher.rs:132:42:132:50 | //... | Missing result: Sink |
| test_cipher.rs:133:78:133:86 | //... | Missing result: Sink |

View File

@@ -42,9 +42,9 @@ fn test_stream_cipher_rabbit(
let mut rabbit_cipher8 = RabbitKeyOnly::new(rabbit::Key::from_slice(const8)); // $ Sink
rabbit_cipher8.apply_keystream(&mut data);
let const9: [u16;8] = [0, 0, 0, 0, 0, 0, 0, 0]; // $ Alert[rust/hard-coded-cryptographic-value]
let const9: [u16;8] = [0, 0, 0, 0, 0, 0, 0, 0]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let const9_conv = unsafe { const9.align_to::<u8>().1 }; // convert [u16;8] -> [u8;8]
let mut rabbit_cipher9 = RabbitKeyOnly::new(rabbit::Key::from_slice(const9_conv)); // $ Sink
let mut rabbit_cipher9 = RabbitKeyOnly::new(rabbit::Key::from_slice(const9_conv)); // $ MISSING: Sink
rabbit_cipher9.apply_keystream(&mut data);
let const10: [u8;16] = unsafe { std::mem::zeroed() }; // $ Alert[rust/hard-coded-cryptographic-value]
@@ -63,8 +63,8 @@ fn test_block_cipher_aes(
let aes_cipher1 = Aes256::new(key256.into());
aes_cipher1.encrypt_block(block128.into());
let const2 = &[0u8;32]; // $ Alert[rust/hard-coded-cryptographic-value]
let aes_cipher2 = Aes256::new(const2.into()); // $ Sink
let const2 = &[0u8;32]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let aes_cipher2 = Aes256::new(const2.into()); // $ MISSING: Sink
aes_cipher2.encrypt_block(block128.into());
let aes_cipher3 = Aes256::new_from_slice(key256).unwrap();
@@ -77,12 +77,12 @@ fn test_block_cipher_aes(
let aes_cipher5 = cfb_mode::Encryptor::<aes::Aes256>::new(key.into(), iv.into());
_ = aes_cipher5.encrypt_b2b(input, output).unwrap();
let const6 = &[0u8;32]; // $ Alert[rust/hard-coded-cryptographic-value]
let aes_cipher6 = cfb_mode::Encryptor::<aes::Aes256>::new(const6.into(), iv.into()); // $ Sink
let const6 = &[0u8;32]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let aes_cipher6 = cfb_mode::Encryptor::<aes::Aes256>::new(const6.into(), iv.into()); // $ MISSING: Sink
_ = aes_cipher6.encrypt_b2b(input, output).unwrap();
let const7 = &[0u8; 16]; // $ Alert[rust/hard-coded-cryptographic-value]
let aes_cipher7 = cfb_mode::Encryptor::<aes::Aes256>::new(key.into(), const7.into()); // $ Sink
let const7 = &[0u8; 16]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let aes_cipher7 = cfb_mode::Encryptor::<aes::Aes256>::new(key.into(), const7.into()); // $ MISSING: Sink
_ = aes_cipher7.encrypt_b2b(input, output).unwrap();
// various string conversions
@@ -121,16 +121,16 @@ fn test_aes_gcm(
let cipher1 = Aes256Gcm::new(&key1);
let _ = cipher1.encrypt(&nonce1, b"plaintext".as_ref()).unwrap();
let key2: [u8;32] = [0;32]; // $ Alert[rust/hard-coded-cryptographic-value]
let nonce2 = [0;12]; // $ Alert[rust/hard-coded-cryptographic-value]
let cipher2 = Aes256Gcm::new(&key2.into()); // $ Sink
let _ = cipher2.encrypt(&nonce2.into(), b"plaintext".as_ref()).unwrap(); // $ Sink
let key2: [u8;32] = [0;32]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let nonce2 = [0;12]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let cipher2 = Aes256Gcm::new(&key2.into()); // $ MISSING: Sink
let _ = cipher2.encrypt(&nonce2.into(), b"plaintext".as_ref()).unwrap(); // $ MISSING: Sink
let key3_array: &[u8;32] = &[0xff;32]; // $ Alert[rust/hard-coded-cryptographic-value]
let key3_array: &[u8;32] = &[0xff;32]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let key3 = Key::<Aes256Gcm>::from_slice(key3_array);
let nonce3: [u8;12] = [0xff;12]; // $ Alert[rust/hard-coded-cryptographic-value]
let cipher3 = Aes256Gcm::new(&key3); // $ Sink
let _ = cipher3.encrypt(&nonce3.into(), b"plaintext".as_ref()).unwrap(); // $ Sink
let nonce3: [u8;12] = [0xff;12]; // $ MISSING: Alert[rust/hard-coded-cryptographic-value]
let cipher3 = Aes256Gcm::new(&key3); // $ MISSING: Sink
let _ = cipher3.encrypt(&nonce3.into(), b"plaintext".as_ref()).unwrap(); // $ MISSING: Sink
// with barrier