-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathUseOfHttp.ql
More file actions
42 lines (33 loc) · 1.24 KB
/
UseOfHttp.ql
File metadata and controls
42 lines (33 loc) · 1.24 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 Failure to use HTTPS URLs
* @description Non-HTTPS connections can be intercepted by third parties.
* @kind path-problem
* @problem.severity warning
* @security-severity 8.1
* @precision high
* @id rust/non-https-url
* @tags security
* external/cwe/cwe-319
* external/cwe/cwe-345
*/
import rust
import codeql.rust.dataflow.DataFlow
import codeql.rust.dataflow.TaintTracking
import codeql.rust.security.UseOfHttpExtensions
/**
* A taint configuration for HTTP URL strings that flow to URL-using sinks.
*/
module UseOfHttpConfig implements DataFlow::ConfigSig {
import UseOfHttp
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 UseOfHttpFlow = TaintTracking::Global<UseOfHttpConfig>;
import UseOfHttpFlow::PathGraph
from UseOfHttpFlow::PathNode sourceNode, UseOfHttpFlow::PathNode sinkNode
where UseOfHttpFlow::flowPath(sourceNode, sinkNode)
select sinkNode.getNode(), sourceNode, sinkNode,
"This URL may be constructed with the HTTP protocol, from $@.", sourceNode.getNode(),
"this HTTP URL"