yuqi1129 commented on code in PR #14766:
URL: https://github.com/apache/gravitino/pull/14766#discussion_r4510143248
##########
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);
+ }
+ throw new BadRequestException("%s", e.getMessage());
Review Comment:
Nit (non-blocking): could we preserve the original cause when translating
these lookup failures, including the missing-catalog branch above? For example,
`new BadRequestException(e, "%s", e.getMessage())` retains the diagnostic chain
while keeping the client-facing status and message. Currently the conversion
drops the original lookup/initialization stack, and the error mapper only logs
the translated message at INFO.
##########
docs/statistics.md:
##########
@@ -33,7 +33,7 @@ you choose.
A reserved statistic is one Gravitino defines, such as `row_count`. The set
can grow in future
releases, so reserved names are not available for your own use.
-A custom statistic is yours, and its name must begin with `custom.` to keep it
clear of anything
+A custom statistic is yours, and its name must begin with `custom-` to keep it
clear of anything
Review Comment:
Nit (non-blocking): while correcting the prefix, could we also synchronize
the remaining naming guidance? `Statistic.reserved()` Javadoc still says
`custom.` (it could reference `CUSTOM_PREFIX`), and the next sentence here says
the prefix is the only naming rule, although `StatisticOperations` also
enforces `Statistic.MAX_NAME_LENGTH` (128 characters). These are existing
documentation gaps; they do not block the runtime fixes in this PR.
--
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]