@@ -72,6 +72,25 @@ class EnvPathInjectionFromMaDSink extends EnvPathInjectionSink {
7272 EnvPathInjectionFromMaDSink ( ) { madSink ( this , "envpath-injection" ) }
7373}
7474
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+
7594/**
7695 * A taint-tracking configuration for unsafe user input
7796 * that is used to construct and evaluate an environment variable.
@@ -108,6 +127,18 @@ private module EnvPathInjectionConfig implements DataFlow::ConfigSig {
108127 exists ( run .getScript ( ) .getAFileReadCommand ( ) )
109128 )
110129 }
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+ }
111142}
112143
113144/** Tracks flow of unsafe user input that is used to construct and evaluate the PATH environment variable. */
0 commit comments