yyqdbngt opened a new pull request, #4670: URL: https://github.com/apache/rocketmq-dashboard/pull/4670
<!-- Base branch: `rocketmq-studio`, the RocketMQ Studio trunk. --> ### Which Issue(s) This PR Fixes - No open issue; small self-contained defect found while auditing the ACL rule list (same defect class as #911 / #3307 for the topic and consumer-group searches). ### Brief Description `AclService.listRules` passed the `principal` and `resource` query terms through untouched, while the sibling user search (`AclService.pageUsers`) trims its keyword before using it. A padded term — easy to produce by pasting into the search box — therefore reached the repository's `LIKE` filter (and the Tencent in-memory filter) with the whitespace included, so `" role-a "` could never match `role-a` and the rule table came back empty. Both terms are now trimmed once, before either path. ### How Did You Test This Change? Two new `AclServiceTest` cases: one pins the term the repository receives for an Apache instance, the other pins the term the Tencent filter receives and asserts the padded search still returns the matching rule. Red - on the unmodified base: ``` $ cd server && mvn -B -ntp test -Dtest=AclServiceTest [ERROR] Tests run: 80, Failures: 2, Errors: 0, Skipped: 0 [ERROR] AclServiceTest.listRulesShouldTrimTheSearchTermsBeforeQueryingTheRepository:1098 [ERROR] AclServiceTest.listRulesShouldMatchPaddedSearchTermsOnTencentInstances:1115 [ERROR] Tests run: 80, Failures: 2, Errors: 0, Skipped: 0 [INFO] BUILD FAILURE ``` Green - after the fix, including the 78 pre-existing cases of the class and checkstyle: ``` $ cd server && mvn -B -ntp test -Dtest=AclServiceTest [INFO] You have 0 Checkstyle violations. [INFO] Tests run: 80, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS ``` ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / `refactor:` / `chore:` / `docs:` / `perf:`) - [x] Tests added or updated for non-trivial changes, test methods named `...Test` - [x] New UI text has both Chinese and English entries under `web/src/i18n/` (no UI text is added) - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit checks) - [x] New source files carry the ASF license header (no new source file) - [x] Documentation touched where behaviour changed (no README / `docs/` page documents this filter) -- 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]
