Skip to content

Commit 30ae343

Browse files
committed
Make StoredXss use new API
1 parent 4334a51 commit 30ae343

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

go/ql/lib/semmle/go/security/StoredXss.qll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ module StoredXss {
1717
import StoredXssCustomizations::StoredXss
1818

1919
/**
20+
* DEPRECATED: Use `Flow` instead.
21+
*
2022
* A taint-tracking configuration for reasoning about XSS.
2123
*/
22-
class Configuration extends TaintTracking::Configuration {
24+
deprecated class Configuration extends TaintTracking::Configuration {
2325
Configuration() { this = "StoredXss" }
2426

2527
override predicate isSource(DataFlow::Node source) { source instanceof Source }
@@ -35,4 +37,14 @@ module StoredXss {
3537
guard instanceof SanitizerGuard
3638
}
3739
}
40+
41+
private module Config implements DataFlow::ConfigSig {
42+
predicate isSource(DataFlow::Node source) { source instanceof Source }
43+
44+
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
45+
46+
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
47+
}
48+
49+
module Flow = TaintTracking::Global<Config>;
3850
}

go/ql/src/Security/CWE-079/StoredXss.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
*/
1414

1515
import go
16-
import semmle.go.security.StoredXss::StoredXss
17-
import DataFlow::PathGraph
16+
import semmle.go.security.StoredXss
17+
import StoredXss::Flow::PathGraph
1818

19-
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
20-
where cfg.hasFlowPath(source, sink)
19+
from StoredXss::Flow::PathNode source, StoredXss::Flow::PathNode sink
20+
where StoredXss::Flow::flowPath(source, sink)
2121
select sink.getNode(), source, sink, "Stored cross-site scripting vulnerability due to $@.",
2222
source.getNode(), "stored value"

0 commit comments

Comments
 (0)