Skip to content

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Oct 15, 2025

Generalize some existing models to trait models.

  • generally that means replacing a model <a as b>::c with <_ as b>::c, unless there's a good reason why that model only applies to a.
  • resulting duplicate models have been removed.
  • there are a few odd models, I've leaned towards preserving behaviour and thus results, rather than maximal cleanliness.
  • works well in the tests I tried (i.e. finds a few more results), full CI and DCA to follow.

@Copilot Copilot AI review requested due to automatic review settings October 15, 2025 19:36
@geoffw0 geoffw0 requested a review from a team as a code owner October 15, 2025 19:36
@geoffw0 geoffw0 added the Rust Pull requests that update Rust code label Oct 15, 2025
Copy link
Contributor

@Copilot 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 PR generalizes existing Rust models by replacing specific type implementations with trait models, improving data flow detection. The generalization transforms models like <specific_type as trait>::method to <_ as trait>::method, allowing the models to apply to all types implementing the trait rather than just specific implementations.

Key changes:

  • Generalized trait models in stdlib framework definitions
  • Updated test expectations to reflect improved data flow detection
  • Added change note documenting the improvement

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rust/ql/test/library-tests/dataflow/strings/main.rs Updated comment to reflect newly detected taint flow
rust/ql/test/library-tests/dataflow/strings/inline-taint-flow.expected Updated test expectations with new generalized models and additional flow detection
rust/ql/test/library-tests/dataflow/sources/InlineFlow.expected Updated test expectations reflecting model generalizations and renumbering
rust/ql/test/library-tests/dataflow/local/main.rs Updated comments to reflect newly detected taint flows
rust/ql/lib/codeql/rust/frameworks/stdlib/lang-core.model.yml Generalized iterator and conversion trait models
rust/ql/lib/codeql/rust/frameworks/stdlib/lang-alloc.model.yml Generalized string, arithmetic, and allocator trait models
rust/ql/lib/codeql/rust/frameworks/stdlib/io.model.yml Generalized IO trait models
rust/ql/lib/change-notes/2025-10-15-models.md Added change note documenting the improvement

@geoffw0
Copy link
Contributor Author

geoffw0 commented Oct 16, 2025

DCA LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant