Skip to content

Harden GitHub Actions against supply-chain attacks#177

Merged
alii merged 3 commits into
mainfrom
ali/harden-ci
May 24, 2026
Merged

Harden GitHub Actions against supply-chain attacks#177
alii merged 3 commits into
mainfrom
ali/harden-ci

Conversation

@alii

@alii alii commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Hardens our CI against the supply-chain attack patterns going around (Shai-Hulud worm, the tj-actions/changed-files token theft, and the pull_request_target + malicious .claude/settings.json hook that hit aidenybai/million and TanStack).

Audit results

  • ✅ No pull_request_target anywhere (the vector that hit Million/TanStack)
  • ✅ No malicious .claude / editor hook; .vscode/settings.json only sets the Prettier formatter
  • ✅ No committed .npmrc / npm token — we publish via OIDC provenance (id-token: write + NPM_CONFIG_PROVENANCE), so the "npm invalidated all tokens" event doesn't affect us

Changes

  1. Pin every action to a full commit SHA (with a version comment so Dependabot still bumps them). Tags like @v6 are mutable and can be repointed at malicious code — changesets/action@v1 was actually a branch ref, running in our publish job with id-token: write.
  2. Harden bun install--frozen-lockfile everywhere (install exactly the reviewed lockfile), plus --ignore-scripts in the privileged release job so dependency lifecycle scripts (the Shai-Hulud propagation vector) can't run next to publish credentials.
  3. Gate the /snapshot trigger in snapshot.yml on author_association (OWNER/MEMBER/COLLABORATOR) + startsWith, so it's no longer triggerable by arbitrary commenters.
  4. Trim permissions — drop unused issues: write from publish.yml; replace the dead top-level pull-requests: write in linters.yml with contents: read.
  5. Remove the third-party LouisBrunner/checks-action in favor of a native $GITHUB_STEP_SUMMARY write — no third-party dep, no token, and drops checks: write from the lint job.

🤖 Generated with Claude Code

alii added 2 commits May 24, 2026 14:35
- Pin all actions to full commit SHAs (mutable tags like @v6/@v1 can be
  repointed at malicious code, as in the tj-actions/changed-files CVE).
  changesets/action@v1 was a branch ref, not even a tag.
- bun install: add --frozen-lockfile everywhere; --ignore-scripts in the
  privileged release job so dependency lifecycle scripts (the Shai-Hulud
  propagation vector) can't run alongside id-token:write.
- snapshot.yml: gate the /snapshot comment trigger on author_association
  (OWNER/MEMBER/COLLABORATOR) + startsWith, so it isn't triggerable by
  arbitrary users.
- Trim permissions: drop unused issues:write from publish.yml; replace
  dead top-level pull-requests:write in linters.yml with contents:read.
Replaces the third-party checks-action (only used to post a friendly
"files aren't formatted" message) with a native $GITHUB_STEP_SUMMARY
write. No third-party dependency, no GITHUB_TOKEN, and lets us drop the
checks:write permission from the lint job. The job still fails via the
existing git diff --exit-code step.
@alii alii requested a review from valtyr as a code owner May 24, 2026 13:36
@alii alii force-pushed the ali/harden-ci branch from d1d42fe to 48438c7 Compare May 24, 2026 13:38
@alii alii merged commit d5aa8e2 into main May 24, 2026
4 checks passed
@alii alii deleted the ali/harden-ci branch May 25, 2026 08:15
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