codegraph
codegraph copied to clipboard
ci(release): sign artifacts with Sigstore provenance + attestation
What & why
The release pipeline generates SHA256SUMS and the npm shim verifies against it, but nothing is signed: SHA256SUMS is unsigned and lives in the same release as the artifacts, and npm publish runs without --provenance. So neither install channel can prove a download actually came from this repo's build.
A checksum published next to the artifact it describes proves integrity, not authenticity — anyone who can replace the archive can replace the hash. This PR adds the missing authenticity layer using Sigstore, with no keys or secrets to manage (everything uses the release job's OIDC identity).
Changes
.github/workflows/release.yml- Add
id-token: write+attestations: writepermissions. - Attest every release archive and
SHA256SUMSviaactions/attest-build-provenance@v2. - Add
--provenancetonpm publish.
- Add
scripts/pack-npm.sh— add therepositoryfield to the generated package.json files.npm publish --provenancefails without it, so this is required for the workflow change to work.BUNDLING.md— documentgh attestation verifyand the npm provenance badge; reframe the "code signing" TODO as OS code signing (Gatekeeper/Authenticode), which is separate.
How to verify after a release
# GitHub Release archive
gh attestation verify codegraph-linux-x64.tar.gz --repo colbymchenry/codegraph
# npm package → "Provenance" badge on npmjs.com
Notes for the maintainer
- Verification is opt-in — the dependency-free
curl | shpath is unchanged. (Wiringgh attestation verifyintoinstall.shwould break its "no dependencies" design, so I deliberately left the installers alone.) - I couldn't run the release workflow myself (needs
workflow_dispatch+NPM_TOKEN), so please sanity-check on a test release. The two things to confirm: therepositoryURL matches this repo (provenance is strict about it), and the attestation step findsrelease/codegraph-*. - Out of scope / possible follow-up:
scripts/npm-shim.jsverifyChecksum()is fail-open (skips whenSHA256SUMSis absent/unlisted). Once releases reliably ship sums, making it fail-closed for versions that publish them would close the downgrade gap. Happy to do that as a separate PR if you want it.
🤖 Generated with Claude Code