|
| 1 | +/** |
| 2 | + * @name Reusable Workflow Sources |
| 3 | + * @description Reusable Workflow that pass user-controlled data to their output variables. |
| 4 | + * @kind path-problem |
| 5 | + * @problem.severity warning |
| 6 | + * @security-severity 9.3 |
| 7 | + * @precision high |
| 8 | + * @id actions/reusable-workflow-sources |
| 9 | + * @tags actions |
| 10 | + * model-generator |
| 11 | + * external/cwe/cwe-020 |
| 12 | + */ |
| 13 | + |
| 14 | +import actions |
| 15 | +import codeql.actions.TaintTracking |
| 16 | +import codeql.actions.dataflow.FlowSources |
| 17 | +import codeql.actions.dataflow.ExternalFlow |
| 18 | + |
| 19 | +private module MyConfig implements DataFlow::ConfigSig { |
| 20 | + predicate isSource(DataFlow::Node source) { |
| 21 | + source instanceof RemoteFlowSource and |
| 22 | + not source instanceof DataFlow::ParameterNode and |
| 23 | + exists(ReusableWorkflowStmt w | w.getAChildNode*() = source.asExpr()) |
| 24 | + } |
| 25 | + |
| 26 | + predicate isSink(DataFlow::Node sink) { |
| 27 | + exists(ReusableWorkflowStmt w | w.getOutputsStmt().getOutputExpr(_) = sink.asExpr()) |
| 28 | + } |
| 29 | + |
| 30 | + predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet set) { |
| 31 | + allowImplicitRead(node, set) |
| 32 | + or |
| 33 | + isSink(node) and |
| 34 | + set instanceof DataFlow::FieldContent |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +module MyFlow = TaintTracking::Global<MyConfig>; |
| 39 | + |
| 40 | +import MyFlow::PathGraph |
| 41 | + |
| 42 | +from MyFlow::PathNode source, MyFlow::PathNode sink |
| 43 | +where |
| 44 | + MyFlow::flowPath(source, sink) and |
| 45 | + source.getNode().getLocation().getFile() = sink.getNode().getLocation().getFile() |
| 46 | +select sink.getNode(), source, sink, "Source" |
0 commit comments