Skip to content

core: offline extension-bundle acquisition (cache-first, --bundle-release-path) - #637

Merged
jimhoyd merged 5 commits into
mainfrom
claude/offline-extension-bundles
Sep 24, 2026
Merged

jimhoyd merged 5 commits into
mainfrom
claude/offline-extension-bundles

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • installBundle (extension-bundles install, and init --with in a
    project that already vendors the same install) now checks whether the
    requested name + --bundle-release tag is already recorded in
    urlcode.extension-bundles.lock.json and byte-for-byte identical to
    .urlcode/extension-bundles/<sha256>/ before making any network call, and
    reuses it on a match. If the lock names that release but the cache was
    modified, it fails closed (validateCached's existing "was modified"
    refusal) instead of silently reinstalling over the tampered entry.
  • Add --bundle-release-path <local-directory> to extension-bundles install and init --with: reads that release's signed catalog and
    tarballs from a local directory shaped like a GitHub release, instead of
    GitHub. Implemented as createLocalBundleTransport in
    packages/core/src/extension-bundles.ts, promoting initProjectWith's
    existing test-only bundleTransport seam to a real, documented,
    user-facing option — bundleReleasePath builds the same kind of
    BundleTransport a test double would, just backed by disk instead of a
    fake.
  • Verification is not a separate, weaker check for the local path. Both
    transports call through a new shared runAttestationVerify helper in
    packages/core/src/extension-transport.ts with the identical policy
    (--repo, --signer-workflow, --source-ref refs/tags/<release>,
    --deny-self-hosted-runners); the local transport only adds --bundle <file>, gh attestation verify's own documented flag for offline
    verification against a bundle already fetched with gh attestation download. That downloaded bundle is named sha256-<digest>.jsonl by gh
    itself, and the local transport looks it up by that exact convention — a
    missing bundle, a tampered tarball (whose digest no longer matches any
    bundle on disk), a wrong tag, or a revoked catalog entry all refuse exactly
    as they do online, naming the gh attestation download command that
    produces the missing file.
  • --bundle-release-path composes with --bundle-release: the tag still
    selects which release is being verified; the path only changes where its
    bytes and attestations come from. Network acquisition is unchanged and
    remains the default/fallback when neither a cache hit nor
    --bundle-release-path applies.
  • Docs: new "Offline and local installation" section in docs/EXTENSIONS.md
    (cache-first behavior, the local-directory shape, the gh attestation download step); CLI help text updated for both commands.

Scope note

Per the issue triage, this only covers installBundle/extension-bundles/
init --with. The data-only extension-artifacts channel
(extension-artifacts.ts) isn't touched — it wasn't in scope for #533, and
its own local/offline story (if wanted) should be a separate decision.

Security notes

  • No new trust boundary is introduced: the local path is verified by the
    exact same gh attestation verify invocation and policy as the network
    path, just pointed at local material via gh's own documented --bundle
    offline-verification flag. Nothing is treated as pre-verified merely
    because it's on local disk.
  • The cache-first check re-hashes the lock entry's cached bytes
    (validateCached, the same re-hash loadExtensionBundle/inspect already
    perform) rather than trusting the directory's existence, and refuses
    instead of reinstalling when that re-hash fails.
  • I did not invent any new verification primitive — this is a straight reuse
    of gh attestation verify's existing offline mode. I did not find a case
    where the local path needed to diverge from the network path's checks; if
    a reviewer sees one, flag it rather than assuming this description is
    exhaustive.

Test plan

  • npm run typecheck
  • npm run lint
  • npm run verify (846 tests; 1 pre-existing, unrelated timing flake in
    test/sandbox-pool.test.ts under heavy concurrent-CI load on this
    machine — reproduced in isolation as passing cleanly, confirmed
    unrelated to this change)
  • npm run test:package
  • npm run check:docs (regenerated llms-full.txt via npm run docs:llms for the new docs/EXTENSIONS.md section)
  • New tests: test/extension-bundles.test.ts (local transport install,
    missing/refused attestation bundle fail-closed, malformed release
    directory, cache-hit skips the transport entirely, tampered-cache
    fail-closed, CLI end-to-end --bundle-release-path install +
    validation) and test/init-with.test.ts (init --with --bundle-release-path with no injected transport, tampered asset
    fail-closed, mutual exclusivity with an injected bundleTransport,
    CLI flag validation)

Closes #533.

🤖 Generated with Claude Code

jimhoyd and others added 3 commits September 23, 2026 22:31
…le-release-path)

`extension-bundles install` and `init --with` now check the verified local
cache (.urlcode/extension-bundles/<sha256>/, from a prior successful install
of the same name and --bundle-release) before touching the network, and skip
the network entirely on a match. A tampered cache entry for a matching lock
fails closed instead of silently reinstalling over it.

Add --bundle-release-path <local-directory> to both commands: it reads a
release's catalog and tarballs from a local directory shaped like a GitHub
release instead of GitHub, and verifies every file with the identical `gh
attestation verify` policy (repo, signer workflow, source ref, no
self-hosted runners), pointed offline at a `gh attestation download`
bundle already on disk instead of letting `gh` reach the GitHub API. This
reuses createGithubTransport's attestation-verify call (extracted into a
shared helper) rather than inventing a separate check, and promotes
initProjectWith's existing test-only bundleTransport seam to a real,
documented, user-facing local transport (createLocalBundleTransport).

Closes #533.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	llms-full.txt
#	packages/core/src/cli.ts
#	packages/core/src/extension-bundles.ts
#	packages/core/src/extension-transport.ts
# Conflicts:
#	packages/core/src/cli.ts
@jimhoyd
jimhoyd force-pushed the claude/offline-extension-bundles branch from 23c431b to eff8a69 Compare September 24, 2026 04:12
# Conflicts:
#	docs/EXTENSIONS.md
#	llms-full.txt
#	packages/core/src/cli.ts
#	packages/core/src/extensions-cli.ts
#	test/extension-bundles.test.ts
# Conflicts:
#	packages/core/src/cli.ts
@jimhoyd
jimhoyd merged commit 07d203a into main Sep 24, 2026
22 checks passed
@jimhoyd
jimhoyd deleted the claude/offline-extension-bundles branch September 24, 2026 12:21
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.

init --with has no offline/local-bundle transport for extension bundles

1 participant