@@ -126,6 +126,32 @@ class EnvVarInjectionFromMaDSink extends EnvVarInjectionSink {
126126 EnvVarInjectionFromMaDSink ( ) { madSink ( this , "envvar-injection" ) }
127127}
128128
129+ /**
130+ * Get the relevant event for a sink in EnvVarInjectionCritical.ql where the source type is "artifact".
131+ */
132+ Event getRelevantArtifactEventInPrivilegedContext ( DataFlow:: Node sink ) {
133+ inPrivilegedContext ( sink .asExpr ( ) , result ) and
134+ not exists ( ControlCheck check |
135+ check
136+ .protects ( sink .asExpr ( ) , result ,
137+ [ "envvar-injection" , "untrusted-checkout" , "artifact-poisoning" ] )
138+ ) and
139+ (
140+ sink instanceof EnvVarInjectionFromFileReadSink or
141+ madSink ( sink , "envvar-injection" )
142+ )
143+ }
144+
145+ /**
146+ * Get the relevant event for a sink in EnvVarInjectionCritical.ql where the source type is not "artifact".
147+ */
148+ Event getRelevantNonArtifactEventInPrivilegedContext ( DataFlow:: Node sink ) {
149+ inPrivilegedContext ( sink .asExpr ( ) , result ) and
150+ not exists ( ControlCheck check |
151+ check .protects ( sink .asExpr ( ) , result , [ "envvar-injection" , "code-injection" ] )
152+ )
153+ }
154+
129155/**
130156 * A taint-tracking configuration for unsafe user input
131157 * that is used to construct and evaluate an environment variable.
@@ -163,6 +189,18 @@ private module EnvVarInjectionConfig implements DataFlow::ConfigSig {
163189 exists ( run .getScript ( ) .getAFileReadCommand ( ) )
164190 )
165191 }
192+
193+ predicate observeDiffInformedIncrementalMode ( ) { any ( ) }
194+
195+ Location getASelectedSourceLocation ( DataFlow:: Node source ) { none ( ) }
196+
197+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
198+ result = sink .getLocation ( )
199+ or
200+ result = getRelevantArtifactEventInPrivilegedContext ( sink ) .getLocation ( )
201+ or
202+ result = getRelevantNonArtifactEventInPrivilegedContext ( sink ) .getLocation ( )
203+ }
166204}
167205
168206/** Tracks flow of unsafe user input that is used to construct and evaluate an environment variable. */
0 commit comments