[ISSUE #10795] Validate proxy check client config - #10796
Conversation
There was a problem hiding this comment.
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.
This PR tightens proxy-side validation for CHECK_CLIENT_CONFIG by validating subscription filter requests (TAG vs SQL/property) and aligning behavior with broker defaults, plus adding regression tests.
Changes:
- Add request-body decoding and validation in
ClientManagerActivity#checkClientConfig(accept TAG, reject/validate SQL/property). - Introduce
enablePropertyFilterproxy config gate for SQL/property filter checks. - Add unit tests covering TAG acceptance, disabled property filter rejection, and invalid SQL parse failures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java | Decode and validate CHECK_CLIENT_CONFIG bodies; gate SQL/property filters behind config and compile expressions. |
| proxy/src/main/java/org/apache/rocketmq/proxy/config/ProxyConfig.java | Add enablePropertyFilter configuration flag and accessors. |
| proxy/src/test/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivityTest.java | Add regression tests for TAG acceptance, disabled property filter handling, and SQL parse failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CheckClientRequestBody requestBody = CheckClientRequestBody.decode(request.getBody(), | ||
| CheckClientRequestBody.class); | ||
| if (requestBody != null && requestBody.getSubscriptionData() != null) { |
| log.warn("Client {}@{} filter message, but failed to compile expression! sub={}, error={}", | ||
| requestBody.getClientId(), requestBody.getGroup(), requestBody.getSubscriptionData(), e.getMessage()); | ||
| response.setCode(ResponseCode.SUBSCRIPTION_PARSE_FAILED); | ||
| response.setRemark(e.getMessage()); | ||
| return response; |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10796 +/- ##
=============================================
- Coverage 48.60% 48.51% -0.10%
+ Complexity 13690 13654 -36
=============================================
Files 1381 1381
Lines 101464 101497 +33
Branches 13187 13191 +4
=============================================
- Hits 49318 49237 -81
- Misses 46158 46239 +81
- Partials 5988 6021 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Adds validation for proxy client configuration checks, preventing silent failures when config is invalid. Good defensive improvement with clear error messages.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM — defensive improvement with proper validation and test coverage.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Defensive fix with proper validation and test coverage. LGTM.
Automated review by github-manager-bot
|
Rebased onto the latest develop and verified the requested review coverage. The PR now handles null/decode-failed bodies with a structured response, retains decode stack traces, explains how to enable property filtering, restores the global flag in @after, and covers a valid enabled SQL92 expression. Verified with: mvn -q -pl proxy -am -Dtest=ClientManagerActivityTest -Dsurefire.failIfNoSpecifiedTests=false test |
f5f6f3b to
2e29e36
Compare
|
Rebased onto the latest develop and verified the requested review coverage. The PR handles null/decode-failed bodies with a structured response, retains decode stack traces, explains how to enable property filtering, restores the global flag in @after, and covers a valid enabled SQL92 expression. Verified with: mvn -q -pl proxy -am -Dtest=ClientManagerActivityTest -Dsurefire.failIfNoSpecifiedTests=false test |
Which Issue(s) This PR Fixes
Fixes #10795
Brief Description
CHECK_CLIENT_CONFIGrequest bodies instead of always returning successenablePropertyFilteris disabled, matching the default broker behaviorSUBSCRIPTION_PARSE_FAILEDon parse errorsHow Did You Test This Change?
mvn -pl proxy -Dtest=ClientManagerActivityTest testThe target test passed: 3 tests, 0 failures, 0 errors. The Maven run completed with BUILD SUCCESS; the output still includes existing Jacoco/JDK17 instrumentation warnings.