Skip to content

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Dec 4, 2025

Fix FPs from rust/access-after-lifetime-ended involving calls to trait methods using generic parameters (so there is no single static target).

MRVA-100 results look very promising and may justify increasing the query to @precision high. I'll do DCA and MRVA-1000 runs to verify. --- on the MRVA-1000 we go from 998 results to 61; the "before" results are dense with the issue we fix here, while the "after" results are not perfect, but much better.

@geoffw0 geoffw0 requested a review from a team as a code owner December 4, 2025 18:34
Copilot AI review requested due to automatic review settings December 4, 2025 18:34
@geoffw0 geoffw0 added the Rust Pull requests that update Rust code label Dec 4, 2025
Copilot finished reviewing on behalf of geoffw0 December 4, 2025 18:36
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 PR fixes false positives in the rust/access-after-lifetime-ended security query by improving its handling of trait method calls that use generic type parameters.

  • Modified the dataflow analysis to consider runtime targets in addition to static targets for function calls
  • Added comprehensive test coverage for generic trait method calls to prevent regressions

Reviewed changes

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

Show a summary per file
File Description
rust/ql/lib/codeql/rust/security/AccessAfterLifetimeExtensions.qll Updated mayEncloseOnStack predicate to include runtime targets alongside static targets, enabling proper tracking through generic trait method calls
rust/ql/test/query-tests/security/CWE-825/lifetime.rs Added new test case demonstrating safe pointer usage through generic trait methods
rust/ql/test/query-tests/security/CWE-825/main.rs Added call to the new test function
rust/ql/test/query-tests/security/CWE-825/AccessAfterLifetime.expected Updated expected test output with new edges and nodes for the generic test case
rust/ql/src/change-notes/2025-12-04-access-after-lifetime-ended.md Added release note documenting the fix

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

Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

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

Nice fix, this makes sense to me.

….qll

Co-authored-by: Simon Friis Vindum <paldepind@github.com>
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.

2 participants