Skip to content

fix: pin 1 actions to commit SHA, extract 1 expressions to env vars#3457

Open
dagecko wants to merge 1 commit intoiluwatar:masterfrom
dagecko:runner-guard/fix-ci-security
Open

fix: pin 1 actions to commit SHA, extract 1 expressions to env vars#3457
dagecko wants to merge 1 commit intoiluwatar:masterfrom
dagecko:runner-guard/fix-ci-security

Conversation

@dagecko
Copy link
Copy Markdown

@dagecko dagecko commented Mar 28, 2026

Re-submission of #3455. Had a problem with my fork and had to delete it, which closed the original PR. Apologies for the noise.

Summary

This PR pins all GitHub Actions to immutable commit SHAs instead of mutable version tags and extracts expressions from run: blocks into env: mappings.

  • Pin 1 unpinned actions to full 40-character SHAs
  • Add version comments for readability
  • Extract 1 expressions from run blocks to env vars

Changes by file

File Changes
presubmit.yml Pinned actions to SHA

A note on internal action pinning

This PR pins all actions including org-owned ones. Best practice is to pin everything — the tj-actions/changed-files attack was an internally maintained action that was compromised, and every repo referencing it by tag silently executed attacker code. That said, it's your codebase. If you'd prefer to leave org-owned actions unpinned, let us know and we'll adjust the PR.

How to verify

Review the diff — each change is mechanical and preserves workflow behavior:

  • SHA pinning: action@v3 becomes action@abc123 # v3 — original version preserved as comment
  • Expression extraction: ${{ expr }} in run: moves to env: block, referenced as $ENV_VAR in the script
  • No workflow logic, triggers, or permissions are modified

I wrote a scanner called Runner Guard and open sourced it here.

If you have any questions, reach out. I'll be monitoring comms.

- Chris Nyhuis (dagecko)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

PR Summary

Pins GitHub Actions to immutable commit SHAs instead of version tags, and extracts an expression from a run block into an environment variable. Specifically, upgrades the presubmit workflow to replace 'latest' with a pinned commit for the action presubmit/ai-reviewer, moves the LLM_API_KEY reference into an env: mapping, and preserves overall behavior.

Changes

File Summary
.github/workflows/presubmit.yml Pinned the presubmit/ai-reviewer action from 'latest' to a specific 40-character SHA 5f1290b6142b14b44cd2e8e3ffda84cd0a22e94f, and refactored the run block to read LLM_API_KEY from the environment instead of using a secrets expression. Added an environment mapping for LLM_API_KEY and pinned the action to a specific commit 5f1290b6142b14b44cd2e8e3ffda84cd0a22e94f with a trailing '# latest' comment. No workflow triggers or perms were changed.

autogenerated by presubmit.ai

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

LGTM!

Review Summary

Commits Considered (1)
  • 1c77ddb: fix: pin 1 actions to commit SHA, extract 1 expressions to env vars
Files Processed (1)
  • .github/workflows/presubmit.yml (1 hunk)
Actionable Comments (0)
Skipped Comments (2)
  • .github/workflows/presubmit.yml [24-25]

    readability: "YAML indentation and env scoping for secret check"

  • .github/workflows/presubmit.yml [26-29]

    best_practice: "Pinning and env propagation for action step"

@sonarqubecloud
Copy link
Copy Markdown

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