Repository navigation
[Query Fix - githubsecuritylab/rust/iron-response-xss] - report flows that pass a call that has no target - #267
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change addressing missed Iron XSS flows.
No open issues 🎉
What changed in this PR
Fixes a missed Iron XSS flow when an unresolved method call interrupts standard taint tracking. The community query now suppresses resolved response-body results only when the standard analysis finds a flow from the same source, addressing #265.
Changes:
- Adds a standard XSS analysis configuration and matches its sinks by location to avoid duplicate reports.
- Adds a registered-handler regression fixture and expected results for the previously missed flow.
- Updates query documentation to explain when the fallback query reports resolved response bodies.
| File | Description |
|---|---|
rust/test/security/CWE-079/IronResponseXss/main.rs |
Adds a regression fixture with an unresolved method call. |
rust/test/security/CWE-079/IronResponseXss/IronResponseXss.expected |
Adds the newly detected flow and alert. |
rust/test/security/CWE-079/IronResponseXss/IronModels.expected |
Records the fixture’s modelled source and sink. |
rust/src/security/CWE-079/IronResponseXss.ql |
Checks standard flow reachability before suppressing results. |
rust/src/security/CWE-079/IronResponseXss.qhelp |
Documents the revised reporting behavior. |
Review effort: Balanced
felickz
marked this pull request as ready for review
November 26, 2026 06:18
Base automatically changed from
rust/iron-response-xss-unresolved-prelude
to
main
November 26, 2026 06:19
…sponse XSS when the prelude calls have no target (#264) * Rust: find Iron response XSS when the prelude calls have no target A database that is built without compiling the code leaves every call that goes through a glob import of the iron prelude without a target. The Iron data extension rows and the sink that matches the canonical path of Response::with then do not apply, and githubsecuritylab/rust/iron-response-xss found nothing in code that starts with use iron::prelude::*. Recognize the API by its names for those calls, in files that use iron: a function or closure with a Request parameter is a source, the fields of the request and the method calls that have no target pass the data on, and a call of Response::with that has no target is a sink (a body on its own as well). A handler that the modelled source already reaches is reported once. Add a test file that has only the glob import, a test that lists its calls that have no target, a file with the same names from another framework that must not alert, and negative cases (constant body, length only, text/plain, encoded, sanitized, a parameter that is not a request). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752 * Rust: restrict the Iron fallback encoder match, report unregistered body-only handlers Two review findings on the fallback. A method whose name only contains escape or encode was taken to encode for HTML, which hid the taint of escape_default (it keeps markup) and of unescape_html. Only names that say HTML (escape_html, html_escape, encode_html) are taken to encode now. escape_default is an alert in the glob-only fixture, and a method that says escape_html is the safe form. A body that is passed on its own to a call of Response::with that resolves was reported only through the data extension sink, which needs a handler that Iron::new or Chain::new registers. A handler that nothing registers has no modelled source, so the flow was missed. Add the sink for the flows from the request parameter, and leave the flows of modelled sources to the standard query. Add the regression in main.rs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4124a708-0b20-41df-a2e2-c945fbf86752
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
felickz
force-pushed
the
copilot/rustiron-response-xss-unresolved-prelude
branch
from
November 26, 2026 06:19
9afb04a to
4cec067
Compare
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.
IronResponseXss.qldropped every flow from a modelled source (Xss::Source) into aResponse::withbody that resolves, assuming that the standardrust/xssquery reports it. If a method call that has no target lies between the request and the body, only this query'sironUnresolvedStepfollows it. Both queries then miss the flow:Changes
StandardXssConfig/StandardXssFlow: a copy of the standard query's configuration:Xss::Source,Xss::Sink,Xss::Barrier, and no additional steps. It finds exactly the flows that the standard query reports.whereclause: a resolved-body result is now dropped only whenStandardXssFlowreaches the body from the same source. The other suppression, for unmodelled request parameters, is unchanged.format!(...).IronResolvedResponseBodyand the "Known limitations" section of the.qhelpnow describe the two cases this query reports: an unregistered handler, and a call that has no target in the path.bad_registered_unresolved_step_handleris appended tomain.rs, withResponse::with(loud)on line 173.Evidence (local run)
CI does not run on a pull request whose base is not
main, so these results come from a localcodeql test runonrust/test/security/CWE-079/IronResponseXss.main.rs:173.XSS.qlrefstill passed, which confirms that the standard query misses the flow..expecteddiffs contain only added rows:IronResponseXss.expected: the new flow's edges and nodes, and its#selectrow.IronModels.expected: the new source and sink.XSS.expectedandGlobCalls.expectedare unchanged.Cost
The second instance of the standard taint analysis adds some evaluation cost to this query.