Skip to content
PolyPack
Docs: Signatures and provenance

Signatures and provenance

Check that what you install is what was published, and where it was built.

PolyPack signs what it serves with its own key, so you can check two things about a package without trusting anything public: that PolyPack served it unchanged, and, for versions published with trusted publishing, where it was built.

npm: registry signatures

Every npm version PolyPack serves carries PolyPack's signature over its name, version and checksum. npm checks them for you:

In a project
npm audit signatures

It reports each installed package's registry signature as verified, using PolyPack's public key from https://hopper.pkg.polypack.io/npm/-/npm/v1/keys. npm first looks for the key in Sigstore's public list of registries, does not find PolyPack there, and prints a warning before using ours. That warning is expected.

Provenance

When a version is published through trusted publishing, PolyPack records where it came from, as GitHub proved it at that moment: the repository, the workflow, the commit and the run. It signs that record (a SLSA provenance statement) and keeps it with the version. The Pack's page shows it under Published from, marked signed.

Check it with the polypack CLI, signed in to your Team:

npm
polypack verify npm @hopper/ui@1.1.0
Docker and OCI
polypack verify oci api:1.1.0

polypack verify checks PolyPack's signature, then downloads what the registry serves now (the tarball, or the image's manifest) and checks that it is exactly what was published. It then prints the repository, commit, workflow and run. It fails, saying why, if anything differs, or if the version was not published through trusted publishing.

Checking it with cosign

The provenance is a standard format, a DSSE envelope of an in-toto statement with a SLSA v1 predicate, so cosign checks it too, with PolyPack's public key and the file you have:

npm, with cosign 2
curl -sS -H "Authorization: Bearer $POLYPACK_TOKEN" https://hopper.pkg.polypack.io/-/polypack/v1/provenance/@hopper/ui/1.1.0 > provenance.json
curl -sS https://hopper.pkg.polypack.io/-/polypack/v1/keys | jq -r '.keys[0].key' | base64 -d | openssl pkey -pubin -inform DER -out polypack.pub
cosign verify-blob-attestation --key polypack.pub --insecure-ignore-tlog --type slsaprovenance1 --signature provenance.json ui-1.1.0.tgz

cosign prints Verified OK, and refuses a file that is not exactly what was published.

For an image, PolyPack also attaches the provenance to it, as cosign attaches attestations, so cosign finds it with nothing to download but the key:

Images, with cosign 2
cosign verify-attestation --key polypack.pub --insecure-ignore-tlog --type slsaprovenance1 hopper.cr.polypack.io/api:1.1.0

--insecure-ignore-tlog is right here: PolyPack keeps your packages' names out of public transparency logs, so there is no log entry to check, and cosign warns that it skipped one.

What is and is not signed

  • Registry signatures: every npm version. Composer packages and images have none yet.
  • Provenance: npm versions and image tags published through trusted publishing, from the day PolyPack began signing. A tag pushed again without trusted publishing loses its provenance.
  • Provenance says what PolyPack verified when the version was published. It is never signed again.
  • Who can read a version's provenance: whoever can install that version.

Nothing is public

npm's own provenance writes each package's name and repository to Sigstore's public transparency log. That is right for open-source packages and wrong for private ones, so PolyPack signs with its own key instead and never tells npm to look for public attestations. Its public keys are listed, with any keys it has retired, at https://hopper.pkg.polypack.io/-/polypack/v1/keys.