Rust: Additional test cases exposing what works and what doesn't.

This commit is contained in:
Geoffrey White
2025-02-11 15:32:16 +00:00
parent 8a3a0ef24d
commit 0d9e1b410c
2 changed files with 13 additions and 3 deletions

View File

@@ -19,5 +19,6 @@
| test.rs:72:26:72:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:75:26:75:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:78:24:78:35 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:108:31:108:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:192:16:192:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs. |
| test.rs:110:35:110:46 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:117:31:117:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
| test.rs:201:16:201:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs. |

View File

@@ -104,9 +104,18 @@ async fn test_hyper_http(case: i64) -> Result<(), Box<dyn std::error::Error>> {
// make the request
println!("sending request...");
if (case == 0) {
// simple flow case
let request = http::Request::builder().uri(url).body(String::from(""))?;
let mut response = sender.send_request(request).await?; // $ Alert[rust/summary/taint-sources]
sink(&response); // $ hasTaintFlow=request
sink(response); // $ hasTaintFlow=request
return Ok(())
}
// more realistic uses of results...
let request = http::Request::builder().uri(url).body(String::from(""))?;
let mut response = sender.send_request(request).await?; // $ Alert[rust/summary/taint-sources]
sink(&response); // $ MISSING: hasTaintFlow
sink(&response); // $ MISSING: hasTaintFlow=request
if !response.status().is_success() {
return Err("request failed".into())