Repository navigation
fix(edge): serve digest-named GitHub release assets from the registry Worker - #64
Merged
Merged
Conversation
… Worker registry.zpkg.net answered 503 `registry_origin_unavailable` for packages that do have a public GitHub Release, so zed-cli could not reach github.com through the edge while the k8s origin is down. `zed publish` names a packed artifact after its own digest (`zpkg-<sha256>.tar.gz`); the Worker only matched `zpkg-<owner>-<repo>-<version>.tar.gz` / `zpkg-<repo>-<version>.tar.gz`, so a real release looked empty to it. Verified against ores-wasm-loaders/owls-interfaces v0.1.1, whose only asset is `zpkg-fea1f81d….tar.gz`. - `digestFromReleaseAssetName()` parses the content-addressed form, rejecting short, uppercase, or traversal-shaped names. - `versionFromGithub()` accepts such an asset when no conventionally named one matches. The digest comes from the name, and GitHub's reported digest must agree with it when present, so a mislabelled asset still fails closed. - `isAllowedPublishedDownload()` accepts the same form for sidecar-declared download URLs. The returned `download_url` points straight at github.com, so a client bypasses both our origin and R2 for the bytes. workers unit suite: 77 passed. scripts/attest-public-github-fallback.mjs: 0 required failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
registry.zpkg.netanswers503 registry_origin_unavailable("no independently public fallback was found") for packages that do have a public GitHub Release, so a client cannot reach github.com through the edge while the k8s origin is down.Cause
zed publishnames a packed artifact after its own digest —zpkg-<sha256>.tar.gz. The Worker only matched the conventional nameszpkg-<owner>-<repo>-<version>.tar.gzandzpkg-<repo>-<version>.tar.gz, so a real release looked empty to it and the fallback reported nothing public.Live example,
ores-wasm-loaders/owls-interfacesv0.1.1, whose only asset iszpkg-fea1f81d….tar.gz:zed-cli already accepts this form (
release_asset_metadatainsrc/source_fallback.rs); the edge did not.Change
digestFromReleaseAssetName()inworkers/shared/github-fallback.jsparses the content-addressed name and rejects short, uppercase, or traversal-shaped ones.versionFromGithub()accepts a digest-named asset only when no conventionally named asset matches. The digest comes from the name, which is the content address itself, and GitHub's own reported digest must agree with it when present — so a mislabelled asset still fails closed (503), as covered by a test.isAllowedPublishedDownload()accepts the same form for sidecar-declared download URLs.The returned
download_urlpoints straight at github.com, so the client fetches bytes from GitHub, bypassing both our origin and R2.Tests
workersunit suite: 77 passed (node --test shared/*.test.js api-proxy/src/*.test.js registry-proxy/src/*.test.js cdn-proxy/src/*.test.js org-proxy/src/*.test.js scripts/cf-lease.test.js).scripts/attest-public-github-fallback.mjs: 0 required failures.Not covered here
cdn.zpkg.netstill 404s for/github/<org>/<repo>/<tag>/<name>-<version>.tar.gz, because the byte proxy derives the asset name from the request path and a digest-named asset is not derivable from it without a release lookup. That is a deliberate design point incdn-proxy(no GitHub API in the byte path), and it no longer blocks installs: the metadata Worker now hands clients the github.com URL directly. Worth a follow-up decision.Merging this to
maintriggersdeploy-cloudflare-workers.yml.🤖 Generated with Claude Code