Extend actions/unpinned-tag to analyze composite action metadata (action.yml / action.yaml)#21692
Draft
Extend actions/unpinned-tag to analyze composite action metadata (action.yml / action.yaml)#21692
actions/unpinned-tag to analyze composite action metadata (action.yml / action.yaml)#21692Conversation
Agent-Logs-Url: https://github.com/github/codeql/sessions/c52790be-00f6-4250-b46b-38c05365ddd7 Co-authored-by: oscarsj <1410188+oscarsj@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update CodeQL query to support composite action metadata
Extend Apr 10, 2026
actions/unpinned-tag to analyze composite action metadata (action.yml / action.yaml)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
actions/unpinned-tagcurrently only reportsuses:refs from workflow files because it filters ongetEnclosingWorkflow(). This change broadens coverage to also report unpinned refs in composite action metadata (runs.steps[].uses) while preserving existing workflow behavior and message shape.Query scope expansion (workflow + composite action)
UsesStepin aWorkflow(existing logic retained: workflowname, else workflow file basename), orUsesStepin aCompositeAction(new logic: composite metadata file basename, e.g.action.yml).uses.getEnclosingWorkflow() = workflow.Behavior preserved for existing workflow alerts
CWE-829 test coverage extended
foo/bar@v2) → alert expectedfoo/bar@<40-hex>) → no alert expectedUnpinnedActionsTag.expectedwith the new composite action alert.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
releases.bazel.build/usr/local/lib/node_modules/@bazel/bazelisk/bazelisk-linux_amd64 /usr/local/lib/node_modules/@bazel/bazelisk/bazelisk-linux_amd64 query kind(".*test", //actions/...)(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Implement support for scanning composite action metadata files (
action.yml/action.yaml) in theactions/unpinned-tagCodeQL query so that unpinned action refs used in composite actions are reported.Context:
actions/ql/src/Security/CWE-829/UnpinnedActionsTag.qlingithub/codeqlrequiresuses.getEnclosingWorkflow() = workflow, so it only reports workflow uses steps.Requirements:
uses:references inside composite action metadata files are included.action.yml/action.yamland containruns.steps[].uses.action.yml) or actionname:if present.actions/ql/test/...to cover:Notes:
CompositeActionorUsesStepcontext APIs.uses.getEnclosingWorkflow()ORuses.getEnclosingCompositeAction()), or generalizing to a shared “step container”.Repository: github/codeql
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: can you answer the question on the support escalation? use https://github.com/github/semmle-code and https://github.com/github/codeql-action codebases to investigate
Assistant: This looks like expected behavior of the current
actions/unpinned-tagquery: it’s (effectively) a workflow-only check today, so it will flaguses: owner/repo@taginside.github/workflows/*.yml|*.yaml, but it won’t (currently) evaluate composite action metadata (action.yml/action.yaml) forruns.steps[].uses. Your repro matches that gap.What I found from the two codebases you asked me to use
1)
github/semmle-code: the Actions “surface” being targeted is workflowsIn
semmle-codethere’s explicit “Actions workflow” handling that’s scoped to.github/workflows(even in internal tooling). For example, the repo’sactionlintgenrule only targets.github/workflows/*.ymland doesn’t mentionaction.ymlat all:builduses.github/workflows/*.ymlas the input globs for the GitHub Actions workflow linting target.(See
buildaround theactionlintgenrule.)Source: https://github.com/github/semmle-code/blob/4b5f72d62dadeb9ca073d12cadefd41c0ebc5472/build#L827-L871
That doesn’t prove the CodeQL query itself filters to workflows, but it’s consistent with what you’re seeing: “Actions language” checks in this repo historically center on workflow files, not composite-action metadata.
Also: I attempted to locate
UnpinnedActionsTag.qlingithub/semmle-codevia code search and didn’t get a hit in this repo snapshot, so I can’t point at the exactql/actions/.../UnpinnedActionsTag.qlimplementation here. (The issue links togithub/codeql, notsemmle-code, which likely explains the mismatch.)2)
github/codeql-action: it runs CodeQL CLI, but it doesn’t add special handling for composite action metadataFrom
codeql-action, the “analyze” step orchestrates database finalization and then runs queries (runQueries(...)). Nothing I found suggests it separately enumerates “workflow vs action metadata” files itself; it delegates that to the CodeQL CLI and the selected query packs/suites.src/analyze-action.tscallsrunQueries(...)to execute the configured queries/packs.Source: https://github.com/github/codeql-action/blob/597e12aa85c95194dbf8a83c0e3a649444a119bc/src/analyze-action.ts#L325-L355
So: if the query pack for the
actionslanguage doesn’t modelaction.yml,codeql-actionwon’t “pick it up” magically.Direct answer to the escalation question (“is this expected?”)
Yes, this is expected given the current implementation/coverage of the rule: it is designed (or at least currently implemented) to analyze workflow files and doesn’t currently treat composite action metadata (
action.yml/action.yaml) as part of the analyzed surface for this query. That means a composite action can bypass the check today by placinguses: owner/repo@taginsideruns.stepsin the action metadata file.Recommendation / what Engineering should do next
This pull request was created from Copilot chat.