NUAAwqy opened a new pull request, #7413:
URL: https://github.com/apache/rocketmq-dashboard/pull/7413

   ### Which Issue(s) This PR Fixes
   
   - Fixes #7412
   
   ### Brief Description
   
   `internal/studio/client.go` read every non-2xx response body with an 
unbounded `io.ReadAll` and echoed the raw body verbatim into 
`APIError.Message`, which the CLI prints to stderr (or into the structured 
error document). The MCP transport path in the same package already bounds that 
read (`statusErrorBodyLimit`, 4 KiB) and falls back to a generic status 
message; the plain CLI request path missed the same guard, so a misbehaving 
endpoint answering an error with a huge HTML or plain-text blob was buffered 
whole and printed.
   
   This PR reads non-2xx bodies through `io.LimitReader(body, 
statusErrorBodyLimit+1)`, falls back to the generic `studio server returned 
HTTP %d` message when the body exceeds the diagnostic budget, and caps each 
structured diagnostic field (`code`/`message`/`hint`, envelope `message`) on a 
UTF-8 boundary so an oversized structured field cannot smuggle the unbounded 
read back into the output. Bodies within the budget keep their structured or 
plain-text content, including the exact boundary value.
   
   `go test ./...` passes; the two oversized-body cases fail against the 
previous behavior.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to