89799969 opened a new pull request, #4233: URL: https://github.com/apache/rocketmq-dashboard/pull/4233
## What is the purpose of the change Fixes #4232. Alert-rule inventory search treats `%` and `_` as SQL LIKE wildcards instead of literal characters: - `GET /api/alert-rules/page?search=` / `GET /api/business-alert-rules/page?search=` filter `name` with unescaped `LIKE` (`MybatisPlusAlertRepository.ruleQuery`). - Domain-scoped paging (`AlertRuleQuery.search`) filters `name` and `metric` the same way (`MybatisPlusAlertRepository.findRulesPage`). Alert-rule names and metric identifiers commonly contain underscores (`consumer_lag`, `disk_usage`). Searching for `consumer_lag` therefore also matches `consumerXlag`, and a trailing `%` matches any suffix — so the inventory silently returns unrelated rules or hides the intended one. ## Brief changelog - Add a private `escapeLike` helper (same behaviour as the existing `QueryHistoryService.escapeLike`) and apply it to the legacy name-only page search and the domain page name/metric search. - Two regression tests assert the bound LIKE value for `prod_lag%` / `consumer_lag%` is escaped (`%prod\_lag\%%`) rather than treated as a wildcard pattern. ## Verifying this change ``` $ mvn -f server/pom.xml test -Dtest='Alert*Test,MybatisPlusAlertRepositoryTest' [INFO] Tests run: 198, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS ``` Checkstyle: 0 violations (module validate phase). Before the fix the two new tests fail because the bound parameters are `%prod_lag%` / `%consumer_lag%`; after it they bind `%prod\_lag\%%` / `%consumer\_lag\%%`. Related peers: #4229/#4230 (ACL inventory), #4223/#4224 (Studio user search), #4192–#4194 (audit / instance / cloud-credential LIKE escape). -- 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]
