Rust: Also lift read steps in summaries as taint steps#21122
Merged
Conversation
| bindingset[derefChain, borrow, strippedTypePath, strippedType] | ||
| private predicate hasNoCompatibleNonBlanketLikeTargetCheck( | ||
| string derefChain, BorrowKind borrow, TypePath strippedTypePath, Type strippedType | ||
| DerefChain derefChain, BorrowKind borrow, TypePath strippedTypePath, Type strippedType |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
67a4cff to
c1533de
Compare
c1533de to
209ee92
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR generalizes taint propagation through read steps in Rust data flow analysis. Previously, only element and reference content would propagate taint through all read steps (including flow summaries). Now, all content types participate in taint propagation through read steps, unless explicitly excluded.
Key changes:
- Simplified taint tracking logic to treat all read steps uniformly
- Enables flow summaries to properly participate in taint propagation for all content types
- Fixes previously missing taint flows through operations like
.clone().into_string().unwrap()and.lines().nth(1).unwrap().clone()
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/lib/codeql/rust/dataflow/internal/TaintTrackingImpl.qll | Simplified taint step logic to apply to all read steps rather than just element/reference content |
| rust/ql/test/query-tests/security/CWE-798/HardcodedCryptographicValue.expected | Updated test expectations with new flow summaries (MaD 18-22) for Vec::from conversions |
| rust/ql/test/query-tests/security/CWE-022/TaintedPath.expected | Added new taint edges for PathBuf conversions through field reads |
| rust/ql/test/library-tests/dataflow/strings/inline-taint-flow.expected | Updated with new String::from flow summaries and renumbered existing models |
| rust/ql/test/library-tests/dataflow/sources/stdin/test.rs | Removed MISSING marker - taint flow now properly detected through .clone() |
| rust/ql/test/library-tests/dataflow/sources/stdin/InlineFlow.expected | Added new edges for clone and nth operations, new models for these operations |
| rust/ql/test/library-tests/dataflow/sources/file/test.rs | Removed MISSING marker - taint flow now detected through .into_string().unwrap() |
| rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected | Added new OsString::into_string flow summary |
| rust/ql/test/library-tests/dataflow/modeled/inline-flow.expected | Added new Pin::new flow summary and updated model numbering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does what the title says.
DCA looks good: A good number of new alerts, and no performance regressions.