Skip to content

ci: pin remote actions to immutable commits - #18

Merged
yapishu merged 1 commit into
tlon/multi-sessionfrom
codex/pin-ci-actions-2026-11-06
Nov 6, 2026
Merged

yapishu merged 1 commit into
tlon/multi-sessionfrom
codex/pin-ci-actions-2026-11-06

Conversation

@yapishu

@yapishu yapishu commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Pin 15 mutable GitHub Actions references to full 40-character commit SHAs. Tags (including version tags such as v4) and branches can be moved by an upstream maintainer or an attacker with control of that account, changing code that runs with CI credentials without a change in this repository. Commit pins make action-source updates explicit and reviewable.

Changes

  • Resolve each existing action tag/branch to its upstream commit, retaining the original reference in a comment. Existing full SHA pins and local action paths remain intact.
  • Add Action pins / Check immutable action references on pull requests, default-branch pushes, and manual dispatch. It parses YAML in tracked workflows and action.yml / action.yaml files, including composite actions and reusable workflow references, and rejects remote references without a full commit SHA (or a SHA-256 digest for Docker actions).
  • Run the checker with Ruby's standard library on ubuntu-24.04, with a pinned checkout, read-only contents permission, and no persisted checkout credentials or downloaded linter dependencies.

Based on tlon/multi-session at 66817cfec3eae2b5241066932421bb02f417c75e. Reference resolution date: 2026-11-06.

How did I test?

  • Resolved upstream references through GitHub's commits API.
  • Parsed every changed YAML file and verified that existing workflow structure and values are unchanged apart from action references.
  • Ran the pin checker against all workflow/local action manifests in this repository.
  • Exercised 15 positive/negative checker fixtures, including mutable tags/branches, short SHAs, quoted/flow/multiline YAML, aliases, local paths, reusable workflows, composite actions, Docker digests, and malformed YAML.
  • Validated the new workflow with actionlint.

Risks and impact

The action commits are the current targets of the existing references, not major-version upgrades. Pinning prevents future ref movement; it does not establish that upstream code is trustworthy or freeze packages, container images, binaries, or nested actions downloaded by that code. Existing shell installers and job/service container tags need a separate review. Action updates now require changing the SHA explicitly.

Make Check immutable action references a required status check in branch protection/rulesets to block merges that fail it. This PR adds the check but does not change repository or organization settings. Application builds and deployments are not run locally for this workflow-only change.

GitHub recommends full-length commit SHA pins.

Rollback plan

Revert this commit. This restores mutable references and removes the pin check.

Screenshots

Not applicable; CI configuration only.

@yapishu
yapishu merged commit 02c0471 into tlon/multi-session Nov 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant