Repository navigation
Conversation
AuthService.listUsers passed the raw username search into MyBatis-Plus
like("username", ...) without escaping LIKE wildcards, so a search for
"admin_" matched "adminX" and "admin%" matched any suffix.
Escape \, % and _ before building the LIKE condition, matching the
escaping already used by the message query history search.
Fixes apache#4223
Signed-off-by: jokerzsd <2701819133@qq.com>
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Good fix with proper escaping of SQL LIKE wildcards and a focused unit test. The implementation correctly handles the backslash escape ordering.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Same LIKE-wildcard escape fix applied to AuthService.listUsers. The escapeLike method is correct (backslash → percent → underscore order). Tests cover the admin_ → adminX false-positive case.
Findings
- [Info]
AuthService.java:537—escapeLikeis now duplicated across 4+ classes. Consider a shared utility to prevent drift.
LGTM.
|
Closing as a duplicate of #4224, which was opened about two hours earlier, keeps the helper |
Summary
Fix the Studio user search treating
_and%in the query as SQL LIKE wildcards.Problem
AuthService.listUserspassed the raw username search into MyBatis-Pluslike("username", ...)without escaping. A search foradmin_matchedadminXandadmin%matched any suffix. Other search paths (e.g. message query history) already escape\,%and_.Fix
Escape
\,%and_before building the LIKE condition, matching the existingescapeLikebehavior.Test plan
Added a focused
escapeLikeregression test.mvn test -Dtest=AuthServiceTest— 17 tests, 0 failures.Fixes #4223