NUAAwqy opened a new issue, #7412: URL: https://github.com/apache/rocketmq-dashboard/issues/7412
### Symptom Every `rmqctl` command that receives a non-2xx response from Studio buffers the entire response body in memory and echoes it verbatim into the CLI's error output (stderr in table mode, the structured `message` field in JSON/YAML mode). A Studio endpoint or middlebox that answers an error with a large body (an HTML error page, a proxy debug dump) makes rmqctl allocate and print all of it. ### Root cause `internal/studio/client.go` `request()` reads the response body with an unbounded `io.ReadAll(response.Body)` before the status check, and `responseError()` places the raw body text into `APIError.Message` with no length bound. The MCP transport path in the same package already guards exactly this read — `mcp_http.go` reads error bodies through `io.LimitReader(body, statusErrorBodyLimit+1)` (4 KiB) and falls back to the generic status message when the body exceeds the budget. The plain CLI request path missed the same guard. The stdio MCP adapter truncates its diagnostics for the same reason (`stdioDiagnosticLimit`, fixed along the same family in #7372/#7374), so the CLI error path was the one remaining unbounded echo of server-controlled text. ### Impact - Memory and terminal flooding: `rmqctl --output json` against a broken endpoint answers with megabytes of third-party HTML inside a structured error document. - The unbounded text also flows into MCP stdio sessions when a caller surfaces command errors. ### Fix Read non-2xx bodies through `io.LimitReader(body, statusErrorBodyLimit+1)` and fall back to the generic `studio server returned HTTP %d` message when the body exceeds the budget (matching the MCP transport's behavior), and cap each structured diagnostic field (`code`/`message`/`hint`, envelope `message`) on a UTF-8 boundary. Bounded bodies keep their structured or plain-text content. Five new test cases cover the oversized and boundary paths; both oversized 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]
