Repository navigation
Conversation
1 task done
…ssion tests Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add query for SSRF reflection injection in Rust
[NEW QUERY] Rust: rust/ssrf-reflection-injection (CWE-918) for iron request fields and warp async closures
Oct 16, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Nested format templates can incorrectly suppress genuine SSRF findings, while async capture edges bypass intervening assignments and produce false positives.
2 open issues
What changed in this PR
Adds rust/ssrf-reflection-injection to address the Iron request-field and Warp async-capture coverage gaps identified in #140, extending the existing Rust request-forgery models.
Changes:
- Adds Iron sources, async capture flow, and a fixed-host formatting barrier.
- Adds positive and negative fixtures using real Rust framework dependencies.
- Introduces Rust custom packs, query documentation, and installer support.
| File | Description |
|---|---|
scripts/install-codeql-packs.sh |
Accepts Rust as a language filter. |
languages/rust/custom/test/SsrfReflectionInjection/warp_app.rs |
Tests vulnerable and fixed-host Warp requests. |
languages/rust/custom/test/SsrfReflectionInjection/SsrfReflectionInjection.qlref |
Connects fixtures to the query and inline expectations. |
languages/rust/custom/test/SsrfReflectionInjection/SsrfReflectionInjection.expected |
Records expected alerts and flow paths. |
languages/rust/custom/test/SsrfReflectionInjection/options.yml |
Configures extraction with real crate dependencies. |
languages/rust/custom/test/SsrfReflectionInjection/iron_app.rs |
Tests vulnerable and fixed-host Iron requests. |
languages/rust/custom/test/qlpack.yml |
Defines the Rust custom test pack. |
languages/rust/custom/test/.gitignore |
Ignores extractor-generated Cargo artifacts. |
languages/rust/custom/src/SsrfReflectionInjection/SsrfReflectionInjection.ql |
Implements extended SSRF detection. |
languages/rust/custom/src/SsrfReflectionInjection/SsrfReflectionInjection.md |
Documents coverage, recommendations, and examples. |
languages/rust/custom/src/qlpack.yml |
Defines the Rust custom query pack. |
Review effort: Balanced
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📝 Query Information
rust/ssrf-reflection-injection@security-severity 9.1,@precision high)🎯 Description
AI Scan reported two SSRF findings that default setup missed. The issue assumed Rust has no SSRF query, but it does: stock
rust/request-forgery. I reproduced both misses against a test DB built with the realiron,warp,reqwestandtokiocrates (viaoptions.ymlqltest_dependencies). The sinks were already modeled, so both misses are source or flow gaps:reqwest::blocking::get(req.url.to_string())Iron::new(from theiron::prelude::*glob) is unresolved, so the handler is never a remote source.reqand thereq.urlfield do resolve.path::param().then(|p| async move { client.post(format!("https://{}", p)) })Client::postis a sink. Taint is lost whenpis captured by theasync moveblock.What This Query Detects
This query uses the stock
RequestForgerysources, sinks and barriers, and adds:IronRequestFieldSource: reads ofurl/headers/bodyoniron::request::Request. It matches on the field, not onIron::new, soHandlerimpls are covered too.asyncblock that captures it.FixedHostFormatBarrier: aformat!whose template starts with a fixedscheme://hostfollowed by/,?or#. Without it, both safe test cases alert.Supporting changes:
languages/rust/custom/{src,test}packs (Rust had no packs here).languages/rust/custom/test/.gitignorefor the files the extractor generates (Cargo.toml,Cargo.lock,lib.rs,target/).rustadded to the language list inscripts/install-codeql-packs.sh.Example Vulnerable Code
Example Safe Code
🧪 Testing
The test downloads crates from crates.io, so extraction needs network access and takes about 3 minutes. CI does not run
custom/tests: the unit-test workflow only coverslanguages/*/tools/.📋 Checklist
.mdand.qhelp): only.mdis included🔗 References
rust/request-forgery(codeql/rust-queries,queries/security/CWE-918/RequestForgery.ql). The unresolved glob import and the lost async-block capture both look like gaps in the standard Rust library and could be reported there.Note: This query was developed using Test-Driven Development methodology.