Skip to content

Commit 26eaa9a

Browse files
committed
Actions: EnvVarInjection
1 parent 826541d commit 26eaa9a

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

actions/ql/lib/codeql/actions/security/EnvVarInjectionQuery.qll

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,38 @@ private module EnvVarInjectionConfig implements DataFlow::ConfigSig {
164164
)
165165
}
166166

167-
predicate observeDiffInformedIncrementalMode() {
168-
any() // TODO: Make sure that the location overrides match the query's select clause: Column 7 does not select a source or sink originating from the flow call on line 24 (/Users/d10c/src/semmle-code/ql/actions/ql/src/Security/CWE-077/EnvVarInjectionCritical.ql@48:36:48:40)
167+
predicate observeDiffInformedIncrementalMode() { any() }
168+
169+
Location getASelectedSourceLocation(DataFlow::Node source) { none() }
170+
171+
Location getASelectedSinkLocation(DataFlow::Node sink) {
172+
result = sink.getLocation()
173+
or
174+
// where clause from EnvVarInjectionCritical.ql
175+
exists(Event event, RemoteFlowSource source | result = event.getLocation() |
176+
inPrivilegedContext(sink.asExpr(), event) and
177+
isSource(source) and
178+
// exclude paths to file read sinks from non-artifact sources
179+
(
180+
// source is text
181+
not source.getSourceType() = "artifact" and
182+
not exists(ControlCheck check |
183+
check.protects(sink.asExpr(), event, ["envvar-injection", "code-injection"])
184+
)
185+
or
186+
// source is an artifact or a file from an untrusted checkout
187+
source.getSourceType() = "artifact" and
188+
not exists(ControlCheck check |
189+
check
190+
.protects(sink.asExpr(), event,
191+
["envvar-injection", "untrusted-checkout", "artifact-poisoning"])
192+
) and
193+
(
194+
sink instanceof EnvVarInjectionFromFileReadSink or
195+
madSink(sink, "envvar-injection")
196+
)
197+
)
198+
)
169199
}
170200
}
171201

0 commit comments

Comments
 (0)