Skip to content

Actions: report floating tags of immutable Actions in actions/unpinned-tag - #22630

Open
Darkslayer3324j wants to merge 1 commit into
github:mainfrom
Darkslayer3324j:actions-unpinned-tag-floating-immutable
Open

Darkslayer3324j wants to merge 1 commit into
github:mainfrom
Darkslayer3324j:actions-unpinned-tag-floating-immutable

Conversation

@Darkslayer3324j

Copy link
Copy Markdown

Fixes #22414.

actions/unpinned-tag exempted every Action on the immutable-actions list from the unpinned-tag warning, whatever ref it used. GitHub's immutability only covers complete release tags (vX.Y.Z) and commit SHAs; floating tags such as v4, v4.1, main or latest are moved by the maintainers and stay mutable. UnversionedImmutableAction does not catch these either, because its isSemVer accepts bare majors like v4.

Change

  • UseOfUnversionedImmutableAction.qll: add isFullSemVer (complete X.Y.Z, optional v prefix, pre-release and build metadata) and have isSemVer reuse it, so the existing regex is not duplicated and UnversionedImmutableAction is unchanged.
  • UnpinnedActionsTag.ql: the immutable-Action exemption now also requires isFullSemVer(version). Full commit SHAs and lockfile pins were already handled by the earlier conditions; trusted-owner exemptions are untouched.
  • Change note (minorAnalysis).

As noted on the issue, actions and github are trusted by default, so the gap only shows without extra config for octokit/request-action. It is also visible for any immutable Action once its owner is distrusted with a !owner entry (#22415), which is why the new cases are in the CWE-829-untrusted-owner test.

Tests

  • New CWE-829-untrusted-owner/.github/workflows/unpinned_immutable.yml with inline # $ Alert expectations: floating tags (v4, v4.1, main, latest, and octokit/request-action@v2, @v2.x) are reported; v4.2.2, 4.2.2, v4.2.2-rc.1, octokit/request-action@v2.1.9 and a full SHA are not. Without the query change, all six alerts show up as Missing result: Alert; with it the test passes.
  • CWE-829/UnpinnedActionsTag.expected gains 4 alerts, all the existing octokit/request-action@v2.x / @v2.x.x uses (regenerated with codeql test run --learn).
  • codeql test run over CWE-829, CWE-829-Lockfile and CWE-829-untrusted-owner: 10/10 pass, including UnversionedImmutableAction. codeql query format --check-only is clean on both changed QL files.

Written with AI assistance (Claude Code); I reproduced the gap, ran the tests before and after, and checked the alert diffs above.

…d-tag

The query exempted any Action on the immutable-actions list regardless of the
ref used. Only complete version tags (vX.Y.Z) and commit SHAs are immutable;
floating tags such as v4, v4.1 or main are moved by the maintainers. Only
exempt an immutable Action when it is pinned to a complete SemVer version.

Fixes github#22414

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Darkslayer3324j
Darkslayer3324j requested a review from a team as a code owner September 20, 2026 13:55
@github-actions github-actions Bot added documentation Actions Analysis of GitHub Actions labels Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Actions Analysis of GitHub Actions documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unpinned floating tags (e.g. v4) on immutable Actions are not flagged by actions/unpinned-tag

1 participant