dimas-b commented on code in PR #4406:
URL: https://github.com/apache/polaris/pull/4406#discussion_r3223131584


##########
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:
   I do not think exposing authZ details to the client in case of denied 
responses is a good idea. This information can potentially be used by malicious 
clients to further attacks.



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