Copilot commented on code in PR #5140:
URL: https://github.com/apache/polaris/pull/5140#discussion_r3658123358


##########
runtime/service/src/main/java/org/apache/polaris/service/auth/AuthenticatingAugmentor.java:
##########
@@ -61,11 +64,14 @@ public Uni<SecurityIdentity> augment(
 
   private SecurityIdentity authenticatePolarisPrincipal(SecurityIdentity 
identity) {
     PolarisPrincipal polarisPrincipal = authenticator.authenticate(identity);
+    Map<String, Object> attributes =
+        polarisPrincipal.getAttributes().entrySet().stream()
+            .collect(Collectors.toMap(entry -> entry.key().key(), 
AttributeMap.Attribute::value));

Review Comment:
   `Collectors.toMap(...)` uses `Map.merge(...)` internally, which throws if 
any collected value is `null`. `AttributeMap` explicitly allows `null` values, 
so converting attributes this way can fail at runtime when a principal 
attribute is present-but-null.



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