Skip to content

fix: pin 20 actions to commit SHA, extract 1 expressions to env vars - #10617

Closed
dagecko wants to merge 1 commit into
syncthing:mainfrom
dagecko:runner-guard/fix-ci-security
Closed

dagecko wants to merge 1 commit into
syncthing:mainfrom
dagecko:runner-guard/fix-ci-security

Conversation

@dagecko

@dagecko dagecko commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Re-submission of #10616. 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 20 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
build-infra-dockers.yaml Pinned actions to SHA
build-syncthing.yaml Pinned actions to SHA
mirrors.yaml Pinned actions to SHA
pr-metadata.yaml Pinned actions to SHA
release-syncthing.yaml 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 put up some research on this on Twitter and a research site if you want more context. 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 github-actions Bot added the bug A problem with current functionality, as opposed to missing functionality (enhancement) label Mar 28, 2026
@calmh

calmh commented Apr 5, 2026

Copy link
Copy Markdown
Member

Thank you for your consideration, but I do not want to use this type of pinning. If you want ot break out the refname change only, and apply the signed-off-by as required, that can be merged.

@calmh calmh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(the above)

@dagecko

dagecko commented Apr 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing this to split into two separate PRs as requested. The refname extraction will be in one PR with sign-off. I highly suggest the pins as well and will put a deeper explanation as to why in the second PR with specifics to your workflows.

Chris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A problem with current functionality, as opposed to missing functionality (enhancement)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants