Skip to content

Commit bdfd461

Browse files
author
Alvaro Muñoz
committed
Only triggered on non-pull_request events
1 parent 822e9bc commit bdfd461

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ql/src/Security/CWE-077/PrivilegedEnvVarInjection.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ import actions
1616
import codeql.actions.security.EnvVarInjectionQuery
1717
import EnvVarInjectionFlow::PathGraph
1818

19+
predicate isSingleTriggerWorkflow(Workflow w, string trigger) {
20+
w.getATriggerEvent() = trigger and
21+
count(string t | w.getATriggerEvent() = t | t) = 1
22+
}
23+
1924
from EnvVarInjectionFlow::PathNode source, EnvVarInjectionFlow::PathNode sink, Workflow w
2025
where
2126
EnvVarInjectionFlow::flowPath(source, sink) and
2227
w = source.getNode().asExpr().getEnclosingWorkflow() and
23-
w.hasTriggerEvent(source.getNode().(RemoteFlowSource).getATriggerEvent())
28+
not isSingleTriggerWorkflow(w, "pull_request")
2429
select sink.getNode(), source, sink,
2530
"Potential privileged environment variable injection in $@, which may be controlled by an external user.",
2631
sink, sink.getNode().asExpr().(Expression).getRawExpression()

0 commit comments

Comments
 (0)