Skip to content

Commit 10f894b

Browse files
committed
Rust: Model more methods.
1 parent 4d51a15 commit 10f894b

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
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
@@ -13,3 +13,7 @@ extensions:
1313
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::read_line", "Argument[self].Reference", "Argument[0].Reference", "taint", "manual"]
1414
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::read_until", "Argument[self]", "Argument[1].Reference", "taint", "manual"]
1515
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::read_until", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"]
16+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::fill_buf", "Argument[self]", "ReturnValue.Future.Field[crate::result::Result::Ok(0)]", "taint", "manual"]
17+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::io::AsyncBufReadExt::lines", "Argument[self]", "ReturnValue", "taint", "manual"]
18+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "crate::stream::stream::StreamExt::next", "Argument[self]", "ReturnValue.Future.Field[crate::option::Option::Some(0)]", "taint", "manual"]
19+
- ["repo:https://github.com/rust-lang/futures-rs:futures-util", "<crate::io::buf_reader::BufReader as crate::if_std::AsyncBufRead>::poll_fill_buf", "Argument[self].Reference", "ReturnValue.Field[crate::task::poll::Poll::Ready(0)].Field[crate::result::Result::Ok(0)]", "taint", "manual"]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ extensions:
99
extensible: summaryModel
1010
data:
1111
- ["repo:https://github.com/quininer/futures-rustls:futures-rustls", "<crate::TlsConnector>::connect", "Argument[1]", "ReturnValue.Future.Field[crate::result::Result::Ok(0)]", "taint", "manual"]
12+
- ["repo:https://github.com/quininer/futures-rustls:futures-rustls", "<crate::client::TlsStream as crate::if_std::AsyncRead>::poll_read", "Argument[self].Reference", "Argument[1].Reference", "taint", "manual"]
1213
- ["repo:https://github.com/rustls/rustls:rustls", "<crate::conn::ConnectionCommon>::reader", "Argument[self]", "ReturnValue", "taint", "manual"]
14+
- ["repo:https://github.com/rustls/rustls:rustls", "<crate::conn::connection::Reader as crate::io::Read>::read", "Argument[self]", "Argument[0].Reference", "taint", "manual"]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ fn test_rustls() -> std::io::Result<()> {
783783
{
784784
let mut buffer = [0u8; 100];
785785
let _bytes = reader.read(&mut buffer)?;
786-
sink(&buffer); // $ MISSING: hasTaintFlow
786+
sink(&buffer); // $ hasTaintFlow=config_arc
787787
}
788788

789789
{

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
@@ -34,8 +34,8 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
3434
let mut cx = Context::from_waker(futures::task::noop_waker_ref());
3535
let bytes_read = pinned.poll_read(&mut cx, &mut buffer);
3636
if let Poll::Ready(Ok(n)) = bytes_read {
37-
sink(&buffer); // $ MISSING: hasTaintFlow=url
38-
sink(&buffer[..n]); // $ MISSING: hasTaintFlow=url
37+
sink(&buffer); // $ hasTaintFlow=url
38+
sink(&buffer[..n]); // $ hasTaintFlow=url
3939
}
4040
}
4141

@@ -80,7 +80,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
8080
{
8181
// using the `AsyncBufReadExt::fill_buf` extension method (higher-level)
8282
let buffer = reader2.fill_buf().await?;
83-
sink(buffer); // $ MISSING: hasTaintFlow
83+
sink(buffer); // $ hasTaintFlow=url
8484
}
8585

8686
{
@@ -122,7 +122,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
122122
{
123123
// using the `AsyncBufReadExt::fill_buf` extension method (higher-level)
124124
let buffer = reader2.fill_buf().await?;
125-
sink(buffer); // $ MISSING: hasTaintFlow
125+
sink(buffer); // $ hasTaintFlow=url
126126
}
127127

128128
{
@@ -149,7 +149,7 @@ async fn test_futures_rustls_futures_io() -> io::Result<()> {
149149
{
150150
// using the `AsyncBufReadExt::lines` extension method
151151
let mut lines_stream = reader2.lines();
152-
sink(lines_stream.next().await.unwrap()); // $ MISSING: hasTaintFlow
152+
sink(lines_stream.next().await.unwrap()); // $ hasTaintFlow=url
153153
while let Some(line) = lines_stream.next().await {
154154
sink(line.unwrap()); // $ MISSING: hasTaintFlow
155155
}

0 commit comments

Comments
 (0)