[ISSUE #9966] Propagate policy type for ACL deletion#10428
[ISSUE #9966] Propagate policy type for ACL deletion#10428skt-shinyruo wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #10428 +/- ##
=============================================
- Coverage 48.05% 47.98% -0.07%
+ Complexity 13303 13297 -6
=============================================
Files 1377 1377
Lines 100611 100653 +42
Branches 12991 12997 +6
=============================================
- Hits 48347 48302 -45
- Misses 46348 46422 +74
- Partials 5916 5929 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
oss-sentinel-ai
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
This PR fixes the ACL deletion path to properly propagate the policyType parameter from mqadmin to broker. Previously, the DeleteAclRequestHeader supported policyType, but the delete path did not populate it, causing broker-side handling to fall back to PolicyType.CUSTOM and preventing deletion of Default type ACLs.
Findings
- [Good] DeleteAclSubCommand.java:66-69 — Added
-t/--policyTypeoption to command line interface. - [Good] DeleteAclSubCommand.java:90-94 — Parse and normalize policyType from command line.
- [Good] DeleteAclSubCommand.java:123-132 — Added
normalizePolicyType()helper method with proper validation. - [Good] MQClientAPIImpl.java:3659-3665 — Added overloaded
deleteAcl()method accepting policyType parameter. - [Good] DeleteAclRequestHeader.java:39-44 — Added constructor accepting policyType parameter.
- [Good] DefaultMQAdminExt/DefaultMQAdminExtImpl/MQAdminExt — Added corresponding method signatures.
- [Good] AuthorizationMetadataManagerTest.java:161-189 — Enhanced test coverage for deleting ACLs with different policy types.
- [Good] AdminBrokerProcessorTest.java:1191-1216 — Added test for deleteAcl with policyType parameter.
- [Good] MQClientAPIImplTest.java — Added client-side test coverage.
Analysis
The changes are well-structured and follow existing code patterns:
- Backward compatibility: Existing method signatures are preserved, new overloads added.
- Parameter validation:
normalizePolicyType()validates input and throwsIllegalArgumentExceptionfor invalid values. - Test coverage: Comprehensive tests added at client, broker, and auth layers.
- Documentation: Command line option properly documented.
Suggestions
- Consider adding a note in the PR description about the default behavior when policyType is not specified (falls back to CUSTOM).
- The
normalizePolicyType()method could potentially be reused in other ACL commands (create/update) for consistency.
Verdict
✅ Approved — Well-designed fix with proper backward compatibility and comprehensive test coverage.
Automated review by github-manager-bot
Summary
policyTypeparameter to the ACL delete path in mqadmin, admin, client, and remoting request headerpolicyTypeis not provided, while allowingmqadmin deleteAclto targetPolicyType=DefaultRoot Cause
DeleteAclRequestHeadersupportspolicyType, but the delete path from mqadmin to broker did not populate it. When the field is absent, broker-side delete handling falls back toPolicyType.CUSTOM, so deleting aDEFAULTpolicy entry cannot target the intended ACL rule.Test Plan
mvn -o -pl tools -am -DskipTests compilemvn -o -pl client -am -DfailIfNoTests=false -Dtest=MQClientAPIImplTest#testDeleteAcl+testDeleteAclWithPolicyType testmvn -o -pl broker -am -DfailIfNoTests=false -Dtest=AdminBrokerProcessorTest#testDeleteAcl+testDeleteAclWithPolicyType testmvn -o -pl auth -am -DfailIfNoTests=false -Dtest=AuthorizationMetadataManagerTest#deleteAcl testCloses #9966