Skip to content

Commit f3961b0

Browse files
committed
review
1 parent f843555 commit f3961b0

File tree

6 files changed

+48
-3
lines changed

6 files changed

+48
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
4141
production-ready. One new table privilege was introduced: `TABLE_REMOTE_SIGN`. To enable remote signing:
4242
1. Set the system-wide property `REMOTE_SIGNING_ENABLED` or the catalog-level `polaris.request-signing.enabled`
4343
property to `true`.
44-
2. Grant the `TABLE_REMOTE_SIGN` privilege to a catalog role. The role must also be granted the `TABLE_READ_DATA`
45-
and `TABLE_WRITE_DATA` privileges.
44+
2. Grant the `TABLE_REMOTE_SIGN` privilege to a catalog role. The catalog role must also be granted the
45+
`TABLE_READ_DATA` and `TABLE_WRITE_DATA` privileges.
4646

4747
### Upgrade notes
4848

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,14 @@ ALLOW_FEDERATED_CATALOGS_CREDENTIAL_VENDING, getResolvedCatalogEntity())) {
867867
return responseBuilder;
868868
}
869869

870+
/**
871+
* Selects the most appropriate access delegation mode from the set of modes requested by the
872+
* client.
873+
*
874+
* <p>See <a
875+
* href="https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L1858-L1859">Iceberg
876+
* REST Catalog spec</a>.
877+
*/
870878
private AccessDelegationMode selectAccessDelegationMode(
871879
Set<AccessDelegationMode> delegationModes) {
872880

@@ -875,6 +883,7 @@ private AccessDelegationMode selectAccessDelegationMode(
875883
}
876884

877885
if (delegationModes.size() == 1) {
886+
// No need to validate the mode here, it will be validated later.
878887
return delegationModes.iterator().next();
879888
}
880889

runtime/service/src/main/java/org/apache/polaris/service/catalog/io/AccessConfigProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public AccessConfig getAccessConfigForRemoteSigning(
169169
}
170170

171171
String prefix = prefixParser.catalogNameToPrefix(callContext.getRealmContext(), catalogName);
172+
// TODO M2 handle cases where the catalog server is behind a proxy
172173
URI signerUri = uriInfo.getBaseUriBuilder().path(PolarisResourcePaths.API_PATH_SEGMENT).build();
173174
String signerEndpoint = new PolarisResourcePaths(prefix).s3RemoteSigning(tableIdentifier);
174175

runtime/service/src/main/java/org/apache/polaris/service/config/ProductionReadinessChecks.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,4 +383,32 @@ public ProductionReadinessCheck checkConnectionCredentialVendors(
383383
? ProductionReadinessCheck.OK
384384
: ProductionReadinessCheck.of(errors.toArray(new Error[0]));
385385
}
386+
387+
@Produces
388+
public ProductionReadinessCheck checkRemoteSigning(FeaturesConfiguration featureConfiguration) {
389+
var errors = new ArrayList<Error>();
390+
var offending = FeatureConfiguration.REMOTE_SIGNING_ENABLED;
391+
if (Boolean.parseBoolean(featureConfiguration.defaults().get(offending.key()))) {
392+
errors.add(
393+
Error.ofSevere(
394+
"Remote signing is an experimental feature and should not be enabled in production.",
395+
format("polaris.features.\"%s\"", offending.key())));
396+
}
397+
featureConfiguration
398+
.realmOverrides()
399+
.forEach(
400+
(realmId, overrides) -> {
401+
if (Boolean.parseBoolean(overrides.overrides().get(offending.key()))) {
402+
errors.add(
403+
Error.ofSevere(
404+
"Remote signing is an experimental feature and should not be enabled in production.",
405+
format(
406+
"polaris.features.realm-overrides.\"%s\".overrides.\"%s\"",
407+
realmId, offending.key())));
408+
}
409+
});
410+
return errors.isEmpty()
411+
? ProductionReadinessCheck.OK
412+
: ProductionReadinessCheck.of(errors.toArray(new Error[0]));
413+
}
386414
}

runtime/service/src/main/java/org/apache/polaris/service/storage/s3/sign/S3RemoteSigningCatalogHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public PolarisS3SignResponse signS3Request(
128128
return s3SignResponse;
129129
}
130130

131+
// TODO M2 computing allowed locations is expensive. We should cache it.
131132
private Collection<String> getAllowedLocations(TableIdentifier tableIdentifier) {
132133

133134
if (baseCatalog.tableExists(tableIdentifier)) {
@@ -166,7 +167,12 @@ private Collection<String> getAllowedLocations(TableIdentifier tableIdentifier)
166167
}
167168

168169
private Set<PolarisStorageActions> getStorageActions(PolarisS3SignRequest s3SignRequest) {
169-
// TODO M2: better handling of DELETE and LIST
170+
// TODO M2: better mapping of request URIs to storage actions.
171+
// Disambiguate LIST vs READ or WRITE vs DELETE is not possible based on the HTTP method alone.
172+
// Examples:
173+
// - ListObjects is conceptually a LIST operation, and GetObject is conceptually a READ. But
174+
// both requests use the GET method.
175+
// - DeleteObject uses the DELETE method, but the DeleteObjects operation uses the POST method.
170176
return s3SignRequest.write()
171177
? Set.of(PolarisStorageActions.WRITE)
172178
: Set.of(PolarisStorageActions.READ);

runtime/service/src/test/java/org/apache/polaris/service/it/S3RemoteSigningMinIOIntegrationTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public Map<String, String> getConfigOverrides() {
5252
return ImmutableMap.<String, String>builder()
5353
.put("polaris.storage.aws.access-key", MINIO_ACCESS_KEY)
5454
.put("polaris.storage.aws.secret-key", MINIO_SECRET_KEY)
55+
.put("polaris.readiness.ignore-severe-issues", "true")
5556
.put("polaris.features.\"REMOTE_SIGNING_ENABLED\"", "true")
5657
.put("polaris.features.\"SUPPORTED_CATALOG_STORAGE_TYPES\"", "[\"S3\"]")
5758
.put("polaris.features.\"SKIP_CREDENTIAL_SUBSCOPING_INDIRECTION\"", "false")

0 commit comments

Comments
 (0)