Skip to content

Commit 9583a2a

Browse files
committed
Rust: Additional test cases for reqwest sources.
1 parent 253ccd1 commit 9583a2a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
| test.rs:52:16:52:33 | ...::home_dir | Flow source 'CommandLineArgs' of type commandargs. |
1515
| test.rs:60:26:60:47 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
1616
| test.rs:63:26:63:47 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
17-
| test.rs:66:26:66:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
17+
| test.rs:66:26:66:47 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
18+
| test.rs:69:26:69:47 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
19+
| test.rs:72:26:72:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
20+
| test.rs:75:26:75:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
21+
| test.rs:78:24:78:35 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,22 @@ async fn test_reqwest() -> Result<(), reqwest::Error> {
6363
let remote_string2 = reqwest::blocking::get("http://example.com/").unwrap().text().unwrap(); // $ Alert[rust/summary/taint-sources]
6464
sink(remote_string2); // $ MISSING: hasTaintFlow
6565

66-
let remote_string3 = reqwest::get("http://example.com/").await?.text().await?; // $ Alert[rust/summary/taint-sources]
66+
let remote_string3 = reqwest::blocking::get("http://example.com/").unwrap().text_with_charset("utf-8").unwrap(); // $ Alert[rust/summary/taint-sources]
6767
sink(remote_string3); // $ MISSING: hasTaintFlow
6868

69+
let remote_string4 = reqwest::blocking::get("http://example.com/").unwrap().bytes().unwrap(); // $ Alert[rust/summary/taint-sources]
70+
sink(remote_string4); // $ MISSING: hasTaintFlow
71+
72+
let remote_string5 = reqwest::get("http://example.com/").await?.text().await?; // $ Alert[rust/summary/taint-sources]
73+
sink(remote_string5); // $ MISSING: hasTaintFlow
74+
75+
let remote_string6 = reqwest::get("http://example.com/").await?.bytes().await?; // $ Alert[rust/summary/taint-sources]
76+
sink(remote_string6); // $ MISSING: hasTaintFlow
77+
78+
let mut request1 = reqwest::get("http://example.com/").await?; // $ Alert[rust/summary/taint-sources]
79+
while let Some(chunk) = request1.chunk().await? {
80+
sink(chunk); // $ MISSING: hasTaintFlow
81+
}
82+
6983
Ok(())
7084
}

0 commit comments

Comments
 (0)