Skip to the content.

Inbound build-provenance verification (Task 72)

The internal/buildprov admission gate consumes the build-provenance attestations upstream registries publish and uses them to cryptographically bind a pulled package version to the exact source repository, commit, and CI workflow that built it — then cross-checks that proven commit against the package-to-commit association the provenance subsystem (Task 8) reported, and flags disagreements.

It is distinct from two neighbouring subsystems:

Subsystem Direction Question it answers
internal/sigverify (Task 23) inbound Is the artifact signed by a trusted identity?
internal/attestbundle (Task 46) outbound The proxy SIGNS an attestation for each artifact it serves.
internal/buildprov (Task 72) inbound Does the upstream build provenance prove the artifact was built from the source its metadata claims?

What it verifies

Two inbound provenance sources are understood, both Sigstore bundles carrying a SLSA provenance in-toto statement in a DSSE envelope signed by a Fulcio certificate:

The cryptographic core (DSSE/PAE, Fulcio certificate-chain trust, identity policy, SLSA source extraction) is reused from internal/sigverify via sigverify.Verifier; this gate owns the inbound bundle parsing, the cross-check, the policy, and the surfaces.

Forge provider abstraction

Every forge is a buildprov.Source (attestation discovery) plus an optional ForgeTrust entry (its Fulcio/CA roots and allowed OIDC issuers). A discovered attestation is verified against the trust material of the forge that produced it (Material.Forge), so a GitLab attestation is trusted under GitLab’s root and https://gitlab.com issuer independently of GitHub’s — one forge’s trust never launders another forge’s attestation. Adding a new forge means adding a Source and a forges: config entry; the verification, cross-check, findings, and admission logic are untouched.

Signals

Each verification produces four headline signals, surfaced into policyengine.Input.buildProv, the SARIF findings layer, and per-ecosystem metrics:

A present-but-unverifiable attestation is flagged buildprov/unverified-provenance (high).

Modes

observe (default) records findings and feeds the policy/risk engines and the findings layer but never blocks a pull. enforce additionally quarantines an artifact whose worst finding meets failSeverity (default high; a mismatch is critical), composing with the break-glass approval workflow. The mode and the provenance requirement can be overridden per tenant.

Configuration

buildProv:
  enabled: true            # on by default
  mode: observe            # observe | enforce
  action: quarantine       # warn | block | quarantine (enforce only)
  failSeverity: high
  warnSeverity: medium
  requireProvenance: false # treat a missing attestation as a finding
  requireTrustedSource: false
  failOnError: false       # fail-open on fetch/parse errors
  npmRegistryUrl: https://registry.npmjs.org
  enableGithubSource: false
  githubApiUrl: https://api.github.com
  githubToken: ""
  # GitLab CI/CD and Bitbucket Pipelines provenance sources (opt-in):
  enableGitlabSource: false
  gitlabApiUrl: https://gitlab.com
  gitlabHost: gitlab.com         # set apiUrl+host for a self-hosted instance
  gitlabToken: ""
  enableBitbucketSource: false
  bitbucketApiUrl: https://api.bitbucket.org
  bitbucketHost: bitbucket.org
  bitbucketToken: ""
  timeout: 15s
  cacheTtl: 0
  cacheSize: 1024
  # Air-gapped trust material (shared format with sigverify):
  trustBundlePath: ""
  trustBundleDigest: ""
  offline: false
  # Allowed keyless-signer policy (establishes sourceVerified):
  identities:
    - issuer: https://token.actions.githubusercontent.com
      subjectPattern: '^https://github\.com/acme/.*'
  # Per-forge trust roots / OIDC issuers (GitLab/Bitbucket/self-hosted). An
  # attestation from a forge is verified against its forge's trust material; a
  # forge without an entry falls back to the shared roots/identities above.
  forges:
    - name: gitlab
      trustRootsFile: /etc/pullthrough/gitlab-fulcio-root.pem
      identities:
        - issuer: https://gitlab.com
          subjectPattern: '^https://gitlab\.com/acme-group/.*'
    - name: bitbucket
      trustRootsFile: /etc/pullthrough/bitbucket-fulcio-root.pem
      identities:
        - issuer: https://api.bitbucket.org/2.0/workspaces/acme/pipelines-config/identity/oidc
          subjectPattern: '^https://bitbucket\.org/acme/.*'
  tenants:
    team-a:
      mode: enforce

Each forges[] entry accepts the same trust material as the signature gate: trustRootsFile / useSystemTrustRoots, a portable trustBundlePath (+ trustBundleDigest) for air-gapped deployments, rekorKeyFiles, and identities.

Without trust roots/identities the gate still verifies the DSSE signature against the embedded Fulcio certificate (establishing present/verified and the proven source for the mismatch cross-check) but cannot establish sourceVerified.

Pull-path placement

The gate runs right after the signature gate (Task 23) and before the reproducible-build gate (Task 68), both of which establish source authenticity/integrity. It folds its signals into the per-request admission accumulator the policy-as-code (Task 32), risk-scoring (Task 37), and SARIF findings (Task 42) layers consume.

Admin & observability

Testing