You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Wang1rrr (via GitHub)" <gi...@apache.org> on 2026/10/19 04:12:17 UTC

[PR] fix(metrics): encode Basic authentication credentials as UTF-8 [rocketmq-dashboard]

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

   ## Summary
   Closes #7010.
   
   Use UTF-8 explicitly for Basic credentials in both the data-source connection probe and the actual Prometheus-compatible range query. The previous Spring default is ISO-8859-1: it silently changes Latin-1 credential bytes and throws for Chinese/emoji credentials. ASCII headers remain byte-for-byte equivalent.
   
   This matches [Prometheus's documented UTF-8 password hashing](https://prometheus.io/docs/guides/basic-auth/#hashing-a-password) and [its authentication handler's comparison of the received password bytes](https://github.com/prometheus/exporter-toolkit/blob/v0.14.1/web/handler.go#L98-L119).
   
   ## Validation
   - Before: all 6 new cases fail, covering accented Latin characters, Chinese, and emoji in both request paths. The range fixture returns HTTP 401 for the wrong Basic header; unencodable credentials fail before sending.
   - After: `mvn -B -ntp -Dtest=PrometheusMetricsSourceTest,SettingsServiceTest test`: 77 tests pass on Java 21; Checkstyle passes.
   - The range-query cases exercise a local HTTP server and the connection-probe cases assert the exact request header. Existing ASCII and Bearer cases also pass.
   - `git diff --check` passes.
   - No external Prometheus deployment or full backend suite was run locally.
   
   AI assistance was used; the diff and before/after regression results were reviewed.
   
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org