Repository navigation
fix(ci): do not persist write-scoped checkout tokens in publish and merge-gate - #282
Merged
adityankale190895 merged 2 commits intoNov 18, 2026
Conversation
…erge-gate Fixes DiffCI#281 Signed-off-by: FredApps <[email protected]>
…ffCI#280 The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict. Signed-off-by: FredApps <[email protected]>
FredApps
marked this pull request as ready for review
November 18, 2026 01:07
adityankale190895
added a commit
that referenced
this pull request
Nov 19, 2026
…a job that runs no scripts While a job has id-token: write, every step can request the OIDC token npm trusted publishing accepts. The publish job also ran npm ci with install scripts, an unpinned npm@11 install, the build and npm publish's prepack, so a compromised dependency could publish @diffci.com/diffci with valid provenance. #282 kept the contents: write token off disk but cannot cover this one. Split it, as proposed in #301: - build (contents: read): tag check, npm ci, packaging checks, typecheck, build, package:check/smoke, then npm pack with gitHead set to the release commit, uploading the tarball and recording its sha512. - publish (id-token: write only): no checkout, no npm cache, npm pinned to 11.21.2 and installed with --ignore-scripts. Checks the tarball's sha512, name, version against the tag and gitHead against the commit, then publishes it with --provenance --ignore-scripts and waits for npm. - release (contents: write, no id-token): observer smoke, GitHub Release, provenance assets, action-v tag, verify-release, unchanged. npm only fills gitHead itself when publishing from a git checkout; a gitHead already in the tarball's package.json is kept (checked against npm 11's pacote and libnpmpublish), so the re-run check still works. New tests fail on the old workflow: jobs that can mint an OIDC token run no install or publish without --ignore-scripts, and the release publishes the built tarball from a job without a write token. Fixes #301. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]>
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.
Fixes #281
release-cli.ymlpublishandci.ymlmerge-gatecheck out withpersist-credentials: false, so their write-scopedGITHUB_TOKENis no longer stored in.git/configwhilenpm ciruns install scripts. Neither job uses git with that token.publishworks throughghand the API withGH_TOKEN, andmerge-gateposts its check run with the Action'sgithub-tokeninput.tests/workflow-credentials.test.ts(added torelease-files.json) reads every workflow and fails when a job whose token has a write scope (other thanid-token) checks out with persisted credentials and does notgit push. Before this change it reportedci.yml merge-gateandrelease-cli.yml publish.credit-contributors.ymlis exempt because it pushes.This PR's own
Merge gate smokerun covers themerge-gatechange, including the shallow checkout's unshallow fetch without stored credentials.Validation:
npx tsx --test tests/workflow-credentials.test.ts tests/cli-workflow-templates.test.ts,npm run typecheck,npm run audit:boundary.