-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathReusableWorkflowsSinks.ql
37 lines (31 loc) · 1.06 KB
/
ReusableWorkflowsSinks.ql
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
/**
* @name Reusable Workflow Sinks
* @description Reusable Workflows passing parameters to an expression injection sink.
* @kind path-problem
* @problem.severity warning
* @security-severity 9.3
* @precision high
* @id actions/reusable-workflow-sinks
* @tags actions
* model-generator
* external/cwe/cwe-020
*/
import actions
import codeql.actions.security.CodeInjectionQuery
import codeql.actions.TaintTracking
import codeql.actions.dataflow.ExternalFlow
private module MyConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
exists(ReusableWorkflow w | w.getAnInput() = source.asExpr())
}
predicate isSink(DataFlow::Node sink) {
sink instanceof CodeInjectionSink and not madSink(sink, "code-injection")
}
}
module MyFlow = TaintTracking::Global<MyConfig>;
import MyFlow::PathGraph
from MyFlow::PathNode source, MyFlow::PathNode sink
where
MyFlow::flowPath(source, sink) and
source.getNode().getLocation().getFile() = sink.getNode().getLocation().getFile()
select sink.getNode(), source, sink, "Sink"