Rust: Additional test cases for tuple content.#21107
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test cases for dataflow and taint analysis through tuple field accesses in Rust. The tests verify that the CodeQL analysis correctly tracks flow when data passes through tuple construction and field access operations, including nested tuples.
Key Changes
- Added a new
tuplestest module with test cases for value flow and taint flow through tuple field accesses - Test cases cover simple tuples, nested tuples, and tuples containing other tuples
- Updated expected output files to reflect the new test cases
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/ql/test/library-tests/dataflow/taint/main.rs | Added new tuples module with comprehensive test cases for tuple field access patterns and integrated it into the main test function |
| rust/ql/test/library-tests/dataflow/taint/inline-taint-flow.expected | Added expected dataflow edges, nodes, and select results for the new tuple test cases |
| rust/ql/test/library-tests/dataflow/taint/TaintFlowStep.expected | Added expected taint flow steps for tuple field accesses and tuple expression construction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "".to_string() | ||
| } | ||
|
|
||
| fn source_tuple(i: i64) -> (String, String) { |
There was a problem hiding this comment.
For this function the returned tuple, but not its elements, will be tainted. Hence the tests using this function relies on the taint steps added in #20879.
There was a problem hiding this comment.
Yep, thats the intent. 👍
Additional test cases for flow out through tuple fields accesses. Written during review of #20879 - we might as well add these to our tests permanently.