← Back to Pull requests

feat: verify Sigstore source attestations from PyPI and GitHub releases #2947

Merged
wolfv merged 8 files (650 lines) on Nov 20, 2026 16:17 UTC
View on GitHub
wolfv wolfv commented on Nov 15, 2026 08:11 UTC
Author

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.

source:
  url: https://pypi.io/packages/source/f/flask/flask-${{ version }}.tar.gz
  sha256: 284c7b8f2f58cb737f0cf1c30fd7eaf0ccfcde196099d24ecede3fc2005aa59e
  attestations:
    publishers:
      # owner(owner_id)/repo(repository_id)@ref
      - github:pallets(16748505)/flask(596892)@refs/tags/${{ version }}

The feature stays behind --experimental (removed in the follow-up #2964).

attestation is now attestations, and takes a list

The 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:

  attestations:
    - publishers:
        - github:astral-sh(115962839)/uv(699532645)@refs/tags/${{ version }}
    - bundle_url: https://api.github.com/repos/astral-sh/uv/attestations/sha256:${{ sha256 }}?predicate_type=provenance
      publishers:
        - github:astral-sh(115962839)/uv(699532645)@refs/heads/main

  • The old attestation key is removed; using it is an error that says to rename it. The feature is experimental, and in v0.80.1 every attestation: source panics anyway. Rendered recipes from 0.80.2 that use the old key still verify on rebuild.

  • An empty list is an error, so it can't silently turn verification off.

  • The cache records each entry separately: editing one entry re-verifies only that one.
  • 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 enables sigstore-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

  • Signatures are always verified. Before, a bundle_url with no publishers only checked that the file's hash appeared in the unsigned payload. Without publishers, any signer is now accepted, with a warning.

  • PyPI gets full transparency-log verification. It used to be skipped on the assumption that PyPI's provenance lacked the data; it doesn't.

  • GitHub release attestations (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.

  • SLSA build provenance from the GitHub attestations API, and cosign-style signature bundles, work through bundle_url.
  • Publisher matching

  • Every listed publisher must match a verified bundle. The docs used to say "at least one".

  • @<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 through workflow_dispatch on a branch sign with the branch ref.

  • Repository names can't be confused, so github:pallets/flask no longer matches pallets/flask-cors.

  • Pin GitHub's permanent owner and repository IDs in parentheses: github:pallets(16748505)/flask(596892). A renamed or re-registered owner/repo therefore 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.

  • New mapping form (github: owner/repo, ref, repository_id, owner_id, environment) that can also pin the deployment environment.

  • The rendered recipe records the IDs. finalized_sources in info/recipe/rendered_recipe.yaml fills 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

  • Re-verification on config change. The source cache records which attestation config a file was verified against. Before, a cached file skipped verification even after the recipe's publishers changed.

  • Fail closed. Builds without the sigstore feature now fail instead of silently skipping verification.

  • GitHub token handling. GITHUB_TOKEN/GH_TOKEN is sent only to api.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_cache and rattler_build_recipe

  • IdentityCheck gains ref_constraint, repository_id, owner_id and environment.

  • CacheEntry.attestation_verified: bool becomes verified_attestations: BTreeMap<String, Vec<AttestedIds>> (config fingerprint to the IDs each publisher was verified with), and set_attestation_verified takes the fingerprint and IDs.

  • UrlSource.attestation: Option<AttestationVerification> becomes attestations: Vec<AttestationVerification>.

  • SourceResult gains attested_ids: Vec<Vec<AttestedIds>>, one list per attestation.

  • stage0 and stage1 UrlSource.attestation: Option<AttestationConfig> becomes attestations: Vec<AttestationConfig>.

  • stage0 AttestationConfig.publishers is now Vec<PublisherSpec> (a string or a mapping).

  • stage1 Publisher gains the pin fields, and its Display prints 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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: None requested Review duration: 7685m
    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
    0.64
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    None requested
    Assignees
    wolfv wolfv
    Labels
    risk: medium confidence: 44.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 64% (MEDIUM) · Higher = larger blast radius
    64%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.2% · Lower = rushed or shallow review
    44.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 35.7% · Moderate risk
    35.7%