Repository navigation
Enforce response size limits (1 MiB) for provider JSON - #99
Merged
Merged
Conversation
kilork
force-pushed
the
fix-95-response-size-limits
branch
from
October 4, 2026 19:36
3813312 to
677dfca
Compare
Provider responses are untrusted input. All JSON parses of provider responses (discovery config, JWKS, token requests, userinfo, UMA2) go through a shared internal helper that reads the body and errors with ClientError::ResponseTooBig if it exceeds 1 MiB before parsing. Fixes #95
Providers with many signing keys can have JWK sets larger than the default 1 MiB limit. Sibling methods jwks_with_max_size and jwks_insecure_with_max_size accept a custom limit (usize::MAX disables it), following the jwks/jwks_insecure sibling pattern (#89). Other fetches keep the default limit.
kilork
force-pushed
the
fix-95-response-size-limits
branch
from
October 4, 2026 19:52
677dfca to
91f87e4
Compare
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.
Fixes #95
crate::http::jsonhelper: reads body as bytes, errorsClientError::ResponseTooBigabove the limit before parsing.crate::http::MAX_RESPONSE_SIZE); for providers whose JWK set is larger (many signing keys), new sibling methodsjwks_with_max_sizeandjwks_insecure_with_max_sizeaccept a custom limit (usize::MAXdisables it) — same sibling pattern as Enforce https for JWKS fetch with per-call insecure opt-out #89. Other fetches keep the default; the limit inside theClient::discoverflow stays at the default until the per-client settings from Security hardening: verify-or-error decode without JWKS, discovery issuer pinning, https for provider endpoints #92 part 3 land.Error-returning call sites surface it asError::ClientError(ResponseTooBig)(transparent).