You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "flyingImer (via GitHub)" <gi...@apache.org> on 2026/08/28 17:35:05 UTC

Re: [PR] Update `CatalogHandler` and `PolarisAdminServier` to `authorize` using `AuthorizationIntent` [polaris]

flyingImer commented on code in PR #5194:
URL: https://github.com/apache/polaris/pull/5194#discussion_r3882597258


##########
extensions/auth/opa/src/test/java/org/apache/polaris/extension/auth/opa/OpaPolarisAuthorizerTest.java:
##########
@@ -838,9 +864,7 @@ void authorizeResolvedCatalogTargetPreservesRootParent() throws Exception {
               {
                 "type": "CATALOG",
                 "name": "catalog-1",
-                "parents": [
-                  {"type": "ROOT", "name": "root_container", "parents": []}
-                ]
+                "parents": []
               }
               """);
       assertThat(target).isEqualTo(expectedTarget);

Review Comment:
   This test makes the GET_CATALOG payload change explicit to me: the ROOT parent is no longer sent. The same migration also removes the ROOT target from LIST_CATALOGS and splits collection requests into one OPA query per intent, **but I don't see those changes in the current CHANGELOG**. Since existing Rego policies may depend on these shapes, could we document the full set under Breaking changes before merging?
   



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogHandler.java:
##########
@@ -319,26 +300,20 @@ protected void authorizeResolvedRegisterTableOverwriteOrThrow(
             ResolvedPathKey.ofTableLike(identifier), PolarisEntitySubType.ICEBERG_TABLE, true);
 
     if (tableTarget != null) {
-      authorizer()
-          .authorizeOrThrow(
-              polarisPrincipal(),
-              resolutionManifest.getAllActivatedCatalogRoleAndPrincipalRoles(),
-              overwriteOp,
-              tableTarget,
-              null /* secondary */);
+      authorizer().authorize(authorizationState, overwriteRequest).throwIfDenied();
     } else {
       PolarisResolvedPathWrapper namespaceTarget =
           resolutionManifest.getResolvedPath(ResolvedPathKey.ofNamespace(namespace), true);
       if (namespaceTarget == null) {
         throw noSuchNamespaceException(namespace);
       }
-      authorizer()
-          .authorizeOrThrow(
+      AuthorizationRequest fallbackRequest =
+          new AuthorizationRequest(
               polarisPrincipal(),
-              resolutionManifest.getAllActivatedCatalogRoleAndPrincipalRoles(),
-              fallbackOp, // normal register-table operation
-              namespaceTarget,
-              null /* secondary */);
+              List.of(
+                  new SingleTargetAuthorizationIntent(
+                      fallbackOp, PolarisSecurableMapper.namespace(catalogName(), namespace))));
+      authorizer().authorize(authorizationState, fallbackRequest).throwIfDenied();

Review Comment:
   I think this handler flow is inconsistent with the SPI's request-selective resolution model: T
   
   he current resolution request contains only the table overwrite intent, while this branch authorizes a namespace fallback intent; the built-in authorizers mask the mismatch by calling resolveAll(). 
   
   Could we make it an invariant that every request which may reach authorize() has its required inputs covered by the preceding resolution? 
   
   One concrete option would be to construct both intents up front, pass one AuthorizationRequest containing both to resolveAuthorizationInputs, and then authorize the corresponding single-intent request after the table-existence check. A request-selective test for the table-missing branch could verify that the namespace intent was present during resolution.
   



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org