Skip to content

Conversation

@paldepind
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Feb 7, 2025
@paldepind paldepind marked this pull request as ready for review February 7, 2025 13:50
Copilot AI review requested due to automatic review settings February 7, 2025 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds and updates data flow tests in multiple Rust files to handle cases involving mutable references, updated annotations for reference-based flows in model generator files, and clarifications around reference handling in MyOption methods.

  • Introduces new tests for functions that mutate arguments via references.
  • Adds or refines data flow summaries in model generator to track references more accurately.
  • Updates pointer-related data flow tests to confirm flow through borrowed references.

Changes

File Description
rust/ql/test/library-tests/dataflow/global/main.rs Adds functions mutates_argument_1 and mutates_argument_2 to test data flow from source to sink via mutable references.
rust/ql/test/utils-tests/modelgenerator/summaries.rs Adds reference-based data flow summaries set_int and read_int for improved data flow tracking.
rust/ql/test/utils-tests/modelgenerator/option.rs Adjusts generated summaries to handle references in MyOption methods, clarifying argument and return flows.
rust/ql/test/library-tests/dataflow/pointers/main.rs Enhances pointer tests to verify clearing data after flow, ensuring correct data flow through mutable borrows.

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

let mut n = 0;
sink(n);
set_int(&mut n, source(88));
sink(n); // $ MISSING: hasValueFlow=88
Copy link

Copilot AI Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment indicates a missing data flow annotation for the value from source(88). Consider adding the correct annotation or removing the note to reflect the intended test behavior accurately.

Suggested change
sink(n); // $ MISSING: hasValueFlow=88
sink(n); // $ hasValueFlow=88

Copilot uses AI. Check for mistakes.
@paldepind paldepind requested a review from hvitved February 10, 2025 11:58
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously there's more to be done in future, but this looks like a solid step forward.

I'd like to see a DCA run.

@paldepind
Copy link
Contributor Author

DCA is uneventful as far as I can see.

@paldepind paldepind merged commit 58d86fd into github:main Feb 11, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants