mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Rust: Add a test case for 'from_trusted_iterator' as sensitive data FP.
This commit is contained in:
@@ -345,3 +345,18 @@ fn test_private_info(
|
||||
|
||||
sink(ContactDetails::FavouriteColor("blue".to_string()));
|
||||
}
|
||||
|
||||
struct MyArray {
|
||||
data: [i32; 10],
|
||||
}
|
||||
|
||||
impl MyArray {
|
||||
fn from_trusted_iterator(iter: impl Iterator<Item = i32>) -> Self {
|
||||
MyArray { data: [0; 10] }
|
||||
}
|
||||
}
|
||||
|
||||
fn test_iterator() {
|
||||
let iter = std::iter::repeat(1).take(10);
|
||||
sink(MyArray::from_trusted_iterator(iter)); // $ SPURIOUS: sensitive=secret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user