Skip to content

Commit 84c72f6

Browse files
committed
Rust: Add models for read methods.
1 parent 13f6de9 commit 84c72f6

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

rust/ql/lib/codeql/rust/frameworks/futures.model.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ extensions:
55
data:
66
- ["repo:https://github.com/rust-lang/futures-rs:futures-executor", "crate::local_pool::block_on", "Argument[0]", "ReturnValue", "value", "manual"]
77
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "<crate::io::buf_reader::BufReader>::new", "Argument[0]", "ReturnValue", "taint", "manual"]
8+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncReadExt::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
9+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncReadExt::read_to_end", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
10+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::read_line", "Argument[self]", "Argument[0].Reference", "taint", "manual"]
11+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"]

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
4747

4848
let mut buffer2 = [0u8; 64];
4949
let bytes_read2 = reader.read(&mut buffer2).await?;
50-
sink(&buffer2[..bytes_read2]); // $ MISSING: hasTaintFlow
50+
sink(&buffer2[..bytes_read2]); // $ hasTaintFlow=url
5151
}
5252

5353
let mut reader2 = futures::io::BufReader::new(reader);
@@ -104,7 +104,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
104104

105105
let mut buffer2 = [0u8; 64];
106106
let bytes_read2 = reader2.read(&mut buffer2).await?;
107-
sink(&buffer2[..bytes_read2]); // $ MISSING: hasTaintFlow
107+
sink(&buffer2[..bytes_read2]); // $ hasTaintFlow=url
108108
}
109109

110110
{
@@ -129,21 +129,21 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
129129
// using the `AsyncBufReadExt::read_until` extension method
130130
let mut line = Vec::new();
131131
let _bytes_read = reader2.read_until(b'\n', &mut line).await?;
132-
sink(&line); // $ MISSING: hasTaintFlow
132+
sink(&line); // $ hasTaintFlow=url
133133
}
134134

135135
{
136136
// using the `AsyncBufReadExt::read_line` extension method
137137
let mut line = String::new();
138138
let _bytes_read = reader2.read_line(&mut line).await?;
139-
sink(&line); // $ MISSING: hasTaintFlow
139+
sink(&line); // $ hasTaintFlow=url
140140
}
141141

142142
{
143143
// using the `AsyncBufReadExt::read_to_end` extension method
144144
let mut buffer = Vec::with_capacity(1024);
145145
let _bytes_read = reader2.read_to_end(&mut buffer).await?;
146-
sink(&buffer); // $ MISSING: hasTaintFlow
146+
sink(&buffer); // $ hasTaintFlow=url
147147
}
148148

149149
{

0 commit comments

Comments
 (0)