feat: verify Sigstore source attestations from PyPI and GitHub releases #2947
All Vouch review confidence checks passed
Residual risk 0.36 = Change Risk (0.64) × (1 − Review Confidence (0.44)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.64 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
No Reviewer Assigned
no_reviewer_assigned
0.120
Real PR Conversation Timeline
1 comments
"Review active on #2947"
general
weight: 0.35
wolfv
Verifies Sigstore attestations for URL sources: PyPI provenance (PEP 740), GitHub release attestations, and any Sigstore bundle given by
bundle_url. It replaces #2721 and fixes several problems in the existing verification.The feature stays behind
--experimental(removed in the follow-up #2964).attestationis nowattestations, and takes a listThe key is renamed to
attestations. It takes one mapping or a list of them, and every entry must verify. Each entry is checked on its own, so a source can require independent kinds of evidence, e.g. that the uv release asset has GitHub's release attestation and build provenance from the release workflow:attestationkey is removed; using it is an error that says to rename it. The feature is experimental, and in v0.80.1 everyattestation:source panics anyway. Rendered recipes from 0.80.2 that use the old key still verify onrebuild.The recipe JSON schema (prefix-dev/recipe-format) needs the same change in a follow-up.
Fixes v0.80.1
#2934 bumped sigstore to 0.16, which ships no crypto backend with the features we enable. Every source with an
attestation:block panics with "no sigstore-crypto CryptoProvider installed". This PR enablessigstore-verify/aws-lc-rs, which fixes it. The fix is three lines and can be cherry-picked into a patch release on its own.Verification
bundle_urlwith nopublishersonly checked that the file's hash appeared in the unsigned payload. Withoutpublishers, any signer is now accepted, with a warning.predicate_type=release) are found automatically for release-asset URLs and verified against GitHub's own Sigstore trust root. That root has no transparency log; the signing time comes from an RFC 3161 timestamp instead. Which root to trust follows from the requested URL, never from the response.bundle_url.Publisher matching
@<ref>is now enforced (github:pallets/flask@refs/tags/3.1.1); it was parsed but ignored. Note that this is the ref of the signing workflow run: projects that release throughworkflow_dispatchon a branch sign with the branch ref.github:pallets/flaskno longer matchespallets/flask-cors.github:pallets(16748505)/flask(596892). A renamed or re-registeredowner/repotherefore no longer matches. The IDs are read from the verified certificate's claims, or from the signed statement for release attestations. When a publisher verifies without pinned IDs, the build logs the pinned string to paste.github: owner/repo,ref,repository_id,owner_id,environment) that can also pin the deployment environment.finalized_sourcesininfo/recipe/rendered_recipe.yamlfills in the IDs the attestation was verified with, the same way git sources record their resolved commit. They come from the cache on warm builds too, and don't affect the build hash.Cache and builds
sigstorefeature now fail instead of silently skipping verification.GITHUB_TOKEN/GH_TOKENis sent only toapi.github.com. If GitHub rejects the token, the request is retried without it. 404s and rate limits produce actionable errors.Tests
CI had no tests that actually ran verification, which is how the crypto-provider panic got through. This PR adds offline tests against recorded real attestations: flask from PyPI, uv's release attestation and build provenance, and a cosign bundle. They cover tampering, the wrong trust root, wrong publisher, wrong ref, and wrong ID or environment. Network tests (
#[ignore]) cover live flask, urllib3, sigstore-python and uv. I also ran the CLI end to end for all source types, a warm cache, and valid and invalid tokens. For the list form I ran uv with both its release attestation and its build provenance: both passed and both recorded their IDs, a wrong ref in the second entry failed the build, a warm cache downloaded no bundles, and changing only the second entry re-verified only that entry.API changes in
rattler_build_source_cacheandrattler_build_recipeIdentityCheckgainsref_constraint,repository_id,owner_idandenvironment.CacheEntry.attestation_verified: boolbecomesverified_attestations: BTreeMap<String, Vec<AttestedIds>>(config fingerprint to the IDs each publisher was verified with), andset_attestation_verifiedtakes the fingerprint and IDs.UrlSource.attestation: Option<AttestationVerification>becomesattestations: Vec<AttestationVerification>.SourceResultgainsattested_ids: Vec<Vec<AttestedIds>>, one list per attestation.UrlSource.attestation: Option<AttestationConfig>becomesattestations: Vec<AttestationConfig>.AttestationConfig.publishersis nowVec<PublisherSpec>(a string or a mapping).Publishergains the pin fields, and itsDisplayprints the compact form, which parses back.Not covered yet
GitLab publishers use the same matching code but haven't been tested against a real GitLab attestation.
🤖 Generated with Claude Code