roryqi commented on code in PR #14766:
URL: https://github.com/apache/gravitino/pull/14766#discussion_r4511492929
##########
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:
Addressed in ebbe10c985.
Preserved the original cause in both the 400 and missing-catalog 404
translations. Added regression assertions for the cause and unchanged message.
##########
iceberg/iceberg-common/src/main/java/org/apache/gravitino/iceberg/common/ops/IcebergCatalogWrapper.java:
##########
@@ -265,6 +266,16 @@ public void reloadHadoopConf() {
public LoadTableResponse createTable(Namespace namespace, CreateTableRequest
request) {
request.validate();
validateTableDefinition(request);
+ if (request.location() != null &&
S3FileIO.class.getName().equals(fileIOImpl())) {
Review Comment:
Addressed in ebbe10c985.
Moved the S3 scheme/bucket check into a shared helper used by create,
register metadata locations, metadata reads during registration, and
`SetLocation` updates. Added invalid-location and supported `s3`/`s3a`/`s3n`
scheme regressions for registration and updates.
--
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]