Skip to content

ci: pin all GitHub Actions to immutable SHAs - #40

Merged
entlein merged 1 commit into
mainfrom
chore/pin-action-shas
May 5, 2026
Merged

entlein merged 1 commit into
mainfrom
chore/pin-action-shas

Conversation

@entlein

@entlein entlein commented May 4, 2026

Copy link
Copy Markdown

Why

Scorecard / GitHub code-scanning has 64 open Pinned-Dependencies alerts (security_severity: medium). The workflow uses: references account for ~53 of them — every line like uses: actions/checkout@v4 is flagged because tags are mutable and an action author can move them to point at different code at any time.

What

Replaced every uses: org/repo@<tag> with uses: org/repo@<sha> # <tag> across all workflow files. The trailing comment preserves the original semantic for human readers; the SHA pins the action to immutable bytes.

Generated with mheap/pin-github-action v3.4.0.

Files updated (9):

  • benchmark.yaml
  • build.yaml
  • bypass.yaml
  • component-tests.yaml
  • go-basic-tests.yaml
  • incluster-comp-pr-merged.yaml
  • pr-merged.yaml
  • scorecard.yml
  • sign-object.yaml

The other workflow files (incluster-comp-pr-created.yaml, pr-created.yaml) had no unpinned references to update.

Coverage

Closes ~53 of 64 Pinned-Dependencies alerts (the workflow uses: subset).

The remaining 11 are Dockerfile alerts:

  • build/Dockerfile (lines 1, 17)
  • build/Dockerfile.debug (lines 1, 7, 13)
  • clamav/Dockerfile (lines 3, 10)
  • cmd/sign-object/Dockerfile (lines 1, 17)
  • tests/images/malicious-app/Dockerfile (lines 1, 6)

Those need FROM image:tag@sha256:<digest> style pinning, which requires fetching each base image's current digest. Out of scope for this PR — will follow up.

Maintenance — IMPORTANT

Pinning to SHAs trades one staleness problem (mutable tags) for another (no auto-updates). Pair this PR with Renovate or Dependabot:

# .github/dependabot.yml
version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "weekly"

Without that, every action is frozen until someone hand-updates a SHA.

Risk

Low. SHA-pinning is a no-op for workflow behavior — every action runs at the same code it ran at before this PR (the SHAs the tags pointed at when this commit was created). The only change is the alert noise dropping.

YAML validated: all 11 workflow files parse cleanly with yaml.safe_load.

Test plan

  • CI green on this PR
  • gh api repos/k8sstormcenter/node-agent/code-scanning/alerts?state=open --jq 'map(select(.rule.name == "Pinned-Dependencies")) | length' drops by ~53 after merge
  • Confirm Renovate/Dependabot follow-up plan

…encies)

Scorecard flagged ~45 Pinned-Dependencies alerts on workflow 'uses:' lines.
Tags like @v4 are mutable — the action author can move the tag at any
time to point at different code, including malicious code. Replacing the
tag with a full commit SHA pins the action to bytes that cannot change
without producing a new SHA, which is the supply-chain hardening
Scorecard wants.

Generated with mheap/pin-github-action (v3.4.0). The tool resolves each
'uses: org/repo@<ref>' to the SHA the ref currently points at, leaves a
trailing '# <ref>' comment so the original semantic is preserved for
human readers, and only touches lines it can fully resolve.

Files updated:
  .github/workflows/benchmark.yaml
  .github/workflows/build.yaml
  .github/workflows/bypass.yaml
  .github/workflows/component-tests.yaml
  .github/workflows/go-basic-tests.yaml
  .github/workflows/incluster-comp-pr-merged.yaml
  .github/workflows/pr-merged.yaml
  .github/workflows/scorecard.yml
  .github/workflows/sign-object.yaml

Closes ~53 of 64 Pinned-Dependencies alerts (the workflow 'uses:' subset).
The remaining 11 are 'containerImage not pinned by hash' / 'goCommand not
pinned by hash' alerts on Dockerfiles (build/Dockerfile, build/Dockerfile.debug,
clamav/Dockerfile, cmd/sign-object/Dockerfile, tests/images/malicious-app/Dockerfile)
and need a separate follow-up that fetches each base image's SHA digest.

Maintenance: pair this with Renovate or Dependabot ('package-ecosystem:
github-actions') so SHAs auto-PR upgrade — otherwise pinning trades one
staleness problem for another.
@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 01e87b38-808e-4a0c-bfc2-8b207c99788e

📥 Commits

Reviewing files that changed from the base of the PR and between f0d0f72 and 68aa3d3.

📒 Files selected for processing (9)
  • .github/workflows/benchmark.yaml
  • .github/workflows/build.yaml
  • .github/workflows/bypass.yaml
  • .github/workflows/component-tests.yaml
  • .github/workflows/go-basic-tests.yaml
  • .github/workflows/incluster-comp-pr-merged.yaml
  • .github/workflows/pr-merged.yaml
  • .github/workflows/scorecard.yml
  • .github/workflows/sign-object.yaml

📝 Walkthrough

Walkthrough

The PR pins GitHub Actions across nine workflow files to specific commit SHAs instead of floating version tags (e.g., @v4, @v5, @v2). No workflow logic, build commands, or functional behavior changed—only action references are updated.

Changes

GitHub Actions Version Pinning

Layer / File(s) Summary
Action Reference Updates
.github/workflows/benchmark.yaml, .github/workflows/build.yaml, .github/workflows/bypass.yaml, .github/workflows/component-tests.yaml, .github/workflows/go-basic-tests.yaml, .github/workflows/incluster-comp-pr-merged.yaml, .github/workflows/pr-merged.yaml, .github/workflows/scorecard.yml, .github/workflows/sign-object.yaml
All workflows pin third-party actions (actions/checkout, actions/setup-go, actions/setup-python, Docker login/build/QEMU/buildx actions, github/codeql-action/*, peter-evans/create-or-update-comment, mlilback/build-number, ossf/scorecard-action, and others) from floating major-version tags to fixed commit SHAs. Step inputs, conditional logic, and build/test commands remain unchanged.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title precisely captures the main change: pinning GitHub Actions to immutable SHAs across all workflow files.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the rationale, implementation, scope, and maintenance considerations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/pin-action-shas

Review rate limit: 8/10 reviews remaining, refill in 9 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@entlein
entlein merged commit f4f7914 into main May 5, 2026
1 check passed
@entlein
entlein deleted the chore/pin-action-shas branch May 5, 2026 11:56
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