iloveeyjafjalla opened a new pull request, #6851:
URL: https://github.com/apache/rocketmq-dashboard/pull/6851

   Fixes #6850
   
   ## The defect
   
   `pushAclToBroker` resolved its broker list from the entire `brokerAddrTable` 
of the instance endpoint, while the rules view of the same page narrows that 
topology to the instance's configured cluster (#6502). On a NameServer shared 
by several clusters the push therefore installed every stored account and 
policy on the *other* cluster's brokers, and reported those upserts as 
successes in `PushAclToBrokerResultVO` and in the `PUSH_ACL_TO_BROKER` audit 
record. The pre-flight ACL 2.0 switch check read `getBrokerConfig` of an 
arbitrary broker from that unscoped list as well.
   
   ## The fix
   
   The scope now lives in one place, 
`AclBrokerScope.scopedBrokerNames(clusterInfo, configuredCluster)`, and both 
ACL paths resolve their broker set through it — the read keeps its behaviour 
and the push gains it, so they can no longer disagree. The helper carries the 
rule unchanged: an instance that names no cluster keeps every broker of the 
endpoint, and an unresolvable cluster membership fails closed with a 503 rather 
than falling back to the whole cluster table (the state 
`RocketMQClusterProvider.discoverBrokers` reports the same way).
   
   `AclService.masterAddresses(adminExt, instanceId)` now narrows first and 
maps the surviving broker names to their master addresses. Because the names 
come from a `TreeSet`, the push's broker order is the cluster's name order 
instead of a hash-table order, which makes the broker the pre-flight check runs 
against deterministic.
   
   ## Tests
   
   
`AclServiceTest.pushAclToBrokerTouchesOnlyTheConfiguredClusterOfASharedNameServerTest`
 — a two-cluster topology on one endpoint, instance bound to `cluster-a`:
   
   ```
   expected: ["10.0.0.1:10911"]
    but was: ["10.0.0.1:10911", "10.0.0.2:10911"]
   ```
   
   It also asserts that no `createUser`, `updateUser`, `updateAcl` or 
`getBrokerConfig` call reaches `10.0.0.2:10911`. 
`pushAclToBrokerKeepsEveryMasterWhenTheInstanceNamesNoClusterTest` pins the 
unchanged behaviour for an instance without a configured cluster.
   
   ```
   [INFO] Tests run: 85, Failures: 0, Errors: 0 -- AclServiceTest
   [INFO] Tests run: 27, Failures: 0, Errors: 0 -- AclControllerTest
   [INFO] Tests run: 6, Failures: 0, Errors: 0 -- ApacheAclReadServiceTest
   [INFO] You have 0 Checkstyle violations.
   ```
   
   The read side is untouched behaviourally: `ApacheAclReadServiceTest` 
(including its `sharedTopology` scoping cases and the 503 case) passes 
unchanged after the helper moved out of the service.
   


-- 
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]

Reply via email to