Frun1na opened a new issue, #6084: URL: https://github.com/apache/rocketmq-dashboard/issues/6084
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below. ### Studio Version branch: `rocketmq-studio` git commit id: `5e4c39b0` deployed as: reproduced by unit tests against that commit (the affected code is the backend service) ### Runtime Environment OS: Ubuntu on WSL2 MySQL: not applicable — the defect is the missing pre-write bound in `MetadataService`; the column it would overflow is declared in `db/schema.sql` browser: not applicable — reproduced in a JUnit 5 service test ### Connected RocketMQ Cluster RocketMQ version: not applicable — reproduced with a stubbed provider in a unit test; the failing write is Studio's own registration row, not the broker call access mode: not applicable deployment: not applicable ### Describe the Bug The instance write path bounds its free text to the widths the schema declares (#4713), but the topic and consumer-group write paths do not bound the text they store: - `MetadataService.requireTopic` (`server/src/main/java/org/apache/rocketmq/studio/instance/topic/MetadataService.java:708`) validates only that the topic name is non-blank, and never looks at `remark`. - `CreateTopicDTO` / `UpdateTopicDTO` declare `@NotBlank` on `name` and no constraint at all on `remark`; `CreateConsumerGroupDTO` has no length bound on `name`. - Those values are stored in `rmq_instance_topic` (`name VARCHAR(255)`, `remark VARCHAR(255)`) and `rmq_instance_group` (`name VARCHAR(255)`) — `server/src/main/resources/db/schema.sql:128`, `:133`, `:149`. - `ResourceOwnershipGuard.write` inserts the claim first, and the Apache provider updates the same row with the remark afterwards, so an oversized value is rejected by MySQL, not by the request: MySQL strict mode raises "Data too long for column". `GlobalExceptionHandler` specializes `BusinessException` and the request-validation exceptions only, so the `DataIntegrityViolationException` falls through to `@ExceptionHandler(Exception.class)` (`server/src/main/java/org/apache/rocketmq/studio/common/exception/GlobalExceptionHandler.java:109`) and the API answers **500 Internal Server Error**. A 255-character value is stored unchanged, so the limit is the column width, not a deliberate business rule. ### Steps to Reproduce 1. `POST /api/topics/create` with a remark longer than 255 characters (the console does not cap the field): ```json {"instanceId": "instance-a", "name": "orders", "remark": "<256 characters>"} ``` 2. Without a running server, the same input reaches the same code path from a unit test: `metadataService.createTopic("instance-a", topic)` with `topic.setRemark("r".repeat(256))`. ### What Did You Expect to See? `400 Bad Request` naming the field and its limit, the way the instance path already answers for the same class of input. ### What Did You See Instead? The service accepts the value, the insert/update is rejected by the persistence layer, and the request ends as `500 Internal Server Error`. ### Additional Context A fix with a regression test follows in a pull request. ### Are You Willing to Submit a Pull Request? - [x] Yes, I am willing to submit a pull request. -- 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]
