Skip to content

fix(ci): harden workflows against script injection#391

Merged
pasevin merged 3 commits into
mainfrom
fix/harden-ci-workflows-v2
May 20, 2026
Merged

fix(ci): harden workflows against script injection#391
pasevin merged 3 commits into
mainfrom
fix/harden-ci-workflows-v2

Conversation

@pasevin
Copy link
Copy Markdown
Collaborator

@pasevin pasevin commented May 20, 2026

Summary

Refresh of #337 against current main. The original PR diverged after #373 removed publish.yml, update-versions.yml, and the publish-rc job in docker-stg.yaml.

  • Extract repeated token-resolution boilerplate into a reusable .github/actions/auth-token composite action
  • Eliminate \${{ }} interpolation inside run: blocks — pass secrets/contexts through env: vars to prevent script injection
  • Add concurrency groups to PR workflows
  • Set cancel-in-progress: false on production deployment to avoid canceling in-flight releases
  • Unify harden-runner to v2.13.0
  • Bump pnpm/action-setup to v4.2.0, actions/setup-node to v4.4.0, docker/setup-buildx-action to v3.12.0
  • Drop continue-on-error: true from the CI test step
  • Use app token (instead of GITHUB_TOKEN) in update-dependencies PR creation

Files changed

  • .github/actions/auth-token/action.yml (new) — fork-aware token resolution
  • .github/actions/prepare/action.yml — bump pnpm/setup-node SHAs
  • .github/workflows/ci.yml, check-versions.yml, coverage.yml, dependencies.yml, export-testing.yml, lint.yml, update-dependencies.yml — adopt auth-token composite, move secrets to env vars
  • .github/workflows/docker-prod.yaml, docker-stg.yaml — bump pinned versions, quote shell vars, fix concurrency on prod
  • .github/workflows/scorecard.yml — bump pinned versions

Validated locally with `actionlint 1.7.12` — no warnings.

Test plan

  • Verify CI workflows pass on this PR (lint, build, coverage, export-testing, check-versions)
  • Confirm `auth-token` composite resolves tokens correctly for base-repo PRs
  • After merge: confirm scheduled `update-dependencies` and `dependencies` workflows still run

Closes #337.

🤖 Generated with Claude Code

Extract repeated token-resolution boilerplate into a reusable
auth-token composite action and eliminate ${{ }} interpolation
inside run: blocks across workflows.

- Add .github/actions/auth-token composite for fork-aware token resolution
- Pass NPM_TOKEN and matrix values through env vars in run: blocks
- Add concurrency groups to PR workflows
- Set cancel-in-progress: false on production deployment
- Unify harden-runner to v2.13.0
- Bump pnpm/action-setup to v4.2.0 and setup-node to v4.4.0
- Bump docker/setup-buildx-action to v3.12.0
- Drop continue-on-error on CI test step
- Use app token (instead of GITHUB_TOKEN) in update-dependencies

Supersedes #337, which had diverged from main after #373 removed
publish.yml, update-versions.yml, and the publish-rc job in docker-stg.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pasevin pasevin requested a review from a team as a code owner May 20, 2026 14:38
pasevin and others added 2 commits May 20, 2026 17:49
The prepare composite was doing a second checkout on top of the one
each workflow already runs. Removes it (and the now-unused token input)
and drops the auth-token resolution from workflows that only needed it
to feed prepare. update-dependencies keeps auth-token since it still
feeds peter-evans/create-pull-request.

Addresses review feedback on #337.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Matrix values aren't user-controllable, so the CHAIN env-var refactor
is out of scope for the hardening PR. Restore the run line and step
name to match main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pasevin pasevin merged commit 22a4e16 into main May 20, 2026
13 checks passed
@pasevin pasevin deleted the fix/harden-ci-workflows-v2 branch May 20, 2026 15:21
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