Repository navigation
actions/unpinned-tag: recognize GitHub Immutable Releases per-tag instead of a static repo allow-list #22674
Description
actions/unpinned-tag incorrectly flags Actions pinned to immutable release tags
Problem
The actions/unpinned-tag (UnpinnedActionsTag.ql, CWE-829) query requires third-party Actions
to be pinned to a full commit SHA, and flags any other ref (branch, floating major/minor tag,
semver tag, etc.) as unpinned. This is the right default, since a mutable tag can be repointed by
the publisher (accidentally or maliciously) after the fact.
However, GitHub now supports Immutable Releases and tags:
once enabled for a repository and a specific release is published, that release's tag can never
be moved or have its target changed while it exists, and — critically — if the tag/release is deleted, GitHub does not allow the same tag name to be recreated, so an attacker can never repoint it at a different (e.g. compromised) commit. Pinning to owner/repo@v1.2.3 is then just as safe
as pinning to the commit SHA that tag pointed to at publish time — but the query still reports it
as an unpinned-tag finding, producing a false positive.
The existing immutableActionsDataModel(action) extensible predicate (consumed by
UseOfUnversionedImmutableAction.qll) does not solve this: it is a static, manually curated,
repository-level allow-list left over from an earlier, very limited Docker-image-based
immutable-actions preview. Immutable Releases are granted per tag/release, not per
repository — a repo can have some immutable releases and some ordinary mutable tags — so a
repo-level allow-list can never be accurate, and isn't maintainable at scale (every consuming repo
would need to keep it up to date for every third-party Action it uses).
Proposal
-
New extensible predicate, keyed on
(action, ref)not justaction.
AddimmutableActionRefsDataModel(string action, string ref)to
codeql/actions/ql/lib/codeql/actions/config/ConfigExtensions.qll(+Config.qll), where
actionis normalized toowner/repo(no sub-directory path — immutability is a property of
the repository + tag, so an entry forowner/repoalso covers sub-actions such as
owner/repo/path/to/action). -
New library predicate/class,
UseOfVersionedImmutableActionRef.qll, defining
isImmutableActionRef(step, action, ref). It normalizes the callee (stripping any
sub-directory path) before consulting the data model. -
Mutual exclusion in
UnpinnedActionsTag.ql: add
not isImmutableActionRef(step, nwo, version)alongside the existing
not isImmutableAction(step, nwo)exclusion. The two conditions are independent and
non-overlapping by construction (there's no "mutually exclusive query" primitive in CodeQL;
exclusivity is achieved purely by each side negating the other's firing condition). -
No new alert query. "This ref happens to point to an immutable release" is not itself a
finding — it's purely a suppression signal foractions/unpinned-tag. -
Pre-processing step to populate the data, since CodeQL analysis has no network access at
scan time and immutability is a live, per-tag fact:github/codeqlgains a small utility query,
actions/ql/src/utils/ListUnpinnedActionRefs.ql(@kind table), that reuses the existing
Actions extractor to enumerate every distinct(owner/repo, ref)pair used byuses:steps
and reusable workflow calls in the scanned repo that is not already pinned to a commit
SHA (excluding local/self refs and container image refs). This is "leveraging CodeQL
itself to find all the action refs to check", per the request — no separate YAML parser
needed.github/codeql-actiongets a new step (prototyped here as a standalone composite action,
prepare-immutable-action-refs/) that:- Runs the utility query above against the already-created
actions-language CodeQL
database (codeql query run+bqrs decode). - Filters results to version-like tags (
vX,vX.Y,vX.Y.Z) — branch names,latest,
main, etc. can never correspond to a GitHub Release. - For each remaining
(owner/repo, ref), calls
GET /repos/{owner}/{repo}/releases/tags/{ref}and reads theimmutableboolean directly
from the REST response (simpler than GraphQL, and works with an unauthenticated request
subject to standard rate limits, or authenticated via the workflow's token for the higher
limit). - Emits a CodeQL data extension YAML (
immutableActionRefsDataModel) containing only the
(action, ref)pairs confirmed immutable. Missing/404/false ⇒ default is always "treat as
mutable, still flag it" — fail-safe by construction, no allow-list to maintain. - The generated extension is then passed to
codeql database analyzeas a model pack.
- Runs the utility query above against the already-created
End-to-end validation performed
All of the following was implemented and verified against a downloaded CodeQL CLI bundle
(codeql-bundle-win64 v2.27.1) plus the live GitHub API — not just unit-tested in isolation:
-
Library/query unit tests (
actions/ql/test/query-tests/Security/CWE-829): added a fixture
workflow (immutable_release_tags.yml) exercising:- a repo-level match (
foo/immutable-release@v1.2.3, in the test data extension) → not
flagged - the same repo+tag referenced via a sub-directory action
(foo/immutable-release/sub-action@v1.2.3) → not flagged (proves theowner/repo
normalization works) - the same repo with a different, unlisted tag (
@v1.2.4) → still flagged - a completely unrelated repo (
foo/other-action@v1.2.3) → still flagged
Full
CWE-829,CWE-829-untrusted-owner, andCWE-829-Lockfilequery-test suites pass
(11/11) with these changes. - a repo-level match (
-
Utility query validation: ran
ListUnpinnedActionRefs.qlagainst a real CodeQL database
built from the test fixtures and confirmed it returns exactly the deduplicated, normalized
(action, ref)candidates expected — e.g. bothfoo/immutable-release@v1.2.3and
foo/immutable-release/sub-action@v1.2.3collapse to a single
("foo/immutable-release", "v1.2.3")row. -
Real-world, live-API end-to-end test (no mocking): built a throwaway workflow with
- uses: actions/checkout@v4 - uses: jessehouwing/azdo-marketplace@v6.3.8 - uses: jessehouwing/azdo-marketplace@v6
and ran the full prototype pipeline (
prepare-immutable-action-refs/prepare.sh) against a real
CodeQL database for it:- Confirmed via a live call to
GET /repos/jessehouwing/azdo-marketplace/releases/tags/v6.3.8that GitHub's REST API
returns"immutable": truefor that release. - Confirmed
GET /repos/jessehouwing/azdo-marketplace/releases/tags/v6returns404(no
release exists for that floating major tag) — correctly defaults to "mutable". - Confirmed
GET /repos/actions/checkout/releases/tags/v4also returns404—actions/checkout
doesn't publish releases under that exact tag scheme, so it's correctly left as a flagged,
unpinned tag rather than silently trusted. - The script produced:
extensions: - addsTo: pack: codeql/actions-all extensible: immutableActionRefsDataModel data: - ["jessehouwing/azdo-marketplace", "v6.3.8"]
- Fed this generated file into the actual
UnpinnedActionsTag.qlquery
(codeql query run+--model-packs) against the same database:- Baseline (no immutable-refs data): both
jessehouwing/azdo-marketplace@v6.3.8and
@v6were flagged as unpinned. - With the generated extension applied: only
jessehouwing/azdo-marketplace@v6was
flagged;@v6.3.8was correctly suppressed.
- Baseline (no immutable-refs data): both
- Confirmed via a live call to
This confirms the full loop — CodeQL discovers candidate refs → live GitHub API confirms which are
immutable → generated data extension is consumed by the real query → false positive is eliminated
while true positives remain — works end-to-end, not just in theory.
Scope / what's not yet done
- The
github/codeqlside (predicate, library class, query wiring, docs, tests) is
implementation-ready. - The
github/codeql-actionside is currently a standalone prototype action
(prepare-immutable-action-refs/), not yet wired into the productioninit/analyzesteps.
Full integration would need:- A supported way to pass the generated model pack into the existing
analyzestep (e.g. a new
--model-packs-equivalent input). - Rate-limit/backoff handling for repos with many distinct refs.
- Unit/integration tests in
codeql-action's own test suite. - A decision on default enablement (opt-in vs. on-by-default) and caching of results across runs
to avoid re-querying the GitHub API on every scan.
- A supported way to pass the generated model pack into the existing
Why this matters
Without this, users following GitHub's own recommended best practice (Immutable Releases +
semver tags instead of hand-pinning commit SHAs) are incorrectly flagged by CodeQL, which either
trains them to ignore/dismiss actions/unpinned-tag alerts or discourages adoption of the safer,
more maintainable Immutable Releases feature.
Activity
jessehouwing commentedon Sep 24, 2026
Reference implementation
Both halves of this proposal are implemented and pushed as branches on forks (build/tests pass, live-API validation performed as described above):
github/codeql:jessehouwing/codeql@immutable-releases-reference-implementation(diff)github/codeql-action:jessehouwing/codeql-action@immutable-releases-reference-implementation(diff)The
codeql-actionbranch contains the standalone prototype pre-processing action described above (prepare-immutable-action-refs/); it is intentionally not wired into the productioninit/analyzesteps yet (see "Scope / what's not yet done").jketema commentedon Sep 30, 2026
Hi @jessehouwing,
I believe you've also been in contact with us along a different route, through which the following might already have been shared, but I want to post it here too for completeness:
jessehouwing commentedon Sep 30, 2026
I've had the same thoughts, but looking at the average lock file we have in our organizations, I suspect the datasource won't be that aweful for most organizations. Though I can imagine for some it might go wild. However, I don't really see a way to reduce the datasource without causing false-negatives.
Unless the CodeQL Database keeps historical data of all incantations to that point.
I'm doing similar things in my GitHub Dependency Graph submission action, the total number of action instances is generally low after normalization and the diversity in the actual tags/shas referenced is low as well, for most organizations that have adopted Renovate or Dependabot.
Given that this is most important for public repositories, and that the default token for an Actions workflow has access to public token, the need for a token isn't really a problem from my perspective. I'm not entirely sure when else you'd run it. Or maybe it could be its own completely separate opt-in step.
Right now the way this rule behaves causes me to turn it off, making the rule less than useful. And pinning to shas has problems with ghost commits and other issues like readability.
Is there another moment in which the datasource could be generated? Or are you expecting the gh-actions-lock to basically replace this rule completely in the near future?
jessehouwing commentedon Sep 30, 2026
I've had similar issues with CodeQL not actually analyzing into composite actions and therefore missing some dangerous checkout conditions and other things that would normally trigger a rule violation. It too requires preprocessing or data collection prior to running CodeQL.
Another reference implementation: jessehouwing/codeql-remote-actions-extractor
jketema commentedon Oct 2, 2026
I'm not particularly concerned about this in your scenario, where you populate the model in the same run as where the analysis is done. However, users might opt to prepopulate the model somewhere centrally in their organization, and then there is suddenly a lot more potential for the model to become very large.
jketema commentedon Oct 2, 2026
I'll try to push forward internally, because this is absolutely something I'd like to see covered.
jessehouwing commentedon Oct 2, 2026
Yeah, I can see that happening :). If it's a hidden automatic feature, that won't be too easy to discover.
I did implement this in the OSSF Scorecard as well, they had another concern that isn't implemented in this version yet, ghe.com and ghes support where the data model needs to be built against either the enterprise or public github.
Even if just the datamodel changes are merged in, people can build their own custom runner workflow to provide the data. I'm hoping for the same change in the composite local action folder for deep analysis.
feat(unpinned-uses): accept the tag of an immutable release under --o…