-
Notifications
You must be signed in to change notification settings - Fork 63
Make Request Body Size Configurable #116
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codelevel:beginnerSmall, well-scoped work suitable for newer contributors.Small, well-scoped work suitable for newer contributors.type:featureNew user-facing or API-facing capability.New user-facing or API-facing capability.type:securitySecurity, abuse resistance, secret safety, or payment integrity work.Security, abuse resistance, secret safety, or payment integrity work.
Description
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgoPull requests that update go codePull requests that update go codelevel:beginnerSmall, well-scoped work suitable for newer contributors.Small, well-scoped work suitable for newer contributors.type:featureNew user-facing or API-facing capability.New user-facing or API-facing capability.type:securitySecurity, abuse resistance, secret safety, or payment integrity work.Security, abuse resistance, secret safety, or payment integrity work.
Summary
The gateway still hardcodes its request body size limit, and the limit is enforced in more than one place. That makes deployment-specific tuning impossible and risks inconsistent behavior if only one call site is updated.
Current State
The gateway currently enforces a hardcoded
10 * 1024 * 1024request-body limit in two places:gateway/main.goon the summarize request path viahttp.MaxBytesReadergateway/cache.goin the cache middleware via a second hardcoded size checkThe issue is no longer just "replace one constant". Both call sites need to read from one shared helper or the gateway will disagree with itself depending on which path rejects the request first.
What to build
Introduce a single shared gateway helper for request-body size configuration and update both call sites to use it.
Use a bytes-based environment variable name that stays consistent with the project's existing verifier naming, and preserve the current 10 MiB default when unset or invalid.
Acceptance Criteria
gateway/main.goandgateway/cache.gouse that shared helper instead of hardcoded constants.10485760bytes (10 MiB) when the variable is unset or invalid.Non-goals
Verification
cd gateway && go test ./...Blocked by
None - can start immediately.