[ISSUE #10760] Avoid logging full system message data - #10761
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens Proxy system-message failure logging (Issue #10760) by avoiding logging full system-message payload objects, replacing them with a compact summary and adding a regression test around heartbeat summaries.
Changes:
- Replace error logs in
AbstractSystemMessageSyncer.sendSystemMessageto log a compactdataSummaryinstead of fulldata. - Add
summarizeSystemMessageDatawith special handling forHeartbeatSyncerDatato avoid dumping subscription/channel details. - Add a unit test asserting the summary includes minimal fields and excludes sensitive heartbeat payload contents.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| proxy/src/main/java/org/apache/rocketmq/proxy/service/sysmessage/AbstractSystemMessageSyncer.java | Switch failure logs to dataSummary and introduce a heartbeat-aware summarizer. |
| proxy/src/test/java/org/apache/rocketmq/proxy/service/sysmessage/HeartbeatSyncerTest.java | Add regression coverage ensuring heartbeat summaries don’t include subscription/channel payload details. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return data.getClass().getSimpleName(); | ||
| } |
| return "HeartbeatSyncerData{" | ||
| + "heartbeatType=" + heartbeatData.getHeartbeatType() | ||
| + ", clientId=" + heartbeatData.getClientId() | ||
| + ", group=" + heartbeatData.getGroup() | ||
| + ", subscriptionCount=" + subscriptionCount | ||
| + ", channelDataPresent=" + (heartbeatData.getChannelData() != null) | ||
| + '}'; |
| protected void sendSystemMessage(Object data) { | ||
| String targetTopic = this.getBroadcastTopicName(); | ||
| String dataSummary = summarizeSystemMessageData(data); | ||
| try { |
| if (throwable != null) { | ||
| log.error("send system message failed. data: {}, topic: {}", data, getBroadcastTopicName(), throwable); | ||
| log.error("send system message failed. dataSummary: {}, topic: {}", | ||
| dataSummary, getBroadcastTopicName(), throwable); | ||
| return; | ||
| } | ||
| if (SendStatus.SEND_OK != result.getSendStatus()) { | ||
| log.error("send system message failed. data: {}, topic: {}, sendResult:{}", data, getBroadcastTopicName(), result); | ||
| log.error("send system message failed. dataSummary: {}, topic: {}, sendResult:{}", | ||
| dataSummary, getBroadcastTopicName(), result); | ||
| } |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Replaces full system-message data logging in AbstractSystemMessageSyncer failure paths with a compact summarizeSystemMessageData() method, preventing sensitive subscription details and channel data from appearing in error logs.
Findings
- [Info]
proxy/src/main/java/.../sysmessage/AbstractSystemMessageSyncer.java:113-145— ThesummarizeSystemMessageDatamethod is well-structured: null-safe, type-specific forHeartbeatSyncerData, and falls back to class simple name for unknown types. The null check ongetSubscriptionDataSet()is correct. - [Info] The fallback path (non-HeartbeatSyncerData types) returns only
getClass().getSimpleName(), which intentionally sacrifices debug detail for safety. This is an acceptable security trade-off. If other message types need richer summaries in the future, the method is easy to extend. - [Info]
proxy/src/test/java/.../sysmessage/HeartbeatSyncerTest.java— Thorough regression test verifying that sensitive fields (topic, tag, channel data) are excluded while diagnostic fields (type, clientId, group, subscriptionCount) are retained.
Verdict
Clean security fix with good test coverage and a well-designed summary method. LGTM.
Automated review by github-manager-bot
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10761 +/- ##
=============================================
- Coverage 48.29% 48.22% -0.07%
+ Complexity 13499 13480 -19
=============================================
Files 1380 1380
Lines 101093 101108 +15
Branches 13102 13105 +3
=============================================
- Hits 48821 48758 -63
- Misses 46304 46363 +59
- Partials 5968 5987 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #10760.
What changed
datalogging inAbstractSystemMessageSyncerfailure paths with a compactdataSummary.HeartbeatSyncerDatawithout dumping subscription details or channel data.Validation
JAVA_HOME=$(/usr/libexec/java_home -v 1.8) mvn -pl proxy -Dtest=HeartbeatSyncerTest test