Skip to content

feat: expose fetched attestation bundles on manifest#457

Open
mitchdenny wants to merge 2 commits intonpm:mainfrom
mitchdenny:feat/expose-attestation-bundles
Open

feat: expose fetched attestation bundles on manifest#457
mitchdenny wants to merge 2 commits intonpm:mainfrom
mitchdenny:feat/expose-attestation-bundles

Conversation

@mitchdenny
Copy link

When verifyAttestations is enabled, pacote fetches the full sigstore attestation bundles from the registry attestation URL and uses them to verify package provenance and publish attestations. After verification, the fetched bundles are discarded and only the lightweight dist.attestations metadata (URL and predicate type) is saved to mani._attestations:

// lib/registry.js line 344
mani._attestations = dist.attestations

This means downstream consumers like the npm CLI have no access to the verified attestation bundles (DSSE envelopes, verification material, transparency log entries) without re-fetching them from the registry.

Use case: I'd like to add an --include-attestations flag to npm audit signatures so users can inspect the full attestation bundles for their installed packages. Currently npm audit signatures only reports pass/fail counts — there's no way to view the actual attestation content via the CLI.

Proposed change: Enrich mani._attestations to include the already-fetched bundles:

mani._attestations = { ...dist.attestations, bundles: attestations }

This preserves backward compatibility (url and provenance are still present) and avoids an extra HTTP request for each attested package. The data has already been fetched and verified — this just preserves it for downstream use.

When verifyAttestations is enabled, pacote already fetches the full
sigstore attestation bundles from the registry and uses them for
verification. However, the fetched bundles are discarded after
verification, and only the lightweight dist.attestations metadata
(URL + predicate type) is saved to mani._attestations.

This change expands _attestations to include the fetched bundles as
a 'bundles' property, making the complete sigstore bundles (DSSE
envelopes, verification material, tlog entries) available to
downstream consumers like the npm CLI without requiring a re-fetch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add assertions to verify that the fetched attestation bundles are
preserved on mani._attestations.bundles when verification is enabled,
and absent when verification is disabled.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mitchdenny pushed a commit to mitchdenny/npm-cli that referenced this pull request Mar 3, 2026
Add a new --include-attestations flag for `npm audit signatures` that
includes the full sigstore attestation bundles in JSON output. This
enables downstream tooling to consume and further process attestation
data (e.g. for policy engines, SBOMs, or custom verification).

When used with `npm audit signatures --json --include-attestations`,
the JSON output includes a `verified` array containing each package's
name, version, and attestation bundles.

Depends on npm/pacote#457 to expose the fetched attestation bundles
on the manifest's _attestations property.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny
Copy link
Author

cc @feelepxyz — Related npm CLI issue: npm/cli#9048 and draft PR: npm/cli#9049 (which depends on this pacote change shipping first).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant