Skip to content

Conversation

@paldepind
Copy link
Contributor

@paldepind paldepind commented Dec 15, 2025

Also

  • fixes a wrong manual model for as_path which was previously covered up by another wrong generated model 😅
  • Promotes a generated model for Pin::new to a manual model. The model is not precise, but not having it caused a bunch of test failures (here for instance) so it's probably best to keep it until we can get those results the precise way.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Dec 15, 2025
@paldepind paldepind added the no-change-note-required This PR does not need a change note label Dec 15, 2025
@paldepind paldepind force-pushed the rust/prioritize-manual-summaries branch 2 times, most recently from 8b8898e to c07d98f Compare December 15, 2025 17:41
@paldepind paldepind force-pushed the rust/prioritize-manual-summaries branch from c07d98f to 477e1cd Compare December 16, 2025 08:25
@paldepind paldepind marked this pull request as ready for review December 16, 2025 09:04
@paldepind paldepind requested a review from a team as a code owner December 16, 2025 09:04
Copilot AI review requested due to automatic review settings December 16, 2025 09:04
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.

Pull request overview

This pull request enhances the Rust dataflow model system to prevent generated models from being applied when manual models exist for the same function. This ensures that manual models, which are typically more precise, take precedence over automatically generated ones.

Key changes:

  • Implements logic to filter out generated models when manual models exist for a function
  • Fixes an incorrect manual model for PathBuf::as_path
  • Promotes a Pin::new model to manual status to preserve test results

Reviewed changes

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

Show a summary per file
File Description
rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll Adds hasManualModel() predicate and updates propagatesFlow() to exclude generated models when manual models exist
rust/ql/lib/codeql/rust/frameworks/stdlib/fs.model.yml Fixes the as_path model specification from Argument[Self] to Argument[self].Reference
rust/ql/lib/codeql/rust/frameworks/stdlib/core.model.yml Adds a new manual model for Pin::new to handle implicit dereference cases
rust/ql/test/library-tests/dataflow/models/models.ext.yml Adds test models for the snd function to verify the fix works correctly
rust/ql/test/library-tests/dataflow/models/main.rs Adds test case for snd function demonstrating that wrong generated model is ignored
rust/ql/test/library-tests/dataflow/models/models.expected Updates expected test output to reflect the new behavior
rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected Updates expected output to reflect the corrected as_path model

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paldepind
Copy link
Contributor Author

Thanks for the review. Merging as DCA is uneventful.

@paldepind paldepind merged commit 63329b4 into github:main Dec 16, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants