Skip to content

Commit ff2cfa5

Browse files
author
Alvaro Muñoz
authored
Merge pull request #31 from github/branch_deploy_head_source
Treat branch-deploy action as a source of HEAD ref for untrusted checkouts
2 parents 54d103f + a0939bb commit ff2cfa5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
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

ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
library: true
33
warnOnImplicitThis: true
44
name: githubsecuritylab/actions-all
5-
version: 0.0.22
5+
version: 0.0.23
66
dependencies:
77
codeql/util: ^0.2.0
88
codeql/yaml: ^0.1.2

ql/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
library: false
33
name: githubsecuritylab/actions-queries
4-
version: 0.0.22
4+
version: 0.0.23
55
groups:
66
- actions
77
- queries

0 commit comments

Comments
 (0)