leaveWhite9088 opened a new pull request, #11545:
URL: https://github.com/apache/rocketmq/pull/11545

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11544
   
   ### Brief Description
   
   When an ACL `PolicyEntry` defines a source IP restriction and 
`DefaultAuthorizationContext#getSourceIp()` is `null` or empty (for example, 
when a Netty channel has no remote address or a non-TCP gRPC transport omits 
`GrpcConstants.REMOTE_ADDRESS`), `Environment.of(context.getSourceIp())` 
returns `null`, causing `Environment#isMatch(null)` in 
`AclAuthorizationHandler#matchPolicyEntries` to throw `NullPointerException` 
instead of returning `false`.
   
   This PR adds a null check for `environment` in `Environment#isMatch` so it 
returns `false`, and adds a unit test in `AclAuthorizationHandlerTest`.
   
   ### How Did You Test This Change?
   
   - Ran `mvn test -pl auth -Dtest=AclAuthorizationHandlerTest` (Checkstyle: 0 
violations, SpotBugs: 0 errors, Tests run: 11, Failures: 0, Errors: 0).
   


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