unbridled-41 opened a new pull request, #5932:
URL: https://github.com/apache/rocketmq-dashboard/pull/5932

   ### Which Issue(s) This PR Fixes
   
   Fixes #5931
   
   ### Problem / Evidence
   
   `createTopic`/`updateTopic`/`createConsumerGroup`/`updateConsumerGroup` only 
trim the name and let the broker validate it - but the broker's check 
(`TopicValidator.validateTopic`) happens at the RPC, after the ownership row 
has been inserted:
   
   ```
   createTopic -> executeResourceWrite -> ownershipGuard.write(...) -> 
createAndUpdateTopicConfig(...)
   ```
   
   so a name the broker rejects, or one longer than the 255-character column, 
fails on the wrong side of the write: a `DataIntegrityViolationException` 
reaches the generic handler as `500 Internal Server Error`, or the claim stays 
behind as a PENDING row that the list (filtered by instance only) shows as a 
real topic with 0 queues, blocking the name for other instances.
   
   ### Root cause / Fix
   
   Missing server-side validation on a write path whose first durable step and 
whose remote step both fail opaquely. Validate with the broker's own rules 
(`TopicValidator.validateTopic`, which reports the exact rule) for topics, and 
the group bound (120 characters plus the same charset rule) for groups, at the 
top of each write path - before the ownership write and before any RPC. The 
console already enforces the same bounds client-side; this closes the server 
side and the AI-tool/import paths that bypass it.
   
   ### Priority and scoring
   
   **PRIORITY 50** — impact 18/40 (a 500 with no reason for invalid input; a 
phantom resource for a subset of it), blast radius 10/20 (direct API/AI/import 
callers, not the console), reproducibility 18/20 (deterministic, pinned by 
tests), maintenance value 4/20.
   
   **FIX_CONFIDENCE 82** — reuses the broker's validator, so the accepted set 
cannot drift from what the broker enforces.
   
   ### Tests
   
   `cd server && mvn -o -B -ntp test -Dtest='RocketMQAdminClientImplTest'` -> 
`Tests run: 83, Failures: 0, Errors: 0`.
   
   | Test | Before | After |
   |---|---|---|
   | `createTopicRejectsAnIllegalNameBeforeWritingAnythingTest` | FAIL (no 400; 
the broker call is reached) | PASS (400 + no broker call + no ownership write) |
   | `createConsumerGroupRejectsANameLongerThanTheBrokerLimitTest` | FAIL (no 
400) | PASS |
   | `createTopicKeepsTheBrokerCompatibleNamesItAcceptsTest` | PASS (guard) | 
PASS |
   
   `mvn -o -B -ntp test 
-Dtest='MetadataServiceTest,TopicControllerTest,ConsumerGroupControllerTest'` 
-> `Tests run: 100, Failures: 0, Errors: 0`; `checkstyle:check` passes.
   
   ### Risk
   
   Names that were previously accepted and then failed at the broker now fail 
earlier with the broker's message; nothing that could have succeeded is 
rejected, because the check is the broker's own.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to