unbridled-41 opened a new pull request, #5428:
URL: https://github.com/apache/rocketmq-dashboard/pull/5428
Supersedes #4891, auto-closed as stale (no review comments were left on it);
the fix is rebased onto current `rocketmq-studio` and the bug is still present
there.
## Problem / Evidence
The ACL rule table offers an "ACL 1.0 / ACL 2.0" selector and the web client
sends the picked value as `aclVersion` on `GET /api/acl/rules`
(`web/src/pages/instance/acl.tsx:203`). No layer consumed it:
- `instance/acl/AclController.java` declared no `aclVersion` parameter, so
Spring dropped the unknown query parameter.
- `instance/acl/AclService.java:100` (pre-fix) passed a hardcoded `null`
into the repository's `acl_version` slot, even though
`MybatisPlusAclRepository.ruleQuery` already had the predicate
(`.eq(StringUtils.hasText(aclVersion), "acl_version", aclVersion)`).
- Selecting a version therefore changed only the query string: the table
kept every rule and the pagination total never shrank. Only the mock service
filters in memory, which is why the control looked like it worked in demo mode.
Observed before the fix with the real service between the controller and a
mocked repository, for `GET /api/acl/rules?aclVersion=1.0`:
```
Argument(s) are different! Wanted: findRulePage(null, null, null, null,
"1.0", 1, 20)
Actual invocations have different arguments at position [4]:
findRulePage(null, null, null, null, null, 1, 20)
-> at AclService.listRules(AclService.java:98)
```
## Root cause / Fix
The parameter was never bound and never forwarded. Fix: the controller binds
`aclVersion`, the service forwards it to the repository, and the role-backed
projection (Tencent), which has no `acl_version` column, filters it in memory
beside the resource/scope/decision filters it already applies. The AI ACL list
tool handler is updated for the new signature.
## Priority & scoring
PRIORITY 58 = 影响 18 (a console control silently does nothing, showing ACL
1.0 rules under an ACL 2.0 filter and a wrong total) + 波及 8 (ACL rule list,
paging and the AI tool) + 可复现 20 (deterministic for any Apache/Tencent
instance) + 维护价值 12.
FIX_CONFIDENCE 95: the repository predicate already existed; this only wires
the value through, with the role-backed path filtered in memory.
## Tests
```
cd server && mvn -o test
-Dtest='AclControllerTest,AclServiceTest,AclRuleVersionFilterWebTest,AclListToolHandlerTest'
```
- Green: `Tests run: 110, Failures: 0, Errors: 0, Skipped: 0`.
- Red with the service forwarding `null` again (signature kept, so the suite
still compiles): `AclRuleVersionFilterWebTest` fails with the "Argument(s) are
different!" diff above.
- New regressions: `AclRuleVersionFilterWebTest` (controller → service →
repository forwarding, and the role-backed in-memory filter) plus the updated
service/handler tests.
- `mvn -o checkstyle:check` passes.
## Risk
Low. The filter is additive and defaults to "no filter" when the parameter
is absent, so existing callers (including the AI tool) behave as before. Only
the previously ignored parameter now has an effect.
--
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]