Skip to content

Pin GitHub Actions to SHA and add enforcement#4584

Merged
mociarain merged 2 commits intomasterfrom
tuxerrante/pin-gh-actions
Feb 6, 2026
Merged

Pin GitHub Actions to SHA and add enforcement#4584
mociarain merged 2 commits intomasterfrom
tuxerrante/pin-gh-actions

Conversation

@tuxerrante
Copy link
Collaborator

@tuxerrante tuxerrante commented Feb 3, 2026

Which issue this PR addresses:

Continuation of #4125 (abandoned PR for pinning GitHub Actions dependencies).

What this PR does / why we need it:

Pins all GitHub Actions to their full commit SHA for improved security, following supply chain security best practices. This prevents unexpected changes from compromised or modified action tags.

Changes

  1. Pin all actions across 11 workflow files to specific commit SHAs with version comments
  2. Update all actions to their latest patch versions for consistency across workflows
  3. Add enforcement workflow (ensure-sha-pinned-actions.yml) that fails CI if unpinned actions are introduced
  4. Add Makefile target (validate-gh-actions) for local validation, integrated into validate-go-action

Action Versions (all updated to latest patch)

Action Version SHA
actions/checkout v6.0.2 de0fac2e4500...
actions/setup-go v6.2.0 7a3fe6cf4cb3...
actions/setup-node v6.2.0 6044e13b5dc4...
step-security/harden-runner v2.14.1 e3f713f2d8f5...
coverallsapp/github-action v2.3.6 648a8eb78e6d...
golangci/golangci-lint-action v9.2.0 1e7e51e771db...
softprops/action-gh-release v2.5.0 a06a81a03ee4...
oxsecurity/megalinter v9.3.0 42bb470545e3...
github/codeql-action v4 (latest) 5049b573e2cb...
zgosalvez/github-actions-ensure-sha-pinned-actions v4.0.1 6124774845927...

Automation for future consistency

  • CI enforcement: New workflow ensure-sha-pinned-actions.yml runs on PRs that modify .github/workflows/ and fails if any action is not pinned to SHA
  • Local validation: Run make validate-gh-actions to check locally
image

Test plan for issue:

  • make validate-gh-actions passes locally
  • CI workflows pass with pinned actions
  • New ensure-sha-pinned-actions workflow runs correctly

Is there any documentation that needs to be updated for this PR?

No - the Makefile help target already documents the new validate-gh-actions target.

How do you know this will function as expected in production?

  • All actions are pinned to the same versions that were previously used (just with explicit SHA instead of floating tags)
  • The enforcement workflow uses the same pattern as other CI checks in this repo
  • Dependabot will automatically create PRs when action updates are available

Pin all GitHub Actions to their full commit SHA for improved security,
following supply chain security best practices. This prevents unexpected
changes from compromised or modified action tags.

Changes:
- Pin all actions across 10 workflow files to specific commit SHAs
- Update all actions to their latest patch versions for consistency
- Add new workflow (ensure-sha-pinned-actions.yml) that fails CI if
  unpinned actions are introduced
- Add Makefile target (validate-gh-actions) for local validation
- Integrate validation into validate-go-action CI target

Action versions updated:
- actions/checkout: v6.0.2
- actions/setup-go: v6.2.0
- actions/setup-node: v6.2.0
- step-security/harden-runner: v2.14.1
- coverallsapp/github-action: v2.3.6
- golangci/golangci-lint-action: v9.2.0
- softprops/action-gh-release: v2.5.0
- oxsecurity/megalinter: v9.3.0
- github/codeql-action: v4 (latest)

Dependabot is already configured to keep pinned actions updated weekly.
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@6124774845927d14c601359ab8138699fa5b70c3 # v4.0.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that security is the goal of the pull request, has this GH Action been vetted? Does it need to be vetted?

Copy link
Collaborator Author

@tuxerrante tuxerrante Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click to expand outdated comment about a different tool

Sure, you're right to ask and indeed I've already done an inspection.
You're also right that we should share this kind of info in the PR itself when introducing new tooling.

So here's a formal report from my findings.


Security Report: mheap/pin-github-action

SHA: 6550a5c31b612a439ed7e63161811d35c36dd873 (v3.4.0)


Summary

