Skip to content

feat(audit): add --include-attestations flag to output sigstore bundles#9049

Draft
mitchdenny wants to merge 1 commit intonpm:latestfrom
mitchdenny:feat/include-attestations
Draft

feat(audit): add --include-attestations flag to output sigstore bundles#9049
mitchdenny wants to merge 1 commit intonpm:latestfrom
mitchdenny:feat/include-attestations

Conversation

@mitchdenny
Copy link

Summary

Adds a new --include-attestations flag for npm audit signatures that includes the full sigstore attestation bundles in JSON output. Closes #9048.

Changes

  • workspaces/config/lib/definitions/definitions.js: New include-attestations boolean config definition
  • lib/commands/audit.js: Added include-attestations to audit command params
  • lib/utils/verify-signatures.js: Collects verified attestation data and includes it in JSON output when flag is set; adds human-readable hint when attestations are verified without the flag
  • docs/lib/content/commands/npm-audit.md: Documents the new flag
  • test/lib/commands/audit.js: Two new tests covering the flag behavior

Example output

npm audit signatures --json --include-attestations
{
  "invalid": [],
  "missing": [],
  "verified": [
    {
      "name": "sigstore",
      "version": "0.4.0",
      "attestations": {
        "url": "https://registry.npmjs.org/-/npm/v1/attestations/sigstore@0.4.0",
        "provenance": { "predicateType": "https://slsa.dev/provenance/v0.2" },
        "bundles": [...]
      }
    }
  ]
}

Dependencies

⚠️ Draft: This PR depends on npm/pacote#457 shipping first. That pacote change preserves the fetched attestation bundles on mani._attestations.bundles instead of discarding them after verification.

cc @feelepxyz

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.

feat: npm audit signatures --json --include-attestations to output sigstore attestation bundles

1 participant