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

   ## Bug
   Basic authentication for Prometheus-compatible data sources uses Spring's 
two-argument `HttpHeaders.setBasicAuth`, whose default encoding is ISO-8859-1. 
This differs from the UTF-8 password bytes used by Prometheus:
   
   - [The official Prometheus setup 
guide](https://prometheus.io/docs/guides/basic-auth/#hashing-a-password) hashes 
`password.encode("utf-8")`.
   - [The authentication 
handler](https://github.com/prometheus/exporter-toolkit/blob/v0.14.1/web/handler.go#L98-L119)
 checks the decoded request password bytes directly against that hash.
   
   For a password containing Latin-1 characters such as `pässword`, Studio 
sends the wrong bytes and authentication fails. Chinese or emoji credentials 
throw `IllegalArgumentException: Username or password contains characters that 
cannot be encoded to ISO-8859-1` before the request is sent. Both the 
connection test and actual range-query path are affected.
   
   ## Reproduction
   On rocketmq-studio c34535db, use a Basic-authenticated metrics source with 
any of these disposable fixture credentials:
   
   - `opérator` / `pässword`
   - `用户` / `密码`
   - `studio` / `secret🔒`
   
   An embedded HTTP server that accepts the expected UTF-8 Basic header rejects 
the first pair; the remaining pairs cannot be sent. The connection-probe 
request matcher also fails for all three pairs. Six new regression cases fail 
before the fix; existing ASCII cases pass.
   
   ## Expected behavior
   Encode Basic credentials as UTF-8 consistently in connection probes and 
actual metrics queries, matching Prometheus's password handling. ASCII 
credentials should produce the same header as before.
   


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