roryqi commented on code in PR #14766:
URL: https://github.com/apache/gravitino/pull/14766#discussion_r4511495015
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/IcebergLoadAuthzHandlerHelper.java:
##########
@@ -84,10 +88,25 @@ static LoadContext extractLoadContext(
return new LoadContext(catalogId.namespace().level(0), catalogId.name(),
schemaId.name());
}
- static IcebergCatalogWrapper getCatalogWrapper(String catalog) {
- return IcebergRESTServerContext.getInstance()
- .catalogWrapperManager()
- .getCatalogWrapper(catalog);
+ static IcebergCatalogWrapper getCatalogWrapper(
+ String catalog, Map<EntityType, NameIdentifier> nameIdentifierMap) {
+ try {
+ return IcebergRESTServerContext.getInstance()
+ .catalogWrapperManager()
+ .getCatalogWrapper(catalog);
+ } catch (NoSuchCatalogException | IllegalArgumentException e) {
+ // A load handler resolves the backend before evaluating table/view
privileges. Do not
+ // disclose catalog existence or its provider to a caller who cannot see
the catalog.
+ if (!isAllowed(
+ nameIdentifierMap,
+
AuthorizationExpressionConstants.LOAD_CATALOG_AUTHORIZATION_EXPRESSION)) {
+ throw new ForbiddenException("Not authorized to access catalog '%s'",
catalog);
+ }
+ if (e instanceof NoSuchCatalogException) {
+ throw new NoSuchNamespaceException("No Iceberg configuration for
catalog '%s'", catalog);
Review Comment:
Addressed in ebbe10c985.
The 404 message explicitly names the catalog: `No Iceberg configuration for
catalog 'cat'`. Added response type/message assertions for both table and view
loads; callers without catalog visibility still get the generic 403. The
original cause is now preserved as well.
--
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]