flyrain commented on code in PR #4406:
URL: https://github.com/apache/polaris/pull/4406#discussion_r3230687083


##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizerImpl.java:
##########
@@ -902,13 +903,18 @@ public void authorizeOrThrow(
           .atDebug()
           .addKeyValue("principalName", polarisPrincipal.getName())
           .log("Root principal allowed to reset credentials");
-    } else if (!isAuthorized(polarisPrincipal, activatedEntities, authzOp, 
targets, secondaries)) {
-      throw new ForbiddenException(
-          "Principal '%s' with activated PrincipalRoles '%s' and activated 
grants via '%s' is not authorized for op %s",
-          polarisPrincipal.getName(),
-          polarisPrincipal.getRoles(),
-          
activatedEntities.stream().map(PolarisEntityCore::getName).collect(Collectors.toSet()),
-          authzOp);
+    } else {
+      List<MissingPrivilege> missing =
+          findMissingPrivileges(polarisPrincipal, activatedEntities, authzOp, 
targets, secondaries);
+      if (!missing.isEmpty()) {
+        throw new ForbiddenException(
+            "Principal '%s' with activated PrincipalRoles '%s' and activated 
grants via '%s' is not authorized for op %s; missing %s",

Review Comment:
   Agreed with @dimas-b. Deny responses should just tell the caller that 
they're denied, not the shape of the wall they're hitting. Instead, logging the 
missing privileges should be good.  



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