Skip to content

feat: expose fetched attestation bundles on manifest#457

Merged
wraithgar merged 5 commits intonpm:mainfrom
mitchdenny:feat/expose-attestation-bundles
Mar 9, 2026
Merged

feat: expose fetched attestation bundles on manifest#457
wraithgar merged 5 commits intonpm:mainfrom
mitchdenny:feat/expose-attestation-bundles

Conversation

@mitchdenny
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

lib/registry.js Outdated
}
}
mani._attestations = dist.attestations
mani._attestations = { ...dist.attestations, bundles: attestations }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hang these off of another _ attribute. I'd hate for attestations to add a bundles attribute some time in the future and make this a huge problem.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with this recommendation 😄

…ttribute

Instead of merging fetched bundles into _attestations (which mirrors
dist.attestations from the registry), store them on a separate
_attestationBundles attribute. This avoids future collisions if the
registry ever adds a 'bundles' field to dist.attestations.

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

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wraithgar and @owlstronaut — great catch. I've updated the PR to store the fetched bundles on a separate _attestationBundles attribute instead of merging them into _attestations. This keeps _attestations identical to dist.attestations from the registry and avoids any future collision risk.

I've also updated the npm CLI PR (npm/cli#9049) to read from _attestationBundles accordingly.

Mitch Denny and others added 2 commits March 6, 2026 11:58
Run template-oss-apply to regenerate managed files with release/v*
branch patterns for CI, CodeQL, release workflows, settings, and
dependabot configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These workflow/config changes are pre-existing drift unrelated to this
PR and should be addressed separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wraithgar
Copy link
Copy Markdown
Member

Linting failures are cause of new branches we added to try to do some npm@10 backports, they should not block this PR

@wraithgar wraithgar merged commit d912f17 into npm:main Mar 9, 2026
12 of 13 checks passed
@github-actions github-actions bot mentioned this pull request Mar 9, 2026
wraithgar pushed a commit that referenced this pull request Mar 9, 2026
🤖 I have created a release *beep* *boop*
---


## [21.5.0](v21.4.0...v21.5.0)
(2026-03-09)
### Features
*
[`d912f17`](d912f17)
[#457](#457) expose fetched
attestation bundles on manifest (#457) (@mitchdenny)
### Chores
*
[`586a55d`](586a55d)
[#471](#471) template-oss-apply for
new macos images (#471) (@wraithgar)
*
[`d1cc5c8`](d1cc5c8)
[#460](#460) template-oss-apply for
release branches (#460) (@wraithgar)
*
[`b741e8b`](b741e8b)
[#468](#468) bump @npmcli/template-oss
from 4.28.0 to 4.29.0 (#468) (@dependabot[bot], @npm-cli-bot)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
mitchdenny pushed a commit to mitchdenny/npm-cli that referenced this pull request Mar 17, 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>
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.

3 participants