[Bug] Proxy and broker configuration logs may expose sensitive values
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Before Creating the Bug Report
- [x] I found a bug, not just a question.
- [x] I searched existing GitHub issues and discussions and did not find a duplicate.
- [x] I confirmed that the bug belongs to this repository.
### Runtime platform environment
Any environment that starts Broker or Proxy, or updates Broker configuration at runtime, with sensitive configuration values.
### RocketMQ version
- Branch: `develop`
- Commit: `293f588571`
### JDK Version
Reproduced and verified with Amazon Corretto JDK 11.0.23.
### Describe the Bug
Broker and Proxy print complete configuration snapshots to normal logs during startup. Broker runtime configuration updates also print the incoming properties and old/new replacement values. These log projections currently have no explicit sensitivity marker or masking policy, so values such as TLS key passwords, authentication bootstrap data, inner-client credentials, SOCKS proxy credentials, and metrics exporter headers may be exposed in log files.
This iteration covers the normal full-configuration startup logs of Broker and Proxy and the Broker dynamic configuration update log. Existing exception/error logs, Controller, BrokerContainer, and Namesrv are out of scope. The open-source Proxy currently has no runtime dynamic configuration reload path.
### Steps to Reproduce
1. Configure Proxy with a non-empty `tlsKeyPassword` or `metricsGrpcExporterHeader`, or configure Broker with a non-empty `metricsGrpcExporterHeader`.
2. Start the corresponding component and inspect its configuration startup log.
3. Alternatively, update an annotated Broker configuration property at runtime.
4. Observe that the configured value is written without masking.
### What Did You Expect to See?
Sensitive configuration fields should be explicitly marked and masked only in log projections. Broker dynamic logs should contain only properties whose values actually changed. The masked text should retain a short prefix and suffix for troubleshooting, while the original configuration object, parsing, serialization, update, persistence, and runtime behavior remain unchanged.
### What Did You See Instead?
The full sensitive value is present in the log.
### Additional Context
The proposed fix introduces a runtime field annotation and a shared log-only masking utility. Only explicitly annotated fields are masked; there is no key-name fallback. Unannotated fields remain unchanged even when their names contain words such as `password`, `secret`, `AK`, or `SK`.
Contributor guide
Research direction
Start by tracing the Broker and Proxy startup configuration log projections, then the Broker dynamic configuration update log, focusing on the explicitly listed sensitive fields. Check how the proposed runtime field annotations and shared log-only masking utility fit those paths without changing configuration behavior. Done means sensitive values are masked, unchanged properties are omitted from dynamic logs, and non-log configuration behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100