Skip to content

fix(ci): provenance passes only when built by this repo's publish.yml on main - #16

Merged
practical-bot merged 1 commit into
mainfrom
ci/provenance-source
Nov 17, 2026
Merged

practical-bot merged 1 commit into
mainfrom
ci/provenance-source

Conversation

@jcotillo

Copy link
Copy Markdown
Contributor

Why

Talos found this on PracticalWorks/guardrails#1, and this repo has the same script. scripts/verify-npm-provenance.mjs accepted any SLSA attestation. Provenance minted by another repository, workflow or branch would have passed as this release's provenance, which defeats the point of checking it.

What changed

  • scripts/verify-npm-provenance.mjs now also checks two things, and passes only if both hold:
    • the statement's subject is pkg:npm/<package>@<version>;
    • its workflow is https://github.com/PracticalWorks/crm .github/workflows/publish.yml on refs/heads/main.
  • The expected repo is a required CLI argument. publish.yml and the verify:npm-provenance script pass PracticalWorks/crm as a literal.
  • A source mismatch fails at once. Only registry 404s and 5xx are retried.
  • Six new tests: wrong repo, wrong workflow, wrong branch, wrong subject, no expected repo, and a mismatch that must not be retried.

This is the same change as PracticalWorks/guardrails#1, applied from one patch.

What deliberately did NOT change

The retry window (15 minutes) and the publish steps.

Proof

  • pnpm guard passes, including the new tests.
  • Against the live registry: node scripts/verify-npm-provenance.mjs @practicalworks/crm 0.13.2 PracticalWorks/crm → Verified npm provenance for @practicalworks/crm@0.13.2 (https://slsa.dev/provenance/v1) from PracticalWorks/crm .github/workflows/publish.yml on refs/heads/main.
  • Sabotage, run on guardrails#1 with the identical code: replacing the source comparison with if (false) fails four tests (rejects provenance built by another repository, …from another workflow…, …from a branch other than main, a source mismatch is final…). Restored, all pass.
  • The same check rejects a real attestation when the expected repo is wrong: rc-bridge 0.1.2 checked against PracticalWorks/guardrails exits 1 with provenance was built by https://github.com/PracticalWorks/rc-bridge … expected https://github.com/PracticalWorks/guardrails ….

Refs: FACT-1986

🤖 Generated with Claude Code

… on main

The check accepted any SLSA attestation, so provenance minted by another repo,
workflow or branch would have passed. It now also requires the statement's
subject to be the package and version, and its workflow to be
PracticalWorks/crm .github/workflows/publish.yml on refs/heads/main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcotillo jcotillo added the merge:queued Queued for the merge drain once Talos approves and CI is green label Nov 17, 2026

@practical-bot practical-bot left a comment

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.

The implementation correctly makes the expected source explicit, validates the npm subject and the workflow repository/path/ref, and treats source mismatches as final rather than retryable registry delays. The workflow passes PracticalWorks/crm; the focused tests cover wrong repository, workflow, branch, subject, missing source, and no-retry behavior.

Claim ledger:

  • “pnpm guard passes, including the new tests.” PASS — CI run 44013200521 ran pnpm guard; output reported 20 tests, 0 failures and guard: 76 files clean.
  • “Against the live registry: node scripts/verify-npm-provenance.mjs @practicalworks/crm 0.13.2 PracticalWorks/crm” PASS — independently queried npm attestations for @practicalworks/crm@0.13.2; it returned SLSA provenance with subject pkg:npm/%40practicalworks/crm@0.13.2, repository https://github.com/PracticalWorks/crm, path .github/workflows/publish.yml, and ref refs/heads/main.
  • “Sabotage, run on guardrails#1 with the identical code … fails four tests.” UNVERIFIED — the guardrails checkout/commit is not available in this review workspace; the current CRM CI run does prove the restored CRM test suite passes.
  • “The same check rejects a real attestation when the expected repo is wrong …” UNVERIFIED — the referenced rc-bridge release is outside this checkout and was not queried; no defect is inferred from this unavailable auxiliary proof.

CI run 44013200521 is green on this exact head and ran guard, build, typecheck, and test; the log reports client 120 tests and twenty-app 28 tests passing.

REVIEWED DIFF: base=main files=4 lines=134

REVIEW VERDICT: approve
NEEDS VERIFICATION: none; the live npm attestation check for @practicalworks/crm@0.13.2 was independently confirmed above.

@practical-bot
practical-bot merged commit d96f61b into main Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge:queued Queued for the merge drain once Talos approves and CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants