Skip to content

Commit b2339ef

Browse files
committed
Rust: Add some alternative sinks.
1 parent 950812b commit b2339ef

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@
2020
| test.rs:74:26:74:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
2121
| test.rs:77:26:77:37 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
2222
| test.rs:80:24:80:35 | ...::get | Flow source 'RemoteSource' of type remote (DEFAULT). |
23-
| test.rs:112:31:112:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
24-
| test.rs:119:31:119:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
25-
| test.rs:209:22:209:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
26-
| test.rs:215:22:215:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
27-
| test.rs:221:22:221:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
28-
| test.rs:227:22:227:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
29-
| test.rs:233:9:233:22 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
30-
| test.rs:237:17:237:30 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
31-
| test.rs:244:50:244:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
32-
| test.rs:250:46:250:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
33-
| test.rs:257:50:257:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
34-
| test.rs:264:50:264:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
35-
| test.rs:271:56:271:69 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
36-
| test.rs:278:46:278:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
37-
| test.rs:285:46:285:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
38-
| test.rs:291:46:291:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
39-
| test.rs:403:31:403:43 | ...::read | Flow source 'FileSource' of type file (DEFAULT). |
40-
| test.rs:408:31:408:38 | ...::read | Flow source 'FileSource' of type file (DEFAULT). |
41-
| test.rs:413:22:413:39 | ...::read_to_string | Flow source 'FileSource' of type file (DEFAULT). |
42-
| test.rs:419:22:419:25 | path | Flow source 'FileSource' of type file (DEFAULT). |
43-
| test.rs:420:27:420:35 | file_name | Flow source 'FileSource' of type file (DEFAULT). |
44-
| test.rs:426:22:426:34 | ...::read_link | Flow source 'FileSource' of type file (DEFAULT). |
45-
| test.rs:436:20:436:38 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
46-
| test.rs:470:21:470:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
47-
| test.rs:471:21:471:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
48-
| test.rs:479:21:479:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
49-
| test.rs:739:16:739:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |
23+
| test.rs:113:31:113:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
24+
| test.rs:120:31:120:42 | send_request | Flow source 'RemoteSource' of type remote (DEFAULT). |
25+
| test.rs:210:22:210:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
26+
| test.rs:216:22:216:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
27+
| test.rs:222:22:222:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
28+
| test.rs:228:22:228:35 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
29+
| test.rs:234:9:234:22 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
30+
| test.rs:238:17:238:30 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
31+
| test.rs:245:50:245:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
32+
| test.rs:251:46:251:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
33+
| test.rs:258:50:258:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
34+
| test.rs:265:50:265:63 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
35+
| test.rs:272:56:272:69 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
36+
| test.rs:280:46:280:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
37+
| test.rs:287:46:287:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
38+
| test.rs:293:46:293:59 | ...::stdin | Flow source 'StdInSource' of type stdin (DEFAULT). |
39+
| test.rs:407:31:407:43 | ...::read | Flow source 'FileSource' of type file (DEFAULT). |
40+
| test.rs:412:31:412:38 | ...::read | Flow source 'FileSource' of type file (DEFAULT). |
41+
| test.rs:417:22:417:39 | ...::read_to_string | Flow source 'FileSource' of type file (DEFAULT). |
42+
| test.rs:423:22:423:25 | path | Flow source 'FileSource' of type file (DEFAULT). |
43+
| test.rs:424:27:424:35 | file_name | Flow source 'FileSource' of type file (DEFAULT). |
44+
| test.rs:430:22:430:34 | ...::read_link | Flow source 'FileSource' of type file (DEFAULT). |
45+
| test.rs:440:20:440:38 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
46+
| test.rs:474:21:474:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
47+
| test.rs:475:21:475:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
48+
| test.rs:483:21:483:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
49+
| test.rs:743:16:743:29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ async fn test_reqwest() -> Result<(), reqwest::Error> {
7878
sink(remote_string6); // $ MISSING: hasTaintFlow
7979

8080
let mut request1 = reqwest::get("example.com").await?; // $ Alert[rust/summary/taint-sources]
81+
sink(request1.chunk().await?.unwrap()); // $ MISSING: hasTaintFlow
8182
while let Some(chunk) = request1.chunk().await? {
8283
sink(chunk); // $ MISSING: hasTaintFlow
8384
}
@@ -269,6 +270,7 @@ fn test_io_stdin() -> std::io::Result<()> {
269270

270271
{
271272
let mut reader_split = std::io::BufReader::new(std::io::stdin()).split(b','); // $ Alert[rust/summary/taint-sources]
273+
sink(reader_split.next().unwrap().unwrap()); // $ MISSING: hasTaintFlow
272274
while let Some(chunk) = reader_split.next() {
273275
sink(chunk.unwrap()); // $ MISSING: hasTaintFlow
274276
}
@@ -380,6 +382,7 @@ async fn test_tokio_stdin() -> Result<(), Box<dyn std::error::Error>> {
380382

381383
{
382384
let mut reader_split = tokio::io::BufReader::new(tokio::io::stdin()).split(b','); // $ MISSING: Alert[rust/summary/taint-sources]
385+
sink(reader_split.next_segment().await?.unwrap()); // $ MISSING: hasTaintFlow
383386
while let Some(chunk) = reader_split.next_segment().await? {
384387
sink(chunk); // $ MISSING: hasTaintFlow
385388
}
@@ -388,8 +391,9 @@ async fn test_tokio_stdin() -> Result<(), Box<dyn std::error::Error>> {
388391
{
389392
let reader = tokio::io::BufReader::new(tokio::io::stdin()); // $ MISSING: Alert[rust/summary/taint-sources]
390393
let mut lines = reader.lines();
394+
sink(lines.next_line().await?.unwrap()); // $ MISSING: hasTaintFlow
391395
while let Some(line) = lines.next_line().await? {
392-
sink(line); // $ hasTai
396+
sink(line); // $ MISSING: hasTaintFlow
393397
}
394398
}
395399

0 commit comments

Comments
 (0)