Category Assessment Notes
Purpose ✅ Legitimate CLI/Action to pin GH Actions to SHAs
Author ✅ Verified Michael Heap - Sr. Director DevRel @Kong
Contributors ✅ 10 9 humans + Dependabot
Commit Liveness ✅ Active 100 commits, v3.4.0 released Jun 22, 2025
Stars ✅ 141 Decent adoption for utility tool
License ✅ MIT Auditable
Known CVEs ✅ None No advisories in Snyk or GitHub
OpenSSF Scorecard ⚠️ Not indexed No scorecard available
Security Policy ⚠️ Missing No SECURITY.md

Dependencies (package.json)

Package Version Risk
@octokit/rest ^21 ✅ Official GitHub SDK
commander ^13 ✅ Well-maintained CLI framework
yaml ^2.7.0 ✅ Standard YAML parser
fast-glob ^3.3.3 ✅ Common glob utility
debug ^4.4.0 ✅ Standard debug utility
matcher ^5.0.0 ✅ Simple pattern matcher
escape-string-regexp ^5.0.0 ✅ Simple utility

All dependencies are mainstream, well-maintained packages.


Security Scanning Results

Scanner Result
Snyk Security ✅ No direct vulnerabilities
GitHub Advisory Database ✅ No advisories
CVE Database ✅ No CVEs found

Your Mitigations (Already Applied)

Mitigation Status
Read-only workflow ✅ Done
Hardened runner ✅ Done
SHA pinned 6550a5c... matches v3.4.0

Gaps to Address

  1. No SECURITY.md - Vulnerabilities reported via public issues
  2. No OpenSSF Scorecard - Project not indexed by OpenSSF
  3. No Dependabot visible - Though the project does receive dependency updates

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like you reported on mheap/pin-github-action rather than zgosalvez/github-actions-ensure-sha-pinned-actions.

Copy link
Collaborator Author

@tuxerrante tuxerrante Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry I got confused with one of the alternatives I was considering.
At this point I'll review it directly as a comparison.

These tools are complementary, not alternatives:

Summary
  ┌─────────────────┬─────────────────────────────────────────┬────────────────────────────────────────────────────┐
  │     Aspect      │         mheap/pin-github-action         │ zgosalvez/github-actions-ensure-sha-pinned-actions │
  ├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
  │ Primary Purpose │ CLI tool to pin actions to SHAs         │ GitHub Action to validate actions are pinned       │
  ├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
  │ Use Case        │ Developer workflow / one-time migration │ CI enforcement / ongoing validation                │
  ├─────────────────┼─────────────────────────────────────────┼────────────────────────────────────────────────────┤
  │ Recommendation  │ ✅ Use for initial pinning              │ ✅ Use for CI enforcement                          │
  └─────────────────┴─────────────────────────────────────────┴────────────────────────────────────────────────────┘

