Uh oh!
There was an error while loading. Please reload this page.
Rust: Model sources for std::io - #19304
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces model sources and corresponding tests for taint flows in Rust’s std::io and filesystem operations. The key changes include:
- New test functions for filesystem and std::io sources covering various read operations and buffer handling.
- Updates to the CodeQL models for std::io and std::fs to incorporate new taint flow mappings.
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| rust/ql/test/library-tests/dataflow/sources/test.rs | Added tests for filesystem and IO taint sources, ensuring taint flows from reads. |
| rust/ql/lib/codeql/rust/frameworks/stdlib/io.model.yml | Extended model file with additional taint mappings for standard IO functions. |
| rust/ql/lib/codeql/rust/frameworks/stdlib/fs.model.yml | Updated file to include new taint sources for file operations. |
Files not reviewed (2)
- rust/ql/lib/codeql/rust/Concepts.qll: Language not supported
- rust/ql/test/library-tests/dataflow/sources/TaintSources.expected: Language not supported
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| - ["lang:std", "<crate::io::stdio::Stdin as crate::io::Read>::read_exact", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
| - ["lang:std", "<crate::io::stdio::StdinLock as crate::io::Read>::read_exact", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
| - ["lang:std", "<crate::fs::File as crate::io::Read>::read_exact", "Argument[self]", "Argument[0].Reference", "taint", "manual"] | ||
| - ["lang:std", "crate::io::Read::read_exact", "Argument[self]", "Argument[0].Reference", "taint", "manual"] |
There was a problem hiding this comment.
I suppose the repetitive definitions for read_exact could be removed once we have support for models for trait-functions?
There was a problem hiding this comment.
Yep, and that will then include any other variations we come across as well.
| /** | ||
| * A data flow source corresponding to a file access. | ||
| */ | ||
| final class FileSource = FileSource::Range; |
There was a problem hiding this comment.
Aliases inherit the QL doc from the entities that they alias, so it is only needed when different QL doc is needed (same further down).
Model sources + add tests for
std::io. Also added new concept implementations forstdinandfilethreat model sources in Rust, similar to existing implementations in that file.