Skip to content

Commit 4c904b5

Browse files
committed
Add change log and a new feature flag
1 parent ac4ccfc commit 4c904b5

File tree

4 files changed

+53
-28
lines changed

4 files changed

+53
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
4343
- The `ENABLE_SUB_CATALOG_RBAC_FOR_FEDERATED_CATALOGS` was added to support sub-catalog (initially namespace and table) RBAC for federated catalogs.
4444
The setting can be configured on a per-catalog basis by setting the catalog property: `polaris.config.enable-sub-catalog-rbac-for-federated-catalogs`.
4545
The realm-level feature flag `ALLOW_SETTING_SUB_CATALOG_RBAC_FOR_FEDERATED_CATALOGS` (default: true) controls whether this functionality can be enabled or modified at the catalog level.
46+
- Support credential vending for federated catalogs. `ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING` (default: true) was added to toggle this feature.
4647

4748
- Added support for S3-compatible storage that does not have STS (use `stsUavailable: true` in catalog storage configuration)
4849

polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,13 @@ public static void enforceFeatureEnabledOrThrow(
429429
"When true, enables finer grained update table privileges which are passed to the authorizer for update table operations")
430430
.defaultValue(true)
431431
.buildFeatureConfiguration();
432+
433+
public static final FeatureConfiguration<Boolean> ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING =
434+
PolarisConfiguration.<Boolean>builder()
435+
.key("ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING")
436+
.catalogConfig("polaris.config.allow-federated-catalogs-credential-vending")
437+
.description(
438+
"If set to true (default), allow credential vending for external catalogs. Note this requires ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING to be true first.")
439+
.defaultValue(true)
440+
.buildFeatureConfiguration();
432441
}

runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package org.apache.polaris.service.catalog.iceberg;
2020

21-
import static org.apache.polaris.core.config.FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING;
21+
import static org.apache.polaris.core.config.FeatureConfiguration.ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING;
2222
import static org.apache.polaris.core.config.FeatureConfiguration.LIST_PAGINATION_ENABLED;
2323
import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS;
2424

@@ -426,6 +426,12 @@ public void authorizeCreateTableDirect(
426426
PolarisAuthorizableOperation.CREATE_TABLE_DIRECT_WITH_WRITE_DELEGATION,
427427
TableIdentifier.of(namespace, request.name()));
428428
}
429+
430+
CatalogEntity catalog = getResolvedCatalogEntity();
431+
if (catalog.isStaticFacade()) {
432+
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
433+
}
434+
checkAllowExternalCatalogCredentialVending(delegationModes);
429435
}
430436

431437
public LoadTableResponse createTableDirect(
@@ -436,10 +442,6 @@ public LoadTableResponse createTableDirect(
436442

437443
authorizeCreateTableDirect(namespace, request, delegationModes);
438444

439-
CatalogEntity catalog = getResolvedCatalogEntity();
440-
if (catalog.isStaticFacade()) {
441-
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
442-
}
443445
request.validate();
444446

445447
TableIdentifier tableIdentifier = TableIdentifier.of(namespace, request.name());
@@ -550,6 +552,12 @@ private void authorizeCreateTableStaged(
550552
PolarisAuthorizableOperation.CREATE_TABLE_STAGED_WITH_WRITE_DELEGATION,
551553
TableIdentifier.of(namespace, request.name()));
552554
}
555+
556+
CatalogEntity catalog = getResolvedCatalogEntity();
557+
if (catalog.isStaticFacade()) {
558+
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
559+
}
560+
checkAllowExternalCatalogCredentialVending(delegationModes);
553561
}
554562

