Skip to content

fix(core): make extension bundle verification failures diagnosable (#579) - #601

Merged
jimhoyd merged 4 commits into
mainfrom
claude/bundle-verify-errors
Sep 24, 2026
Merged

jimhoyd merged 4 commits into
mainfrom
claude/bundle-verify-errors

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Refs #579

Problem and change

urlcode init --with auth on 0.5.9 fails with GitHub attestation verification refused the extension bundle. The cause is that [email protected] was attested by a workflow_dispatch run on refs/heads/main, and the CLI verifies --source-ref refs/tags/<release>. The CLI discarded gh's output, so the cause was invisible. This PR leaves the verifier policy as it is. It does not touch the published release.

CLI / transport (packages/core/src/extension-transport.ts, extension-bundles.ts, init-with.ts)

  • gh attestation verify output is captured (at most 16 KiB) and not discarded. The refusal error now carries the policy applied (signer workflow and refs/tags/<release>). It also carries a single-line excerpt of at most 600 characters, with ANSI/control characters stripped, that keeps the lines stating the refusal. Example: expected SourceRepositoryRef to be refs/tags/[email protected], got refs/heads/main.
  • init --with and extension-bundles install check names against BUNDLE_CATALOG_NAMES (the list extension-bundles list prints) before any network call. A typo gets a suggestion: Unknown extension bundle auht; did you mean auth? Known bundles: .... The check applies only with the production GitHub transport. An injected transport brings its own catalog, and the signed catalog stays authoritative.
  • A network-level fetch failure now reads Could not reach GitHub to fetch extension bundle release extension-bundles@vX (ENOTFOUND); check the network connection, .... Before, it fell through to the generic Operation failed…. Offline transport itself is still init --with has no offline/local-bundle transport for extension bundles #533.

Release workflow (.github/workflows/extension-bundles.yml)

  • The dispatch path used to build and attest on the dispatching main run. The Sigstore certificate records the run's own ref, so the result could never satisfy the CLI. Now a dispatch from main runs a tag job only: it creates or resumes the tag, then runs gh workflow run extension-bundles.yml --ref <tag>. That needs actions: write, and a GITHUB_TOKEN workflow_dispatch does start a new run. The publish job runs only when github.ref_type == 'tag', so every attestation names refs/tags/<release>. For a dispatch, the tag must equal extension-bundles@v<inputs.version>. The update-ref workaround is gone.
  • New scripts/verify-extension-bundles.ts uses the CLI's own githubBundleTransport (same signer workflow and --source-ref), plus catalog parsing, the core-version pin, the archive checks, and a check that catalog names match BUNDLE_CATALOG_NAMES. It runs once before gh release create, so a release the CLI would refuse is never published. It runs again on the assets downloaded back from the published release.
  • Operator cost: a dispatched bundle release now needs two release approvals, one for the tagging run and one for the tag build. The docs are updated. I kept the tagging job behind the environment rather than loosening it. The release environment already allows extension-bundles@v* tag deployments.

Still needed (maintainer action, which is why this PR is Refs, not Closes): the published v0.5.9 bundle release still carries refs/heads/main provenance, so init --with on 0.5.9 keeps failing. The error message now shows why. Re-issue the bundle release from its tag, or cut the next core and bundle release through this workflow.

Verification

  • node --test test/extension-bundles.test.ts test/init-with.test.ts test/project-dependencies.test.ts test/release-dispatch.test.ts: all pass. The new tests cover:
    • gh output passthrough, using a fake gh on PATH (skipped on Windows).
    • Excerpt sanitizing and bounding.
    • Local name validation with did-you-mean, including an assertion that fetch is never called.
    • The CLI init --with auth,auht refusal.
    • The unreachable-GitHub message.
    • The release verifier accepting a complete release and refusing both an attestation failure and a catalog/name mismatch.
    • Workflow structure: nothing is built or signed on main, and the verification steps sit before and after gh release create.
  • npm run typecheck: pass.
  • npm run verify: pass (core 781 and 91 tests). The auth password-hash contention test ([Bug]: auth password hashing returns 503 to every caller when two global slots are busy #464/[Bug]: Windows CI flake in auth password-hashing contention test (auth-core.test.ts:489, #464) #506) failed once while 11 parallel agents were loading this machine. It passed on rerun, and npm run verify:workspaces then passed in full.
  • npm run test:package: pass.
  • Not verified: the new workflow path has not run in Actions. It only runs on a real release. That includes the GITHUB_TOKEN re-dispatch and the post-publish gh release download check.

Compatibility and security

  • The verifier policy is unchanged: same signer workflow, --source-ref refs/tags/<release> and --deny-self-hosted-runners.

  • Error text includes excerpts of gh output. They are bounded, control characters are stripped, and they contain no tokens (gh does not print them).

  • The workflow gains actions: write on the tag job only. The publish job's permissions are unchanged.

  • Changes match the documented portable contract; docs/examples are updated where needed.

  • Relevant tests and package checks pass, or limitations are explained above.

  • No credentials, customer data or private project material are included.

  • Runtime/starter changes remain aligned where applicable.

🤖 Generated with Claude Code

jimhoyd and others added 4 commits September 23, 2026 17:33
)

- Pass a bounded, sanitized excerpt of `gh attestation verify` output and
  the applied policy through on refusal instead of discarding it.
- Check `init --with` / `extension-bundles install` names against the
  bundles this core builds before any network call, with did-you-mean.
- Report an unreachable GitHub as such, naming the release being fetched.
- Release workflow: a dispatch from main only creates the tag and
  re-dispatches on it, so build and attestation run on refs/tags/<release>;
  verify assets with the CLI's own transport before and after publishing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…errors

# Conflicts:
#	llms-full.txt
#	scripts/README.md
The merge with origin/main lost #596's timeout-minutes on the job that
builds/attests/publishes bundles, since that job was split into tag/publish
in #601. Restore it on publish (the tag job already got one from the merge).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd merged commit d70fa0a into main Sep 24, 2026
61 checks passed
@jimhoyd
jimhoyd deleted the claude/bundle-verify-errors branch September 24, 2026 00:51
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