oscerd opened a new issue, #730:
URL: https://github.com/apache/camel-karaf/issues/730

   ## Description
   
   Both shell commands URL-decode the endpoint URI before printing it, and the
   decode step turns percent-encoded control characters back into raw bytes:
   
   - `shell/src/main/java/org/apache/camel/karaf/shell/EndpointList.java:67-73`
   - `shell/src/main/java/org/apache/camel/karaf/shell/EndpointStats.java:69-74`
   
   ```java
   if (decode) {
       // decode uri so its more human readable
       uri = URLDecoder.decode(uri, "UTF-8");
   }
   // sanitize and mask uri so we don't see passwords
   uri = URISupport.sanitizeUri(uri);
   table.addRow().addContent(camelContext.getName(), uri, 
getEndpointState(endpoint));
   ```
   
   `--decode` defaults to `true` in both commands. `URISupport.sanitizeUri` 
masks
   parameters that look like credentials; it does not remove control characters.
   The decoded string then goes straight into `ShellTable`, so `%1b`, `%0a` and
   `%07` in a URI reach the terminal as raw ESC, LF and BEL.
   
   The URIs printed are not limited to route-author literals: `getEndpoints()`
   includes endpoints materialised by `toD`/`recipientList`, and
   `RuntimeEndpointRegistry` tracks dynamic endpoints by design, so a URI can
   contain a substring that came in on the wire.
   
   A raw LF breaks the table layout and lets one endpoint render as two rows; 
ESC
   sequences are interpreted by the terminal emulator. This is the view an
   operator uses to see what a context is actually connected to, so a garbled or
   forgeable rendering is worth avoiding regardless of how the content got 
there.
   
   ## Expected Behavior
   
   The URI written to the table contains no ISO control characters. A URI has no
   legitimate need for any of them, so stripping or visibly escaping them after
   the decode is lossless for real endpoints.
   
   ## Actual Behavior
   
   Percent-encoded control characters are re-armed by the decode and passed
   through to the terminal unchanged.
   
   ## Additional Context
   
   - Both commands should be fixed together -- it is the same three lines.
   - Flipping the `--decode` default to `false` would also address it, but at 
the
     cost of the readability the option exists for; sanitising after the decode
     keeps both properties.
   
   ---
   _Claude Code on behalf of Andrea Cosentino_


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