555563
public LoadTableResponse createTableStaged(
@@ -560,10 +568,6 @@ public LoadTableResponse createTableStaged(
560568

561569
authorizeCreateTableStaged(namespace, request, delegationModes);
562570

563-
CatalogEntity catalog = getResolvedCatalogEntity();
564-
if (catalog.isStaticFacade()) {
565-
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
566-
}
567571
TableIdentifier ident = TableIdentifier.of(namespace, request.name());
568572
TableMetadata metadata = stageTableCreateHelper(namespace, request);
569573

@@ -728,23 +732,7 @@ private Set<PolarisStorageActions> authorizeLoadTable(
728732
read, PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier);
729733
}
730734

731-
CatalogEntity catalogEntity = getResolvedCatalogEntity();
732-
733-
LOGGER.info("Catalog type: {}", catalogEntity.getCatalogType());
734-
LOGGER.info(
735-
"allow external catalog credential vending: {}",
736-
realmConfig.getConfig(
737-
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING, catalogEntity));
738-
if (catalogEntity
739-
.getCatalogType()
740-
.equals(org.apache.polaris.core.admin.model.Catalog.TypeEnum.EXTERNAL)
741-
&& !realmConfig.getConfig(
742-
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING, catalogEntity)) {
743-
throw new ForbiddenException(
744-
"Access Delegation is not enabled for this catalog. Please consult applicable "
745-
+ "documentation for the catalog config property '%s' to enable this feature",
746-
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING.catalogConfig());
747-
}
735+
checkAllowExternalCatalogCredentialVending(delegationModes);
748736

749737
return actionsRequested;
750738
}
@@ -814,13 +802,14 @@ private LoadTableResponse.Builder buildLoadTableResponseWithDelegationCredential
814802
CatalogUtils.findResolvedStorageEntity(resolutionManifest, tableIdentifier);
815803

816804
if (resolvedStoragePath == null) {
817-
LOGGER.debug("Unable to find storage configuration information for table {}", tableIdentifier);
805+
LOGGER.debug(
806+
"Unable to find storage configuration information for table {}", tableIdentifier);
818807
return responseBuilder;
819808
}
820809

821810
if (baseCatalog instanceof IcebergCatalog
822811
|| realmConfig.getConfig(
823-
ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING, getResolvedCatalogEntity())) {
812+
ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING, getResolvedCatalogEntity())) {
824813
AccessConfig accessConfig =
825814
accessConfigProvider.getAccessConfig(
826815
callContext,
@@ -1223,6 +1212,31 @@ private EnumSet<PolarisAuthorizableOperation> getUpdateTableAuthorizableOperatio
12231212
}
12241213
}
12251214

1215+
private void checkAllowExternalCatalogCredentialVending(
1216+
EnumSet<AccessDelegationMode> delegationModes) {
1217+
1218+
if (delegationModes.isEmpty()) {
1219+
return;
1220+
}
1221+
CatalogEntity catalogEntity = getResolvedCatalogEntity();
1222+
1223+
LOGGER.info("Catalog type: {}", catalogEntity.getCatalogType());
1224+
LOGGER.info(
1225+
"allow external catalog credential vending: {}",
1226+
realmConfig.getConfig(
1227+
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING, catalogEntity));
1228+
if (catalogEntity
1229+
.getCatalogType()
1230+
.equals(org.apache.polaris.core.admin.model.Catalog.TypeEnum.EXTERNAL)
1231+
&& !realmConfig.getConfig(
1232+
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING, catalogEntity)) {
1233+
throw new ForbiddenException(
1234+
"Access Delegation is not enabled for this catalog. Please consult applicable "
1235+
+ "documentation for the catalog config property '%s' to enable this feature",
1236+
FeatureConfiguration.ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING.catalogConfig());
1237+
}
1238+
}
1239+
12261240
@Override
12271241
public void close() throws Exception {
12281242
if (baseCatalog instanceof Closeable closeable) {

runtime/spark-tests/src/intTest/java/org/apache/polaris/service/spark/it/CatalogFederationIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public Map<String, String> getConfigOverrides() {
4040
.put("polaris.features.\"ALLOW_DROPPING_NON_EMPTY_PASSTHROUGH_FACADE_CATALOG\"", "true")
4141
.put("polaris.features.\"SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION\"", "false")
4242
.put("polaris.features.\"ALLOW_EXTERNAL_CATALOG_CREDENTIAL_VENDING\"", "true")
43+
.put("polaris.features.\"ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING\"", "true")
4344
.put("polaris.storage.aws.access-key", CatalogFederationIntegrationTest.MINIO_ACCESS_KEY)
4445
.put("polaris.storage.aws.secret-key", CatalogFederationIntegrationTest.MINIO_SECRET_KEY)
4546
.build();

0 commit comments

Comments
 (0)