Skip to content

[ISSUE #10890] Validate gRPC client language metadata - #10891

Open
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:test/proxy-language-header-validation
Open

[ISSUE #10890] Validate gRPC client language metadata#10891
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:test/proxy-language-header-validation

Conversation

@Aias00

@Aias00 Aias00 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

Malformed or missing gRPC language metadata reached LanguageCode.valueOf and was reported as a server-side INTERNAL error.

Closes #10890

Brief changelog

  • centralize gRPC client language parsing in ClientActivity;
  • reject blank and unknown values with Code.BAD_REQUEST;
  • use the same validation for telemetry registration and client termination;
  • add a telemetry regression test that verifies invalid language maps to gRPC INVALID_ARGUMENT.

Verifying this change

JAVA_HOME=$(/usr/libexec/java_home -v 1.8) PATH="$JAVA_HOME/bin:$PATH" \
  mvn -q -pl proxy -am -Dtest=ClientActivityTest -DfailIfNoTests=false test

Copilot AI lite review requested due to automatic review settings August 10, 2026 02:35

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov-commenter

codecov-commenter commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.54%. Comparing base (293f588) to head (2d79a49).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10891      +/-   ##
=============================================
- Coverage      48.60%   48.54%   -0.07%     
+ Complexity     13690    13668      -22     
=============================================
  Files           1381     1381              
  Lines         101464   101470       +6     
  Branches       13187    13188       +1     
=============================================
- Hits           49318    49259      -59     
- Misses         46158    46199      +41     
- Partials        5988     6012      +24     

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

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

Summary

This PR centralizes gRPC client language parsing in ClientActivity.parseLanguage(), replacing 3 direct LanguageCode.valueOf() calls that would throw unhandled exceptions on malformed input. Previously, these would surface as gRPC INTERNAL errors (server-side fault); now they correctly map to BAD_REQUEST / INVALID_ARGUMENT (client-side fault).

Verdict: LGTM — clean, focused defensive programming fix with good test coverage.

Findings

  • [Info] proxy/.../ClientActivity.java:462-470 — The parseLanguage method uses StringUtils.isBlank() for the empty check, which is good. Consider also trimming the input before valueOf() to handle whitespace-only values (e.g., " ") consistently — isBlank catches this, but the error message "unsupported language: " could be slightly confusing. Minor, not blocking.

Automated review by "github-manager-bot"

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

Summary

Centralizes gRPC language metadata parsing and rejects invalid values. Prevents INTERNAL errors from malformed input.

LGTM.


Automated review by github-manager-bot

Aias00 added 2 commits August 14, 2026 05:57
Signed-off-by: liuhy <liuhongyu@apache.org>
Signed-off-by: liuhy <liuhongyu@apache.org>
@Aias00
Aias00 force-pushed the test/proxy-language-header-validation branch from 6f6debf to 2d79a49 Compare August 14, 2026 12:59
@Aias00

Aias00 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current develop and validated ClientActivityTest with the proxy module. The prior macOS compile failure will be retried by the refreshed branch.

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] Proxy gRPC telemetry maps invalid language metadata to INTERNAL

4 participants