Skip to content

Commit 0106f4e

Browse files
committed
Actions lockfiles: require repository identity
1 parent a6487eb commit 0106f4e

6 files changed

Lines changed: 25 additions & 6 deletions

File tree

actions/ql/lib/change-notes/2026-09-01-actions-lock-yaml.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
category: feature
33
---
44
* GitHub Actions databases now extract `actions.lock` files. The new `ActionsLock` class
5-
provides access to their YAML abstract syntax trees and structurally valid workflow pins.
5+
provides access to their YAML abstract syntax trees and workflow pins with positive owner and
6+
repository IDs and a full commit digest.

actions/ql/lib/codeql/actions/Lock.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ class ActionsLock extends YamlDocument {
99
ActionsLock() { this.getFile().getBaseName() = "actions.lock" }
1010

1111
/**
12-
* Holds if the lockfile records `nwo` at `ref` for `workflowPath` with a full commit digest.
13-
* Repository pins also cover sub-actions such as `actions/cache/save`.
12+
* Holds if the lockfile records `nwo` at `ref` for `workflowPath` with positive owner and
13+
* repository IDs and a full commit digest. Repository pins also cover sub-actions such as
14+
* `actions/cache/save`.
1415
*/
1516
bindingset[nwo]
1617
predicate pins(string workflowPath, string nwo, string ref) {
@@ -32,6 +33,8 @@ class ActionsLock extends YamlDocument {
3233
) and
3334
root.lookup("dependencies").(YamlMapping).lookup(pin) = dependency and
3435
dependency.lookup("ref").(YamlScalar).getValue() = ref and
36+
dependency.lookup("owner_id").(YamlScalar).getValue().toInt() > 0 and
37+
dependency.lookup("repo_id").(YamlScalar).getValue().toInt() > 0 and
3538
dependency
3639
.lookup("commit")
3740
.(YamlScalar)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* The `actions/unpinned-tag` query no longer reports action references pinned by a structurally valid `.github/workflows/actions.lock` entry for the enclosing workflow.
4+
* The `actions/unpinned-tag` query no longer reports action references pinned by a `.github/workflows/actions.lock` entry with positive owner and repository IDs and a full commit digest for the enclosing workflow.

actions/ql/test/query-tests/Security/CWE-829-Lockfile/.github/workflows/actions.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ workflows:
55
- mismatched/action@v1
66
- malformed/action@v1
77
- missing/action@v1
8+
- missing-owner/action@v1
9+
- zero-repo/action@v1
810
.github/workflows/other.yml:
911
- other-workflow/action@v1
1012
dependencies:
@@ -28,3 +30,12 @@ dependencies:
2830
commit: 6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
2931
owner_id: 5
3032
repo_id: 6
33+
missing-owner/action@v1:
34+
ref: v1
35+
commit: sha1-3333333333333333333333333333333333333333
36+
repo_id: 7
37+
zero-repo/action@v1:
38+
ref: v1
39+
commit: sha1-4444444444444444444444444444444444444444
40+
owner_id: 8
41+
repo_id: 0

actions/ql/test/query-tests/Security/CWE-829-Lockfile/.github/workflows/rust-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ jobs:
1212
- uses: mismatched/action@v1 # $ Alert
1313
- uses: malformed/action@v1 # $ Alert
1414
- uses: missing/action@v1 # $ Alert
15+
- uses: missing-owner/action@v1 # $ Alert
16+
- uses: zero-repo/action@v1 # $ Alert
1517
reusable:
1618
uses: dtolnay/rust-toolchain/.github/workflows/reusable.yml@v1 # $ Alert

actions/ql/test/query-tests/Security/CWE-829-Lockfile/UnpinnedActionsTag.expected

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
| .github/workflows/rust-ci.yml:11:13:11:36 | other-workflow/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'other-workflow/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:11:7:12:4 | Uses Step | Uses Step |
33
| .github/workflows/rust-ci.yml:12:13:12:32 | mismatched/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'mismatched/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:12:7:13:4 | Uses Step | Uses Step |
44
| .github/workflows/rust-ci.yml:13:13:13:31 | malformed/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'malformed/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:13:7:14:4 | Uses Step | Uses Step |
5-
| .github/workflows/rust-ci.yml:14:13:14:29 | missing/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'missing/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:14:7:15:2 | Uses Step | Uses Step |
6-
| .github/workflows/rust-ci.yml:16:11:16:66 | dtolnay/rust-toolchain/.github/workflows/reusable.yml@v1 | Job $@ in 'rust-ci.yml' uses reusable workflow 'dtolnay/rust-toolchain/.github/workflows/reusable.yml' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:16:5:16:77 | Job: reusable | Job: reusable |
5+
| .github/workflows/rust-ci.yml:14:13:14:29 | missing/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'missing/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:14:7:15:4 | Uses Step | Uses Step |
6+
| .github/workflows/rust-ci.yml:15:13:15:35 | missing-owner/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'missing-owner/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:15:7:16:4 | Uses Step | Uses Step |
7+
| .github/workflows/rust-ci.yml:16:13:16:31 | zero-repo/action@v1 | Unpinned 3rd party Action 'rust-ci.yml' step $@ uses 'zero-repo/action' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:16:7:17:2 | Uses Step | Uses Step |
8+
| .github/workflows/rust-ci.yml:18:11:18:66 | dtolnay/rust-toolchain/.github/workflows/reusable.yml@v1 | Job $@ in 'rust-ci.yml' uses reusable workflow 'dtolnay/rust-toolchain/.github/workflows/reusable.yml' with ref 'v1', not a pinned commit hash | .github/workflows/rust-ci.yml:18:5:18:77 | Job: reusable | Job: reusable |

0 commit comments

Comments
 (0)