Security: harden CI against supply chain attacks#3
Merged
Conversation
- Pin all GitHub Actions to immutable commit SHAs (prevents tag mutation attacks) - Set permissions: read-all at workflow level; grant contents: write only to the host job that creates releases (principle of least privilege) - Isolate CI cache from release cache using branch-prefixed keys to prevent cache poisoning across fork/PR trust boundaries Mitigates the same attack chain used in the TanStack npm compromise (2026-05-11): pull_request_target pwn request + cache poisoning + OIDC token extraction. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
On 2026-05-11, TanStack was compromised via a three-stage GitHub Actions supply chain attack:
pull_request_targetPwn Request → cache poisoning across fork↔base trust boundary → OIDC token extraction from runner memory → 84 malicious npm packages published.What this PR does
1. Pin all actions to commit SHAs
Every
uses:reference is now an immutable SHA with the version tag as a comment. A compromised action maintainer account can no longer silently redirect a mutable tag (@v6) to malicious code.2. Least-privilege permissions
permissions: read-allat the workflow level (wascontents: writeglobally in release.yml)contents: writegranted only to thehostjob that actually creates GitHub Releases3. Cache isolation between PRs and release builds (ci.yml)
Cache keys are prefixed with
master-on the main branch andpr-on pull requests, preventing a malicious PR from poisoning the cache that release builds restore from.What we were already safe from
pull_request_targetusage (the root cause of TanStack) — both workflows usepull_requestKeeping SHAs up to date
Enable Dependabot for Actions in
.github/dependabot.ymlto auto-PR SHA updates when new versions are released.🤖 Generated with Claude Code