-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathXSS.ql
More file actions
42 lines (33 loc) · 1.2 KB
/
XSS.ql
File metadata and controls
42 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @name Cross-site scripting
* @description Writing user input directly to a webpage
* allows for a cross-site scripting vulnerability.
* @kind path-problem
* @problem.severity error
* @security-severity 7.8
* @precision high
* @id rust/xss
* @tags security
* external/cwe/cwe-079
* external/cwe/cwe-116
*/
import rust
import codeql.rust.dataflow.DataFlow
import codeql.rust.dataflow.TaintTracking
import codeql.rust.security.XssExtensions
/**
* A taint configuration for tainted data that reaches an XSS sink.
*/
module XssConfig implements DataFlow::ConfigSig {
import Xss
predicate isSource(DataFlow::Node node) { node instanceof Source }
predicate isSink(DataFlow::Node node) { node instanceof Sink }
predicate isBarrier(DataFlow::Node barrier) { barrier instanceof Barrier }
predicate observeDiffInformedIncrementalMode() { any() }
}
module XssFlow = TaintTracking::Global<XssConfig>;
import XssFlow::PathGraph
from XssFlow::PathNode sourceNode, XssFlow::PathNode sinkNode
where XssFlow::flowPath(sourceNode, sinkNode)
select sinkNode.getNode(), sourceNode, sinkNode, "Cross-site scripting vulnerability due to a $@.",
sourceNode.getNode(), "user-provided value"