-
Notifications
You must be signed in to change notification settings - Fork 2k
Extend actions/unpinned-tag to analyze composite action metadata (action.yml / action.yaml)
#21692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /** | ||
| * @name Unpinned tag for a non-immutable Action in workflow | ||
| * @name Unpinned tag for a non-immutable Action in workflow or composite action | ||
| * @description Using a tag for a non-immutable Action that is not pinned to a commit can lead to executing an untrusted Action through a supply chain attack. | ||
| * @kind problem | ||
| * @security-severity 5.0 | ||
|
|
@@ -31,15 +31,26 @@ | |
| bindingset[nwo] | ||
| private predicate isContainerImage(string nwo) { nwo.regexpMatch("^docker://.+") } | ||
|
|
||
| from UsesStep uses, string nwo, string version, Workflow workflow, string name | ||
| private predicate getStepContainerName(UsesStep uses, string name) { | ||
Check warningCode scanning / CodeQL Predicates starting with "get" or "as" should return a value Warning
This predicate starts with 'get' but does not return a value.
|
||
| exists(Workflow workflow | | ||
| uses.getEnclosingWorkflow() = workflow and | ||
| ( | ||
| workflow.getName() = name | ||
|
Comment on lines
+34
to
+38
|
||
| or | ||
| not exists(workflow.getName()) and workflow.getLocation().getFile().getBaseName() = name | ||
| ) | ||
| ) | ||
| or | ||
| exists(CompositeAction action | | ||
| uses.getEnclosingCompositeAction() = action and | ||
| name = action.getLocation().getFile().getBaseName() | ||
| ) | ||
| } | ||
|
|
||
| from UsesStep uses, string nwo, string version, string name | ||
| where | ||
| uses.getCallee() = nwo and | ||
| uses.getEnclosingWorkflow() = workflow and | ||
| ( | ||
| workflow.getName() = name | ||
| or | ||
| not exists(workflow.getName()) and workflow.getLocation().getFile().getBaseName() = name | ||
| ) and | ||
| getStepContainerName(uses, name) and | ||
| uses.getVersion() = version and | ||
| not isTrustedOwner(nwo) and | ||
| not (if isContainerImage(nwo) then isPinnedContainer(version) else isPinnedCommit(version)) and | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * The `actions/unpinned-tag` query now analyzes composite action metadata (`action.yml`/`action.yaml` files) in addition to workflow files, providing more comprehensive detection of unpinned action references across the entire Actions ecosystem. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: Composite unpinned tag test | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: foo/bar@v2 | ||
| - uses: foo/bar@25b062c917b0c75f8b47d8469aff6c94ffd89abb | ||
|
Comment on lines
+1
to
+6
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ edges | |
| | .github/actions/download-artifact/action.yaml:25:7:29:4 | Run Step | .github/actions/download-artifact/action.yaml:29:7:32:18 | Run Step | | ||
| | .github/actions/download-artifact/action.yaml:29:7:32:18 | Run Step | .github/workflows/artifactpoisoning91.yml:19:9:25:6 | Run Step: metadata | | ||
| | .github/actions/download-artifact/action.yaml:29:7:32:18 | Run Step | .github/workflows/resolve-args.yml:22:9:36:13 | Run Step: resolve-step | | ||
| | .github/actions/unpinned-tag/action.yml:5:7:6:4 | Uses Step | .github/actions/unpinned-tag/action.yml:6:7:6:61 | Uses Step | | ||
| | .github/workflows/actor_trusted_checkout.yml:9:7:14:4 | Uses Step | .github/workflows/actor_trusted_checkout.yml:14:7:15:4 | Uses Step | | ||
|
Comment on lines
10
to
12
|
||
| | .github/workflows/actor_trusted_checkout.yml:14:7:15:4 | Uses Step | .github/workflows/actor_trusted_checkout.yml:15:7:19:4 | Run Step | | ||
| | .github/workflows/actor_trusted_checkout.yml:15:7:19:4 | Run Step | .github/workflows/actor_trusted_checkout.yml:19:7:23:4 | Uses Step | | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.