Skip to content

Rust: Exclude taint-read-steps for axum::extract::state::State - #22471

Open
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:rust/exclude-axum-state-steps
Open

Rust: Exclude taint-read-steps for axum::extract::state::State#22471
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:rust/exclude-axum-state-steps

Conversation

@hvitved

@hvitved hvitved commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

As suggested on #22466, we do not want to consider State struct parameters of handlers as taint sources. We cannot model this exclusion in our existing MaD row, so instead this PR simply prevents taint-flow out of the State struct.

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label Aug 31, 2026
@hvitved
hvitved force-pushed the rust/exclude-axum-state-steps branch from c755197 to 6136137 Compare September 1, 2026 07:41
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Sep 1, 2026
@hvitved
hvitved force-pushed the rust/exclude-axum-state-steps branch from 6136137 to b96552d Compare September 1, 2026 08:12
@hvitved
hvitved marked this pull request as ready for review September 1, 2026 09:11
@hvitved
hvitved requested a review from a team as a code owner September 1, 2026 09:11
Copilot AI balanced review requested due to automatic review settings September 1, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The test does not cover the tuple-struct parameter destructuring used by the reported regression.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity rust/​ql/​test/​library-tests/​dataflow/​sources/​web_frameworks/​test.rs — This regression test exercises a field expression, but the reported Axum case destructures the…
What changed in this PR

Prevents Axum application state from propagating remote taint while preserving taint for request-controlled handler inputs.

Changes:

  • Excludes reads of State’s inner field from default taint propagation.
  • Adds an Axum regression handler and updates generated expectations.
File Description
rust/​ql/​lib/​codeql/​rust/​frameworks/​axum.model.yml Adds the State(0) taint-step exclusion.
rust/​ql/​test/​library-tests/​dataflow/​sources/​web_frameworks/​test.rs Adds regression coverage for state and body parameters.
rust/​ql/​test/​library-tests/​dataflow/​sources/​web_frameworks/​TaintSources.expected Updates source expectations.
rust/​ql/​test/​library-tests/​dataflow/​sources/​web_frameworks/​InlineFlow.expected Updates flow expectations.
rust/​ql/​test/​library-tests/​dataflow/​sources/​web_frameworks/​CONSISTENCY/​TypeInferenceConsistency.expected Updates shifted consistency locations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/ql/test/library-tests/dataflow/sources/web_frameworks/test.rs
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