Refuse to publish without provenance, and gate every publish path against regression

Merged
UN
3mo ago
+2160-59

DEFECT

After three failed provenance publish attempts the release step called npm publish without --provenance and reported success. The only signal was a GitHub warning annotation. A transient registry failure therefore downgrades the package's supply-chain attestation permanently for that version, and consumers cannot tell an unattested publish caused by a 404 storm apart from one that never had provenance at all.

The fallback was added while the registry was returning 404s, to get a release out. That trade is wrong for a supply-chain artifact: an unattested publish is not a degraded success, it is a different artifact. Failing the job leaves main holding the prepared version so the next run resumes the same release rather than inventing another one, which is exactly what the surrounding transaction was designed to do.

Non-vacuity proof

Test A (restore fallback): exit 1

FAIL - .github/workflows/release.yml: a publish invocation does not enable --provenance, so it would publish an unattested artifact: npm publish --access public --ignore-scripts
verify-release-publish-attestation: 1 failure(s).

Test B (--provenance=false): exit 1

FAIL - .github/workflows/release.yml: a publish invocation does not enable --provenance, so it would publish an unattested artifact: npm publish --access public --provenance=false --ignore-scripts
verify-release-publish-attestation: 1 failure(s).

Test C (clean tree): exit 0

ok - .github/workflows/release.yml: 1 publish invocation(s), each carrying --provenance
verify-release-publish-attestation: every publish invocation is attested.

Gate table

gateresult
typecheck0
coverage92.57 / 82.89 / 91.75 (thresholds: 88 / 79 / 89)
verify:release-publish-attestation0

pm item

https://github.com/unbraind/pm-github/blob/main/.agents/pm/issues/pm-github-i5b8.toon

Summary by Sourcery

Require provenance for every publish path, safely reconcile only attested registry artifacts, and gate CI and release checks against attestation regressions.

New Features:

  • Add a repository-wide verifier that requires every npm publish path to enable provenance and rejects unsupported or disabled attestation forms.
  • Extend publish-path analysis to cover workflow commands, package scripts, executable files, shell wrappers, substitutions, runners, variables, redirections, and YAML command forms.

Bug Fixes:

  • Prevent failed provenance publishes from falling back to unattested publication and refuse to reconcile registry versions without visible attestations.
  • Retry registry reconciliation for late-arriving attestations and fail safely when an occupied version remains unattested.
  • Restore release changelog options and update the changelog dependency to handle the full tracker output.

Enhancements:

  • Centralize shell command scanning and executable-entry-point detection with fixture-backed coverage for regression-prone publish paths.

Build:

  • Add the attestation verifier to release checks and package scripts; update the lockfile and pm-changelog dependency.

CI:

  • Run the publish-attestation verification in CI.

Tests:

  • Add comprehensive tests proving attested and unattested publish paths, shell bypasses, runner variants, registry-safe reconciliation behavior, and non-vacuous failure reporting.

Chores:

  • Repair and normalize PM tracker issue metadata, duplicate links, history records, and provenance corrections.

Summary by cubic

Refuses to publish without provenance so a transient registry failure can no longer permanently downgrade a release to an unattested artifact, and gates every publish path against regression. Closes pm-github-i5b8, pm-github-1rik, and pm-github-nwaz.

Bug Fixes

  • After three failed provenance attempts the release job polls the registry five times at 30s intervals and reconciles a late-landing version only when it carries an attestation; an occupied coordinate without one fails the release.
  • Reconcile reads never terminate the step, so transient attestation lag is retried instead of leaving npm ahead of git; a failed release leaves main holding the prepared version so a re-run resumes the same release.
  • Restores release.yml from an earlier overwrite with pm-slack's workflow, recovering this package's --item-url-base and --date-from-version invocations.
  • Bumps the pm-changelog pin to ^2026.8.22 so the changelog step stops failing once the tracker outgrows the older version's output budget (pm-github-ypi5).
  • Repairs corrupted pm tracker metadata: malformed files and tests rows now carry full scoped fields, duplicate items are linked to their canonical records, a false non-vacuity record is corrected, history provenance is normalized, and PR 57 verification evidence is recorded.

New Features

  • scripts/verify-release-publish-attestation.ts gates every publish invocation in tracked workflows and package.json scripts, failing unless it carries --provenance and rejecting the --provenance=false and --no-provenance spellings.
  • The audit tokenises shell text like a shell, so shell-embedded (eval, sh -c, bash -ec) and runner-spelled (npx, bunx, pnpx, pnpm dlx, yarn dlx, npm exec, bun x) publishes are judged as real commands instead of vanishing from the scan (pm-github-5igz).
  • Scalar expansion only inlines plain literals so variable-held commands are still caught without breaking the scan on substitution-bearing values; four more bypass shapes are closed — a YAML run: key carrying the command, a quoted parenthesis inside a substitution, a trailing-backslash script that lent its --provenance to the next publish, and workspace no longer counted as an npm subcommand runner — and a split eval payload is proven not to be a bypass.
  • The shared scanner and main-invocation guard carry their own fixture suite, the gate runs in CI and as part of release:check, and every bypass shape is revert-checked against the tests.

Added 2026-08-28 — release unblock, two gate bypasses, and tracker repairs

The release was failing before it could publish

Generate changelog and release notes exited non-zero with pm list-all --json answer was incomplete and was refused: truncated=true; has_more=true; count=5 of total=86. The lockfile resolved pm-changelog 2026.8.17, which reads the whole tracker without the unbounded output controls 2026.8.22 added, and npx prefers that locked copy over the registry. At 89 items this tracker crosses the default output budget, the read truncated, and pm-changelog correctly refused to build a changelog from a partial workspace. The refusal is right; the stale pin is the defect. Both of the workflow's own invocations now exit 0 against the full tracker.

Two bypasses of one class in the attestation gate

Both let an unrecognised publish through, which is worse than an unflagged one: nothing in the output says anything went unexamined, and the non-vacuity guard is satisfied by the workflow's ordinary attested publish, so the gate reports clean.

spellingbeforeafter
npx npm publish (and bunx, pnpx, pnpm dlx, yarn dlx, npm exec, bun x)not recognised as a publish at alljudged like any other publish
bash -ec "npm publish …" (and bash -euc, sh -ec)string never inspectedstring inspected

Both fixes are proven non-vacuous by reverting them and watching the new cases fail (2 of 32 each time).

Tracker repairs

  • files rows declared {path,scope} while carrying three comma-separated values, so path held a string that cannot be a path; tests rows did the same to command. All three affected items now declare files{path,scope,note} and tests{command,scope,timeout_seconds}.
  • pm-github-nwaz, pm-github-1rik and pm-github-i5b8 are duplicates of one another (exact_title, score 1.0), now linked with duplicate_of: pm-github-i5b8.
  • pm-github-1rik recorded its non-vacuity proof as exit 0 for the two cases that must fail — a proof asserting its own vacuity. Re-measured here: clean tree exits 0, restoring the fallback exits 1 naming the unattested invocation, restoring the file exits 0. A correction is appended to that item.

PM items

Gates on this branch

build, typecheck, check, docstring, verify:release-publish-attestation, privacy, changelog:check, npm test (32 attestation cases, 323 total), coverage, and pm health --strict-exit run with the pinned ./node_modules/.bin/pm — all pass.