Skip to content

[ISSUE #10760] Avoid logging full system message data - #10761

Open
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-system-message-log-summary
Open

[ISSUE #10760] Avoid logging full system message data#10761
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-system-message-log-summary

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #10760.

What changed

  • Replace full system-message data logging in AbstractSystemMessageSyncer failure paths with a compact dataSummary.
  • Summarize HeartbeatSyncerData without dumping subscription details or channel data.
  • Add regression coverage for the summary output.

Validation

  • JAVA_HOME=$(/usr/libexec/java_home -v 1.8) mvn -pl proxy -Dtest=HeartbeatSyncerTest test

Copilot AI review requested due to automatic review settings August 3, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sendSystemMessage to log a compact dataSummary instead of full data.
  • Add summarizeSystemMessageData with special handling for HeartbeatSyncerData to 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.

Comment on lines +143 to +144
return data.getClass().getSimpleName();
}
Comment on lines +135 to +141
return "HeartbeatSyncerData{"
+ "heartbeatType=" + heartbeatData.getHeartbeatType()
+ ", clientId=" + heartbeatData.getClientId()
+ ", group=" + heartbeatData.getGroup()
+ ", subscriptionCount=" + subscriptionCount
+ ", channelDataPresent=" + (heartbeatData.getChannelData() != null)
+ '}';
Comment on lines 94 to 97
protected void sendSystemMessage(Object data) {
String targetTopic = this.getBroadcastTopicName();
String dataSummary = summarizeSystemMessageData(data);
try {
Comment on lines 112 to 120
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 RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — The summarizeSystemMessageData method is well-structured: null-safe, type-specific for HeartbeatSyncerData, and falls back to class simple name for unknown types. The null check on getSubscriptionDataSet() 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-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.44444% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.22%. Comparing base (89166af) to head (df161af).

Files with missing lines Patch % Lines
...ervice/sysmessage/AbstractSystemMessageSyncer.java 44.44% 7 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Avoid logging full system message data on proxy sync failures

4 participants