@@ -72,6 +72,25 @@ class EnvPathInjectionFromMaDSink extends EnvPathInjectionSink {
72
72
EnvPathInjectionFromMaDSink ( ) { madSink ( this , "envpath-injection" ) }
73
73
}
74
74
75
+ /**
76
+ * Get the relevant event for a sink in EnvPathInjectionCritical.ql where the source type is "artifact".
77
+ */
78
+ Event getRelevantArtifactEventInPrivilegedContext ( DataFlow:: Node sink ) {
79
+ inPrivilegedContext ( sink .asExpr ( ) , result ) and
80
+ not exists ( ControlCheck check |
81
+ check .protects ( sink .asExpr ( ) , result , [ "untrusted-checkout" , "artifact-poisoning" ] )
82
+ ) and
83
+ sink instanceof EnvPathInjectionFromFileReadSink
84
+ }
85
+
86
+ /**
87
+ * Get the relevant event for a sink in EnvPathInjectionCritical.ql where the source type is not "artifact".
88
+ */
89
+ Event getRelevantNonArtifactEventInPrivilegedContext ( DataFlow:: Node sink ) {
90
+ inPrivilegedContext ( sink .asExpr ( ) , result ) and
91
+ not exists ( ControlCheck check | check .protects ( sink .asExpr ( ) , result , "code-injection" ) )
92
+ }
93
+
75
94
/**
76
95
* A taint-tracking configuration for unsafe user input
77
96
* that is used to construct and evaluate an environment variable.
@@ -108,6 +127,18 @@ private module EnvPathInjectionConfig implements DataFlow::ConfigSig {
108
127
exists ( run .getScript ( ) .getAFileReadCommand ( ) )
109
128
)
110
129
}
130
+
131
+ predicate observeDiffInformedIncrementalMode ( ) { any ( ) }
132
+
133
+ Location getASelectedSourceLocation ( DataFlow:: Node source ) { none ( ) }
134
+
135
+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
136
+ result = sink .getLocation ( )
137
+ or
138
+ result = getRelevantArtifactEventInPrivilegedContext ( sink ) .getLocation ( )
139
+ or
140
+ result = getRelevantNonArtifactEventInPrivilegedContext ( sink ) .getLocation ( )
141
+ }
111
142
}
112
143
113
144
/** Tracks flow of unsafe user input that is used to construct and evaluate the PATH environment variable. */
0 commit comments