Skip to content

Commit 0473c38

Browse files
author
Alvaro Muñoz
committed
Treat branch-deploy action as a source of HEAD ref for untrusted checkouts
1 parent 54d103f commit 0473c38

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ class ActionsMutableRefCheckout extends MutableRefCheckoutStep instanceof UsesSt
9292
or
9393
// 3rd party actions returning the PR head sha/ref
9494
exists(UsesStep step |
95-
step.getCallee() = ["eficode/resolve-pr-refs", "xt0rted/pull-request-comment-branch"] and
96-
// TODO: This should be read step of the head_sha or head_ref output vars
97-
this.getArgument("ref").regexpMatch(".*head_ref.*") and
95+
(
96+
step.getCallee() = ["eficode/resolve-pr-refs", "xt0rted/pull-request-comment-branch"] and
97+
// TODO: This should be read step of the head_sha or head_ref output vars
98+
this.getArgument("ref").matches("%.head_ref%")
99+
or
100+
step.getCallee() = ["github/branch-deploy"] and
101+
// TODO: This should be read step of the ref output var
102+
this.getArgument("ref").matches("%.ref%")
103+
) and
98104
DataFlow::hasLocalFlowExpr(step, this.getArgumentExpr("ref"))
99105
)
100106
or

0 commit comments

Comments
 (0)