Skip to content

ci: pin third-party actions to commit SHA#1396

Merged
thepagent merged 1 commit into
mainfrom
ci/pin-third-party-actions-by-sha
Jul 13, 2026
Merged

ci: pin third-party actions to commit SHA#1396
thepagent merged 1 commit into
mainfrom
ci/pin-third-party-actions-by-sha

Conversation

@chaodu-agent

Copy link
Copy Markdown
Collaborator

What

Pins the five third-party (non-actions/*, non-docker/*) GitHub Actions used in this repo's workflows to an immutable commit SHA, found during a follow-up audit after #1393.

Action Before After
dtolnay/rust-toolchain @stable (a branch, not a tag) @4be7066a
azure/setup-helm @v4 @1a275c3b (v4.3.1)
aws-actions/configure-aws-credentials @v4 @7474bc46 (v4.3.1)
Swatinem/rust-cache @v2 @e18b4977 (v2, 2026-03-12)
helm/chart-releaser-action @v1.6.0 @a917fd15 (v1.6.0)

Each occurrence (18 total across 11 workflow files) keeps the version as a trailing comment for readability and to keep future bumps a one-line diff.

Why

A tag — branch, lightweight, or annotated — can be moved by anyone with push access to the upstream action repo, silently swapping in different (potentially malicious) code the next time a workflow pulls it. A commit SHA is immutable regardless of what happens upstream. This is the mitigation GitHub's own Actions security hardening guide recommends for third-party actions specifically.

helm/chart-releaser-action@v1.6.0 is already a full semver tag rather than a rolling major version, but the tag itself is still a mutable ref, so it's included for consistency.

First-party actions (actions/* maintained by GitHub, docker/* maintained by Docker) are left on major-version tags — lower supply-chain risk than individually- or org-maintained third-party actions, and this repo already follows that convention.

Verification

  • Every SHA resolved via gh api repos/<owner>/<repo>/tags (returns commit SHA directly — avoids the annotated-tag object-SHA vs. commit-SHA confusion some other lookup paths hit) and cross-checked against the tag name it corresponds to
  • YAML parses cleanly on all 11 modified files
  • actionlint clean on the diff (one pre-existing unrelated finding on build-oabctl.yml — an empty-string choice option — predates this change and is out of scope)
  • No behavioral change: each SHA is the exact commit the previous tag pointed to at time of audit

Found during a follow-up audit after #1393. Pins the five third-party
(non-actions/*, non-docker/*) GitHub Actions used across this repo's
workflows to the commit SHA their mutable tag currently resolves to:

- dtolnay/rust-toolchain@stable -> @4be7066a (branch, not a tag)
- azure/setup-helm@v4 -> @1a275c3b (v4.3.1)
- aws-actions/configure-aws-credentials@v4 -> @7474bc46 (v4.3.1)
- Swatinem/rust-cache@v2 -> @e18b4977 (v2, 2026-03-12)
- helm/chart-releaser-action@v1.6.0 -> @a917fd15 (already a full semver
  tag, but tags are still mutable refs an attacker with push access to
  the upstream repo could retarget)

Rationale: a tag (branch or lightweight/annotated) can be moved by
anyone with push access to the upstream action repo, silently swapping
in malicious code the next time a workflow run pulls it. A commit SHA
is immutable. This is the mitigation GitHub's own security hardening
guide recommends for any third-party action, and is already how this
repo pins actions/checkout, docker/*, etc. via major version tags
maintained by GitHub/Docker directly (lower-risk, first-party) --
third-party individual/org-maintained actions get the stricter
treatment.

Each pin keeps the version as a trailing comment for human readability
and to make future version bumps a one-line diff.

No behavior change -- every SHA is the exact commit the previous tag
pointed to at time of audit, verified via the GitHub API tags list
endpoint (returns commit SHA directly, avoiding annotated-tag object
SHA confusion).
@chaodu-agent chaodu-agent requested a review from thepagent as a code owner July 13, 2026 23:16
@thepagent thepagent merged commit 65cad17 into main Jul 13, 2026
4 of 5 checks passed
chaodu-agent added a commit to openabdev/ghpool that referenced this pull request Jul 14, 2026
…pin actions (#37)

Follow-up to a workflow-security audit across oablab/chi, oablab/ecsctl,
and openabdev/ghpool (companion of openabdev/openab#1393/#1395/#1396,
which fixed the same pattern in openab's release-pr.yml).

release-pr.yml and release.yml expanded ${{ inputs.version }},
${{ inputs.tag }}, and ${{ steps.*.outputs.* }} directly inside run:
shell blocks across five jobs (resolve-version, create-release, build,
docker, docker-manifest). Actions expands ${{ }} before bash ever sees
the script, so a crafted version/tag string can break out of the shell
string context.

Threat model: release-pr.yml is workflow_dispatch-only (requires repo
write access + carries an App token with contents:write +
pull-requests:write via steps.app-token.outputs.token). release.yml
triggers on 'push: tags' too, which is also gated on write access to
push a tag. Same insider/leaked-credential threat model as openab's
release-pr.yml.

Fix: every inputs.*/steps.*.outputs.* reference in a run: block now
goes through env: and is referenced as "$VAR" in shell, matching the
canonical pattern already applied across openab's workflows. No
behavioral change.

Also SHA-pins dtolnay/rust-toolchain@stable and Swatinem/rust-cache@v2
across ci.yml, e2e.yml, and release.yml (same rationale as
openabdev/openab#1396: a mutable tag/branch ref can be moved by anyone
with push access to the upstream action repo; a commit SHA cannot).
Version kept as a trailing comment for readability.

Co-authored-by: chaodu-agent <chaodu-agent@users.noreply.github.com>
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.

2 participants