1.2 Repository Health
  ┌────────────────┬─────────────────────────┬────────────────────────────────────────────────────┐
  │     Metric     │ mheap/pin-github-action │ zgosalvez/github-actions-ensure-sha-pinned-actions │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Stars          │ 141                     │ 48                                                 │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Forks          │ 17                      │ 16                                                 │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Contributors   │ 10                      │ 8                                                  │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Open Issues    │ 19                      │ 7                                                 │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ License        │ MIT                     │ MIT                                                │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Latest Release │ v3.4.0 (2025-06-22)     │ v4.0.1 (2025-12-13)                                │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Last Push      │ 2025-06-22              │ 2026-01-31                                         │
  ├────────────────┼─────────────────────────┼────────────────────────────────────────────────────┤
  │ Archived       │ No                      │ No                                                 │
  └────────────────┴─────────────────────────┴────────────────────────────────────────────────────┘
  Both projects are actively maintained. The zgosalvez action has more recent activity.

  2. Security Analysis

  2.1 zgosalvez/github-actions-ensure-sha-pinned-actions

  Strengths:
  ┌──────────────────────────┬─────────────────────────────────────────────────────────────────────┐
  │          Aspect          │                             Assessment                              │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Minimal permissions      │ No special permissions required; read-only operation                │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Native GitHub Action     │ Runs in isolated runner environment                                 │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Node24 runtime           │ Modern, supported Node.js version                                   │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Small dependency surface │ Only 3 runtime deps: @actions/core, @actions/glob, yaml             │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Bundled distribution     │ Uses @vercel/ncc to bundle dependencies (reduces supply chain risk) │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Allowlist support        │ Can exempt trusted publishers (e.g., actions/*)                     │
  ├──────────────────────────┼─────────────────────────────────────────────────────────────────────┤
  │ Dry-run mode             │ Non-blocking validation option                                      │
  └──────────────────────────┴─────────────────────────────────────────────────────────────────────┘
  Concerns:
  ┌─────────────────────────────────┬──────────┬────────────────────────────────────────────┐
  │             Concern             │ Severity │                 Mitigation                 │
  ├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
  │ Single maintainer (zgosalvez)   │ Low      │ MIT license allows forking; PR pins to SHA │
  ├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
  │ Reports only first error        │ Low      │ Multiple CI runs will surface all issues   │
  ├─────────────────────────────────┼──────────┼────────────────────────────────────────────┤
  │ Allowlist misconfiguration risk │ Low      │ Review allowlist in PR reviews             │
  └─────────────────────────────────┴──────────┴────────────────────────────────────────────┘
  Dependencies (v4.0.1):
  @actions/core@1.11.1    - Official GitHub toolkit (trusted)
  @actions/glob@0.5.0     - Official GitHub toolkit (trusted)
  yaml@2.8.2              - Well-maintained YAML parser

I think it is safe to proceed.

runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that security is the goal of the pull request, has this GH Action been vetted? Does it need to be vetted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Report: step-security/harden-runner

SHA: e3f713f2d8f53843e71c69a996d56f51aa9adfb9 (v2.14.1)


Summary

Category Assessment Notes
Purpose ✅ Legitimate EDR/security agent for GitHub Actions runners
Organization ✅ Verified stepsecurity.io - verified domain owner
Contributors ✅ 13 Professional security company
Commit Liveness ✅ Active 55 releases, v2.14.1 released Jan 26, 2025
Stars ✅ 952 Strong adoption
License ✅ Apache-2.0 OSI-approved
OpenSSF Scorecard ✅ 8.5/10 Excellent score
Security Policy ✅ Present SECURITY.md with private disclosure (info@stepsecurity.io)
Adoption ✅ Enterprise Microsoft, Google, CISA, Kubernetes, AWS, Node.js

OpenSSF Scorecard (v5.0.0) — Score: 8.5/10

Check Score Notes
Binary-Artifacts 10 No binaries in repo
Branch-Protection 8 PRs required, 1 approver (not max)
CI-Tests 10 All PRs tested
Code-Review 10 All changesets reviewed
Dangerous-Workflow 10 No dangerous patterns
Dependency-Update-Tool 10 Dependabot enabled
License 10 Apache 2.0
Maintained 10 15 commits, 6 issues in 90 days
SAST 10 CodeQL on all commits
Security-Policy 10 SECURITY.md present
Token-Permissions 10 Least privilege
Pinned-Dependencies 6 Some deps not pinned by hash
Contributors 6 2 contributing orgs
Vulnerabilities 7 3 transitive dep vulnerabilities
CII-Best-Practices 0 No OpenSSF badge
Fuzzing 0 No fuzzing

SHA Verification

Item Value
Scorecard commit e3f713f2d8f53843e71c69a996d56f51aa9adfb9
Your pinned SHA e3f713f2d8f53843e71c69a996d56f51aa9adfb9
Match

Organization Profile


Recommendation

Approved for use

This is a professional security tool from a verified security company with:

  • Excellent OpenSSF Scorecard (8.5/10)
  • Enterprise adoption (Microsoft, Google, CISA)
  • Active maintenance and security response
  • All known CVEs patched in v2.14.1
  • Proper security disclosure process

Note: I would actually push for increased adoption of this action to isolate the most critical actions on our project

   - Add pinact v1.6.0 to bingo dependencies for reproducible builds
   - Update validate-gh-actions to use pinact with --check and
   --verify flags
   - Add fix-gh-actions target for automatic SHA pinning
   - Integrate validate-gh-actions into validate-go target to ensure
   it runs
     as part of the standard validation workflow

   Using pinact eliminates the Node.js dependency and provides better
   validation by verifying SHA/version comment pairs are correct.
Copy link
Collaborator

@mociarain mociarain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to merge as is but if there's more ping me to re-review

@mociarain mociarain merged commit 8d0e822 into master Feb 6, 2026
30 checks passed
@mociarain mociarain deleted the tuxerrante/pin-gh-actions branch February 6, 2026 08:42
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.

4 participants