You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "89799969 (via GitHub)" <gi...@apache.org> on 2026/09/11 11:49:47 UTC

[PR] fix(alert): escape LIKE wildcards in rule name and metric search [rocketmq-dashboard]

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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alert): escape LIKE wildcards in rule name and metric search [rocketmq-dashboard]

Posted by "89799969 (via GitHub)" <gi...@apache.org>.
89799969 commented on PR #4233:
URL: https://github.com/apache/rocketmq-dashboard/pull/4233#issuecomment-5695184183

   Same mechanical fix as requested on #4224/#4230: shared `SqlLikeUtil` + explicit `ESCAPE` clause. Tests kept.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alert): escape LIKE wildcards in rule name and metric search [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4233: fix(alert): escape LIKE wildcards in rule name and metric search
URL: https://github.com/apache/rocketmq-dashboard/pull/4233


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alert): escape LIKE wildcards in rule name and metric search [rocketmq-dashboard]

Posted by "89799969 (via GitHub)" <gi...@apache.org>.
89799969 commented on PR #4233:
URL: https://github.com/apache/rocketmq-dashboard/pull/4233#issuecomment-5695286375

   @lizhimins Following up - shared `SqlLikeUtil` + explicit `ESCAPE` is pushed (`6f89b257`) and this branch is `MERGEABLE/CLEAN` on current `rocketmq-studio`. Ready for re-review.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org