Skip to content

Security: harden CI against supply chain attacks#3

Merged
byshing merged 1 commit into
masterfrom
fix/action-security
May 15, 2026
Merged

Security: harden CI against supply chain attacks#3
byshing merged 1 commit into
masterfrom
fix/action-security

Conversation

@byshing
Copy link
Copy Markdown
Collaborator

@byshing byshing commented May 15, 2026

Context

On 2026-05-11, TanStack was compromised via a three-stage GitHub Actions supply chain attack: pull_request_target Pwn 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-all at the workflow level (was contents: write globally in release.yml)
  • contents: write granted only to the host job that actually creates GitHub Releases

3. Cache isolation between PRs and release builds (ci.yml)

Cache keys are prefixed with master- on the main branch and pr- on pull requests, preventing a malicious PR from poisoning the cache that release builds restore from.

What we were already safe from

  • No pull_request_target usage (the root cause of TanStack) — both workflows use pull_request
  • No OIDC publishing to external registries (npm/PyPI) — releases go to GitHub only

Keeping SHAs up to date

Enable Dependabot for Actions in .github/dependabot.yml to auto-PR SHA updates when new versions are released.

🤖 Generated with Claude Code

- 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>
@byshing byshing merged commit 729af15 into master May 15, 2026
6 checks passed
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