Files
ziti/controller/api/body_limit.go
Andrew Martinez 472b32c668 fixes GHSA-q8g9-jc4c-jp6q limit pre-auth request body buffering
- caps buffered HTTP request bodies at 1 MiB across the client, management, fabric management, and OIDC web APIs
- rejects oversized bodies with 413 REQUEST_ENTITY_TOO_LARGE before authentication
- surfaces request body read errors instead of ignoring them
- returns after writing the request context error response in the client API handler
- adds integration coverage for oversized bodies with and without Content-Length
2026-07-23 17:04:43 -04:00

24 lines
956 B
Go

/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package api
// MaxRequestBodySize is the maximum number of HTTP request body bytes the controller's
// web APIs accept per request. Request bodies are buffered into memory before
// authentication, so this cap bounds the memory an unauthenticated client can consume.
// Requests with larger bodies are rejected with HTTP 413 Request Entity Too Large.
const MaxRequestBodySize = 1024 * 1024