@@ -93,23 +93,29 @@ private module CodeInjectionConfig implements DataFlow::ConfigSig {
9393module CodeInjectionFlow = TaintTracking:: Global< CodeInjectionConfig > ;
9494
9595/**
96- * Holds if the flow from `source` to `sink` has critical severity and they are
97- * linked by `event`.
96+ * Holds if there is a code injection flow from `source` to `sink` with
97+ * critical severity, linked by `event`.
9898 */
99- pragma [ inline]
100- predicate criticalSeverity ( DataFlow:: Node source , DataFlow:: Node sink , Event event ) {
101- event = getRelevantCriticalEventForSink ( sink ) and
102- source .( RemoteFlowSource ) .getEventName ( ) = event .getName ( )
99+ predicate criticalSeverityCodeInjection (
100+ CodeInjectionFlow:: PathNode source , CodeInjectionFlow:: PathNode sink , Event event
101+ ) {
102+ CodeInjectionFlow:: flowPath ( source , sink ) and
103+ event = getRelevantCriticalEventForSink ( sink .getNode ( ) ) and
104+ source .getNode ( ) .( RemoteFlowSource ) .getEventName ( ) = event .getName ( )
103105}
104106
105- /** Holds if the flow from `source` to `sink` has medium severity. */
106- pragma [ inline]
107- predicate mediumSeverity ( DataFlow:: Node source , DataFlow:: Node sink ) {
108- not criticalSeverity ( source , sink , _) and
107+ /**
108+ * Holds if there is a code injection flow from `source` to `sink` with medium severity.
109+ */
110+ predicate mediumSeverityCodeInjection (
111+ CodeInjectionFlow:: PathNode source , CodeInjectionFlow:: PathNode sink
112+ ) {
113+ CodeInjectionFlow:: flowPath ( source , sink ) and
114+ not criticalSeverityCodeInjection ( source , sink , _) and
109115 // exclude cases where the sink is a JS script and the expression uses toJson
110116 not exists ( UsesStep script |
111117 script .getCallee ( ) = "actions/github-script" and
112- script .getArgumentExpr ( "script" ) = sink .asExpr ( ) and
113- exists ( getAToJsonReferenceExpression ( sink .asExpr ( ) .( Expression ) .getExpression ( ) , _) )
118+ script .getArgumentExpr ( "script" ) = sink .getNode ( ) . asExpr ( ) and
119+ exists ( getAToJsonReferenceExpression ( sink .getNode ( ) . asExpr ( ) .( Expression ) .getExpression ( ) , _) )
114120 )
115121}
0 commit comments