Repository navigation
Phase 6: rate-limit the zarr data plane (#901) - #942
Merged
neuromechanist merged 2 commits intoJul 7, 2026
Merged
neuromechanist merged 2 commits into
neuromechanist merged 2 commits into
Conversation
Epic #896 Phase 6 (#901), zarr half. zarr.nemar.org's host fork dispatched straight to zarrDataRoutes, bypassing the api middleware stack and its rate limiter -- the highest-request-volume data-plane path ran unthrottled. - __selectBucket routes /<id>/zarr/* to the generous data-plane IP bucket (same DATA_MAX_REQUESTS as data.nemar.org), so a runaway viewer/scraper is bounded while a real reader runs unthrottled. - zarrDataRoutes applies the rateLimiter middleware (skipping OPTIONS so a 429 never strips a CORS preflight's headers). - The STS ListBucket prefix-scoping half of #901 is tracked as a follow-up (941); it needs live git-annex validation (HeadBucket == ListBucket).
- ZARR_PATH_RE now matches the /zarrproxy/<id>/zarr/* shape too. Hono's
app.route('/zarrproxy', ...) PREPENDS the prefix (doesn't strip it), so
c.req.path keeps /zarrproxy — reachable at api.nemar.org (prod) and the
workers.dev fallback. The old anchor missed it, OVER-throttling real zarr
viewers to 500 instead of 10000. Corrected the misleading comment; added
/zarrproxy path cases to the bucket test (the gap that let it through).
- The rate-limiter 429 on the zarr host now carries the zarr CORS headers,
so a throttled browser viewer reads the 429 + retry_after instead of an
opaque cross-origin failure.
- Shared data-ip bucket with data.nemar.org is per the issue's spec (10000/
60s is generous); flagged by review, kept deliberately.
Contributor
Author
Review (sonnet) — findings addressed in dbabac3
|
neuromechanist
merged commit Jul 7, 2026
30f00b1
into
feature/issue-896-epic-arch-hardening
1 check passed
This branch was previously deployed
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.
Summary
zarr.nemar.org's host fork inindex.tsdispatched straight tozarrDataRoutes.fetch(), bypassing the api middleware stack — including the rate limiter. As the highest-request-volume data-plane path, it ran completely unthrottled (it does have edge caching, so this is availability-hardening, not correctness).__selectBucketnow routes/<id>/zarr/*(viaZARR_PATH_RE) to the same generous data-plane IP bucket asdata.nemar.org(DATA_MAX_REQUESTS = 10000), so a runaway viewer/scraper is bounded while a real reader runs unthrottled.zarrDataRoutesapplies the sharedrateLimitermiddleware, skippingOPTIONSso a 429 never strips a CORS preflight's headers. A small cast bridges the sub-app'sBindings-only generic torateLimiter's context (runtime-safe).Scope
The STS
s3:ListBucketprefix-scoping half of #901 is deliberately deferred to #941: it's a larger, riskier change (git-annexHeadBucketauthorizes ass3:ListBucketwith no prefix, so no IAM condition can allow HeadBucket while blocking no-prefix enumeration — the real fix removes HeadBucket from the user token and needs live git-annex validation before deploy). Full analysis in #941.Test plan
backend/test/rate-limit-buckets.test.ts—/data,/nemar/data, and/<id>/zarr/*all bucket todata-ipatDATA_MAX_REQUESTS; a tokened zarr request still uses the data bucket;/datasets/*stays on the ip bucket.tsc+ Biome clean; existing zarr-data route tests unaffected.Part of epic #896. (zarr half of #901; STS half -> #941.)