pilichoumao opened a new issue, #6895:
URL: https://github.com/apache/rocketmq-dashboard/issues/6895

   ### Before creating this report
   
   - [x] Searched existing issues and pull requests, including #6396 (table 
cells), #5624 (table width), and #6317 (stdio output write errors).
   - [x] Reproduced on `rocketmq-studio` at 
`a92c23144408cdf5729707050e9ecd9b75f1bad0`.
   
   ### Runtime environment
   
   Linux x86_64, Go 1.27.1; rmqctl built from source. The reproduction uses a 
local HTTP fixture, not a live Studio/Broker, MySQL, or browser.
   
   ### Describe the bug
   
   Plain CLI error diagnostics and MCP stdio stderr can emit raw ASCII control 
characters. `safeDiagnosticText` flattens CR/LF/TAB but leaves ESC, BEL, 
backspace and DEL unchanged. JSON decoding of a peer error message restores 
those bytes before `writeCommandError` prints it; local stdio transport errors 
have the same terminal-output boundary.
   
   For example, an error message containing JSON `"resource \u001b[2J denied"` 
reaches stderr with a raw ESC rather than the visible text `\x1b`. This can 
alter the terminal display. This report concerns diagnostic display integrity, 
not credential disclosure or code execution.
   
   ### Steps to reproduce
   
   1. Point a test rmqctl context at a local HTTP server that returns status 
403 and `{"code":"FORBIDDEN","message":"resource \u001b[2J denied"}` from the 
tool-call endpoint.
   2. Execute `rmqctl --config <fixture-config> --instance-id dev topic list` 
and capture stderr.
   3. Assert that the captured diagnostic has no raw ESC byte. Repeat with BEL 
(`\u0007`), backspace (`\u0008`) and DEL (`\u007f`).
   4. For the stdio path, render a local transport error containing ESC through 
`writeStdioError` and capture its stderr.
   
   On the unchanged implementation, all four HTTP diagnostic cases and the 
stdio stderr case fail. The ordinary Chinese/English text control and 
JSON/YAML/MCP structured-error compatibility controls pass.
   
   ### Expected behavior
   
   Escape terminal control bytes visibly at the plain diagnostic/stderr 
boundary, retaining ordinary Unicode and literal backslashes. Preserve existing 
CR/LF/TAB flattening and the decoded values of JSON/YAML/MCP error frames.
   
   ### Scope and related work
   
   #6396 fixed table-cell boundaries in `internal/output`, which these error 
paths do not use. #6317 addresses failed writes rather than the diagnostic 
bytes. The proposed fix is confined to plain CLI errors and MCP stderr, with 
regressions and a short behavior note; no dependency upgrade or protocol change 
is needed.
   


-- 
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