Skip to content

Commit 0d9e1b4

Browse files
committed
Rust: Additional test cases exposing what works and what doesn't.
1 parent 8a3a0ef commit 0d9e1b4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

rust/ql/test/library-tests/dataflow/sources/TaintSources.expected

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
| test.rs:72:26:72:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
2020
| test.rs:75:26:75:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
2121
| test.rs:78:24:78:35 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
22-
| test.rs:108:31:108:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
23-
| test.rs:192:16:192:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs. |
22+
| test.rs:110:35:110:46 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
23+
| test.rs:117:31:117:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
24+
| test.rs:201:16:201:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs. |

rust/ql/test/library-tests/dataflow/sources/test.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,18 @@ async fn test_hyper_http(case: i64) -> Result<(), Box<dyn std::error::Error>> {
104104

105105
// make the request
106106
println!("sending request...");
107+
if (case == 0) {
108+
// simple flow case
109+
let request = http::Request::builder().uri(url).body(String::from(""))?;
110+
let mut response = sender.send_request(request).await?; // $ Alert[rust/summary/taint-sources]
111+
sink(&response); // $ hasTaintFlow=request
112+
sink(response); // $ hasTaintFlow=request
113+
return Ok(())
114+
}
115+
// more realistic uses of results...
107116
let request = http::Request::builder().uri(url).body(String::from(""))?;
108117
let mut response = sender.send_request(request).await?; // $ Alert[rust/summary/taint-sources]
109-
sink(&response); // $ MISSING: hasTaintFlow
118+
sink(&response); // $ MISSING: hasTaintFlow=request
110119

111120
if !response.status().is_success() {
112121
return Err("request failed".into())

0 commit comments

Comments
 (0)