Conversation
…arch The data source search (MybatisPlusSettingsRepository.findDataSources) and the Apache topic/group search (RocketMQMetadataProvider) passed raw user search strings into MyBatis-Plus like(), so % and _ were treated as SQL LIKE wildcards and a search could silently match unrelated rows. Introduce a shared SqlLikeUtils.escape helper and apply it to the remaining unescaped LIKE predicates, matching the escaping already used by the message query history search. Signed-off-by: jokerzsd <2701819133@qq.com>
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. Good catch on the remaining unescaped like() predicates. Extracting SqlLikeUtils.escape into a shared helper is the right call — it centralizes the escaping logic and prevents future regressions. The test coverage for edge cases (backslash, percent, underscore, empty/null) is solid.
Automated review by github-manager-bot
|
Closing, but please read this one as a request to resubmit rather than a rejection of the approach. Putting the helper in Add the explicit |
Summary
Escape SQL LIKE wildcards in two remaining search paths that were not covered by the earlier per-surface fixes (#4223, #4229, #4192, #4193, #4194, #4232).
Problem
MybatisPlusSettingsRepository.findDataSourcespassed the raw search string intolike("json", ...).RocketMQMetadataProviderpassed the raw search string intolike(RmqTopic::getName, ...)/like(RmqGroup::getName, ...).Topic/group names and data source content can contain
%and_, so a search treated those as LIKE wildcards and silently matched unrelated rows.Fix
Introduce a shared
SqlLikeUtils.escapehelper (extracted from the escaping already used byQueryHistoryService) and apply it to the remaining unescaped predicates.Test plan
Added
SqlLikeUtilsTest.mvn test -Dtest=SqlLikeUtilsTest— 2 tests, 0 failures.