feat(security): 429 rate limiting on public evidence/JWKS endpoints (v0.1.25.46)#224
Merged
Merged
Conversation
…v0.1.25.46) Implements the spec's SHOULD-level throttling on the only anonymous surface (GET /v1/evidence/* and the CyclesEvidence JWKS). PublicEndpointRateLimitFilter: fixed 60s window per client IP, in-process (abuse damping, not a distributed quota); over-limit requests get 429 with error=LIMIT_EXCEEDED (new ErrorCode, spec v0.1.25.12 / runcycles/cycles-protocol#122 — the runtime enum previously had no throttling code, making a conformant 429 impossible), Retry-After, X-RateLimit-Reset, X-RateLimit-Remaining: 0, and the standard correlation headers. Authenticated /v1 endpoints not covered — abuse there is key-attributable. Config: CYCLES_PUBLIC_RATE_LIMIT_ENABLED (default true), CYCLES_PUBLIC_RATE_LIMIT_REQUESTS_PER_MINUTE (default 300). Per instance, keyed on the socket peer; deployments behind a connection-terminating ingress should limit at the ingress and/or raise the limit (documented in README + CHANGELOG). Bounded client map (10k, stale-window eviction); injectable clock for deterministic tests. 500 tests green (incl. new filter unit suite: limits, rollover, per-client isolation, both paths, disabled flag, header/body conformance), spec coverage 11/11, JaCoCo >=95% met, contract tests pinned to the spec revision from cycles-protocol#122. Revision 0.1.25.45 -> 0.1.25.46 (pom + prod compose pins); CHANGELOG/AUDIT/README updated. Depends on cycles-protocol#122 (LIMIT_EXCEEDED enum value) for contract-test green on main.
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.
feat(security): 429 rate limiting on public evidence/JWKS endpoints (v0.1.25.46)
Implements the spec's SHOULD-level throttling on the only anonymous
surface (GET /v1/evidence/* and the CyclesEvidence JWKS).
PublicEndpointRateLimitFilter: fixed 60s window per client IP,
in-process (abuse damping, not a distributed quota); over-limit
requests get 429 with error=LIMIT_EXCEEDED (new ErrorCode, spec
v0.1.25.12 / runcycles/cycles-protocol#122 — the runtime enum
previously had no throttling code, making a conformant 429 impossible),
Retry-After, X-RateLimit-Reset, X-RateLimit-Remaining: 0, and the
standard correlation headers. Authenticated /v1 endpoints not covered —
abuse there is key-attributable.
Config: CYCLES_PUBLIC_RATE_LIMIT_ENABLED (default true),
CYCLES_PUBLIC_RATE_LIMIT_REQUESTS_PER_MINUTE (default 300). Per
instance, keyed on the socket peer; deployments behind a
connection-terminating ingress should limit at the ingress and/or
raise the limit (documented in README + CHANGELOG).
Bounded client map (10k, stale-window eviction); injectable clock for
deterministic tests. 500 tests green (incl. new filter unit suite:
limits, rollover, per-client isolation, both paths, disabled flag,
header/body conformance), spec coverage 11/11, JaCoCo >=95% met,
contract tests pinned to the spec revision from cycles-protocol#122.
Revision 0.1.25.45 -> 0.1.25.46 (pom + prod compose pins);
CHANGELOG/AUDIT/README updated. Depends on cycles-protocol#122
(LIMIT_EXCEEDED enum value) for contract-test green on main.