Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The cross-site scripting (XSS) query no longer treats environment variables (the `environment` threat model, e.g. `std::env::var`) as a taint source. These values are trusted deployment configuration set at startup rather than per-request attacker-controlled input, so excluding them removes a class of false positives.
9 changes: 8 additions & 1 deletion rust/ql/lib/codeql/rust/security/XssExtensions.qll
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ module Xss {

/**
* An active threat-model source, considered as a flow source.
*
* Environment variables are excluded: they hold trusted deployment
* configuration (for example the service's own hostname or public base URL,
* set from an environment variable at startup) rather than per-request,
* attacker-controlled input, so they are not a meaningful source for XSS.
*/
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource {
ActiveThreatModelSourceAsSource() { not this.getThreatModel() = "environment" }
}

/**
* A sink for XSS from model data.
Expand Down
Loading