Skip to content

[ISSUE #10724] Avoid logging full gRPC responses in ResponseWriter - #10803

Closed
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-response-writer-log-10724
Closed

[ISSUE #10724] Avoid logging full gRPC responses in ResponseWriter#10803
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-response-writer-log-10724

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace full ResponseWriter response logging with a payload-free response summary
  • keep response type and status code when present
  • add tests to ensure receive-message payload data is not included in the summary

Tests

  • JAVA_HOME=$(/usr/libexec/java_home -v 1.8) mvn -pl proxy -Dtest=ResponseWriterTest test
  • git diff --check

Closes #10724

Copilot AI review requested due to automatic review settings August 3, 2026 15:35
@Aias00

Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing this as a duplicate because #10725 already covers #10724.

@Aias00 Aias00 closed this Aug 3, 2026

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

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Reduces risk of leaking sensitive gRPC payload data by replacing full protobuf response logging in ResponseWriter with a payload-free summary (optionally including status code), and adds tests to prevent regressions.

Changes:

  • Replace debug/warn logs of full gRPC responses with summarizeResponse(...).
  • Implement response summarization that includes response type and status code (when present).
  • Add unit tests asserting no payload fields appear in the summary and status code is retained.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/common/ResponseWriter.java Avoids logging full protobuf responses by logging a summary (type + optional status code).
proxy/src/test/java/org/apache/rocketmq/proxy/grpc/v2/common/ResponseWriterTest.java Adds coverage to ensure summaries don’t include message payload/metadata and keep status code when available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +57 to +60
String responseSummary = summarizeResponse(response);
log.debug("start to write response. response: {}", responseSummary);
if (isCancelled(observer)) {
log.warn("client has cancelled the request. response to write: {}", response);
log.warn("client has cancelled the request. response to write: {}", responseSummary);
Comment on lines +99 to +103
Object status = response.getField(statusField);
if (!(status instanceof Message)) {
summary.append("{status=").append(status).append('}');
return;
}
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.23%. Comparing base (eddb235) to head (e42b3fb).

Files with missing lines Patch % Lines
.../rocketmq/proxy/grpc/v2/common/ResponseWriter.java 54.54% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10803      +/-   ##
=============================================
- Coverage      48.31%   48.23%   -0.09%     
+ Complexity     13521    13494      -27     
=============================================
  Files           1380     1380              
  Lines         101104   101123      +19     
  Branches       13107    13111       +4     
=============================================
- Hits           48853    48779      -74     
- Misses         46287    46357      +70     
- Partials        5964     5987      +23     

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

Avoid logging full gRPC responses in proxy ResponseWriter

3 participants