s3: drain request body before error response (#11334)

* s3: drain request body before error response

* s3: keep oversized request bodies drainable
This commit is contained in:
Chris Lu authored and GitHub committed 2026-09-15 13:09:07 -07:00
1 parent 166af06a2b
commit 93d4a6aefd
8 files changed
+157 -13

No files matched your search

+1 -3
View File
@@ -709,10 +709,8 @@ func (s3a *S3ApiServer) UnifiedPostHandler(w http.ResponseWriter, r *http.Reques
// Save the body first so we can restore it for STS handler signature verification
var bodyBytes []byte
if r.Body != nil {
// Limit body size to prevent DoS attacks
r.Body = http.MaxBytesReader(w, r.Body, iamRequestBodyLimit)
var err error
bodyBytes, err = io.ReadAll(r.Body)
bodyBytes, err = readRequestBody(r, iamRequestBodyLimit)
if err != nil {
glog.Errorf("failed to read request body: %v", err)
s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)