Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

paldepind
Copy link
Contributor

Add tests and models for the Warp web framework.

Note that the models currently doesn't actually work because using Argument[0].Parameter[0] in a source model is not supported. However, per thread on Slack, the right course of action is to keep this model and improve MaD to support this.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Sep 10, 2025
@paldepind paldepind marked this pull request as ready for review September 10, 2025 10:01
@paldepind paldepind requested a review from a team as a code owner September 10, 2025 10:01
@Copilot Copilot AI review requested due to automatic review settings September 10, 2025 10:01
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 adds test coverage and model definitions for the Warp web framework to support taint flow analysis. The changes include test cases demonstrating various Warp filter patterns and corresponding model definitions that mark closure parameters as remote sources.

  • Adds comprehensive test cases for Warp web framework filtering patterns (map, then, and_then)
  • Introduces model definitions for Warp filter trait methods to mark parameters as remote sources
  • Updates test dependencies to include the Warp crate

Reviewed Changes

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

File Description
rust/ql/test/library-tests/dataflow/sources/web_frameworks.rs Adds test module with various Warp filter usage patterns and taint flow expectations
rust/ql/test/library-tests/dataflow/sources/options.yml Adds warp dependency for test compilation
rust/ql/test/library-tests/dataflow/sources/TaintSources.expected Updates expected test results with new Warp-related taint sources
rust/ql/lib/codeql/rust/frameworks/warp.model.yml Defines source models for Warp filter methods marking closure parameters as remote sources

@paldepind paldepind added the no-change-note-required This PR does not need a change note label Sep 10, 2025
geoffw0
geoffw0 previously approved these changes Sep 12, 2025
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.

LGTM, aside from an admittedly nit-picky question about the parameter cutoff. It will be good when we support these sources. 👍

- ["<_ as warp::filter::Filter>::then", "Argument[0].Parameter[1]", "remote", "manual"]
- ["<_ as warp::filter::Filter>::then", "Argument[0].Parameter[2]", "remote", "manual"]
- ["<_ as warp::filter::Filter>::then", "Argument[0].Parameter[3]", "remote", "manual"]
- ["<_ as warp::filter::Filter>::then", "Argument[0].Parameter[4]", "remote", "manual"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably Parameter[4] is an arbitrary cutoff, there could be any number of parameters built up in the chain. I'm not sure what actual numbers to expect in typical real world usage.

I believe the syntax Argument[0].Parameter[0,1,2,3,4] should work equally and would be easier to extend. I don't think you have a test case for arguments after 0 though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've used the comma notation now and added up to two more arguments. The cutoff is still arbitrary, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

One can also write Argument[0].Parameter[0..4].

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't sure if that latter was supported in Rust, I haven't had cause to use it yet. 👍

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.

LGTM. I look forward to when the syntax is fully supported and the tests all pass!

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.

3 participants