You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "szlta (via GitHub)" <gi...@apache.org> on 2026/07/22 08:28:40 UTC

[PR] Catalog-level KMS configuration for Iceberg table encryption support [polaris]

szlta opened a new pull request, #5127:
URL: https://github.com/apache/polaris/pull/5127

   ## Summary
   
   Adds catalog-level KMS configuration metadata for future Iceberg table encryption support.
   
   This introduces a Polaris-managed KMS configuration surface that is separate from storage configuration. Storage configuration continues to describe where table data lives and how Polaris accesses that storage. KMS configuration describes which key-management service a catalog is allowed to use for Iceberg table encryption.
   
   See proposal document at: https://docs.google.com/document/d/1Ui5bYVci7BtEkTITxjgW7Pp9SjrTyq8pW2Z7lVt4TQA
   
   ## Motivation
   
   Iceberg table encryption is a table-format concern, not a storage-layer encryption setting like S3 SSE-KMS. A Polaris catalog may need to work with encrypted Iceberg tables whose table encryption KMS does not necessarily match the storage backend. For example, an Iceberg table stored in S3 could theoretically use a different KMS provider, or a specific AWS KMS configuration independent of the catalog's S3 storage configuration.
   
   To support this cleanly, Polaris needs catalog-level KMS metadata before wiring that configuration into encrypted Iceberg table operations.
   
   ## Changes
   
   - Adds `KmsConfigInfo` and `AwsKmsConfigInfo` to the management API.
   - Adds optional `kmsConfigInfo` to catalog create/update/read models.
   - Persists catalog KMS configuration in catalog internal properties.
   - Adds internal `PolarisKmsConfigurationInfo` and `AwsKmsConfigurationInfo` model classes.
   - Adds server-local `polaris.kms.*` runtime configuration for default and named AWS KMS credentials.
   - Adds tests for API serialization, internal KMS config serialization, and catalog round trips.
   - Adds generated configuration documentation for `polaris.kms.*`.
   
   This PR does not wire KMS configuration into `LocalIcebergCatalog` or encrypted Iceberg FileIO behavior yet. That runtime usage is intended as a follow-up once the catalog configuration contract is agreed.
   
   ## Testing
   
   Added coverage for:
   
   - Catalog JSON serialization with `kmsConfigInfo`
   - Internal KMS configuration serialization/deserialization
   - AWS KMS configuration endpoint handling
   - AWS KMS role ARN parsing
   - Catalog create/update/read round trip with KMS config
   - Catalog entity round trip from management model to persisted internal properties and back
   
   ## Checklist
   
   - [x] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact security@apache.org)
   - [x] ๐Ÿ”— Clearly explained why the changes are needed, or linked related issues: Related to the dev list discussion on Iceberg table encryption KMS configuration
   - [x] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and explained how)
   - [x] ๐Ÿ’ก Added comments for complex logic
   - [ ] ๐Ÿงพ Updated CHANGELOG.md (if needed)
   - [x] ๐Ÿ“š Updated documentation in site/content/in-dev/unreleased (if needed)


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Catalog-level KMS configuration for Iceberg table encryption support [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #5127: Catalog-level KMS configuration for Iceberg table encryption support
URL: https://github.com/apache/polaris/pull/5127


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Catalog-level KMS configuration for Iceberg table encryption support [polaris]

Posted by "flyingImer (via GitHub)" <gi...@apache.org>.
flyingImer commented on code in PR #5127:
URL: https://github.com/apache/polaris/pull/5127#discussion_r3857688020


##########
spec/polaris-management-service.yml:
##########
@@ -1234,6 +1236,62 @@ components:
       allOf:
         - $ref: '#/components/schemas/StorageConfigInfo'
 
+    KmsConfigInfo:
+      type: object
+      description: A KMS configuration used by catalogs for Iceberg table encryption
+      properties:
+        kmsType:

Review Comment:
   Is a closed kmsType enum intentional here?
   
   The KMS discussion has included custom KMS implementations, and the Iceberg KMS credential-vending work is currently modeling encryption.kms-type as an open provider identifier so catalogs and clients can support providers beyond the built-in set without first adding an upstream enum value.
   
   Since this becomes part of the Polaris management contract, I'd prefer that we settle the extension model before freezing an OSS-owned discriminator enum.



##########
spec/polaris-management-service.yml:
##########
@@ -1234,6 +1236,62 @@ components:
       allOf:
         - $ref: '#/components/schemas/StorageConfigInfo'
 
+    KmsConfigInfo:
+      type: object
+      description: A KMS configuration used by catalogs for Iceberg table encryption
+      properties:
+        kmsType:
+          type: string
+          enum:
+            - AWS
+          description: The key-management service provider type
+        kmsName:

Review Comment:
   I'm not sure kmsName should be part of the durable management contract in this form. Its documented meaning is a reference to server-local configuration, but the value is persisted with the catalog and returned through the management API. That makes the catalog dependent on every serving deployment having an identically named local configuration, and create/update cannot currently establish that invariant.
   
   Could we separate the durable KMS configuration/identity from the deployment-local credential resolution handle, or define a stable resolver/reference contract rather than persisting a bare local configuration name?



##########
spec/polaris-management-service.yml:
##########
@@ -1234,6 +1236,62 @@ components:
       allOf:
         - $ref: '#/components/schemas/StorageConfigInfo'
 
+    KmsConfigInfo:
+      type: object
+      description: A KMS configuration used by catalogs for Iceberg table encryption
+      properties:
+        kmsType:
+          type: string
+          enum:
+            - AWS
+          description: The key-management service provider type
+        kmsName:
+          type: string
+          description: An optional name referencing a server-side KMS configuration
+      required:
+        - kmsType
+      discriminator:
+        propertyName: kmsType
+        mapping:
+          AWS: "#/components/schemas/AwsKmsConfigInfo"
+
+    AwsKmsConfigInfo:
+      type: object
+      description: AWS KMS configuration info for Iceberg table encryption
+      allOf:
+        - $ref: '#/components/schemas/KmsConfigInfo'
+        - type: object
+          properties:
+            roleArn:
+              type: string
+              description: AWS role ARN used by Polaris to access AWS KMS. Optional when using node or pod identity.
+              example: "arn:aws:iam::123456789001:role/polaris-kms-role"
+            externalId:
+              type: string
+              description: An optional external ID used to establish a trust relationship with AWS in the trust policy
+            region:
+              type: string
+              description: AWS region used by AWS KMS clients
+              example: "us-east-2"
+            endpoint:
+              type: string
+              description: AWS KMS endpoint URI. Clients always see this value if it is set.
+              example: "https://kms.us-east-2.amazonaws.com"
+            endpointInternal:

Review Comment:
   It's odd to see it here. Can we define the admission policy for caller-supplied server-side KMS/STS endpoints before making these fields part of the management API?
   
   `AwsStorageConfigInfo` already gates caller-controlled `endpoint`, `endpointInternal`, and `stsEndpoint` behind `ALLOW_SETTING_S3_ENDPOINTS`. Here, `endpointInternal` and `stsEndpoint` similarly control destinations used by Polaris itself, but there is currently no equivalent validation path.
   
   The runtime consumer is not wired yet, so this is not an immediate behavior issue, but once server-side KMS access lands these fields cross into the server's network/credential boundary. I'd prefer to establish whether these overrides are allowed, and under what policy, before the API contract is frozen.
   



##########
polaris-core/src/main/java/org/apache/polaris/core/kms/aws/AwsKmsConfigurationInfo.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.kms.aws;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import java.net.URI;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.polaris.core.kms.PolarisKmsConfigurationInfo;
+import org.apache.polaris.immutables.PolarisImmutable;
+import org.immutables.value.Value;
+import org.jspecify.annotations.Nullable;
+
+/** AWS KMS configuration information. */
+@PolarisImmutable
+@JsonSerialize(as = ImmutableAwsKmsConfigurationInfo.class)
+@JsonDeserialize(as = ImmutableAwsKmsConfigurationInfo.class)
+@JsonTypeName("AwsKmsConfigurationInfo")
+public abstract class AwsKmsConfigurationInfo extends PolarisKmsConfigurationInfo {
+
+  private static final Pattern ROLE_ARN_PATTERN_COMPILED =
+      Pattern.compile("^.+:(.*):.+:.*:(.*):.+$");
+
+  public static ImmutableAwsKmsConfigurationInfo.Builder builder() {
+    return ImmutableAwsKmsConfigurationInfo.builder();
+  }
+
+  @Override
+  public KmsType getKmsType() {
+    return KmsType.AWS;
+  }
+
+  /** AWS role ARN used by Polaris to access AWS KMS, optional when using node identity. */
+  @Nullable
+  public abstract String getRoleArn();
+
+  /** AWS external ID, optional. */
+  @Nullable
+  public abstract String getExternalId();
+
+  /** AWS region used by AWS KMS clients. */
+  @Nullable
+  public abstract String getRegion();
+
+  /** AWS KMS endpoint URI, optional. */
+  @Nullable
+  public abstract String getEndpoint();
+
+  /** AWS KMS endpoint URI for Polaris server-side access, optional. */
+  @Nullable
+  public abstract String getEndpointInternal();
+
+  /** AWS STS endpoint URI, optional. */
+  @Nullable
+  public abstract String getStsEndpoint();
+
+  /** KMS key ARNs this catalog is allowed to use for Iceberg table encryption. */
+  public abstract List<String> getAllowedKeyArns();
+
+  @JsonIgnore
+  @Nullable
+  public URI getEndpointUri() {
+    return getEndpoint() == null ? null : URI.create(getEndpoint());
+  }
+
+  @JsonIgnore
+  @Nullable
+  public URI getInternalEndpointUri() {
+    return getEndpointInternal() == null ? getEndpointUri() : URI.create(getEndpointInternal());
+  }
+
+  /** Returns the STS endpoint if set, defaulting to the internal KMS endpoint otherwise. */
+  @JsonIgnore
+  @Nullable
+  public URI getStsEndpointUri() {
+    return getStsEndpoint() == null ? getInternalEndpointUri() : URI.create(getStsEndpoint());

Review Comment:
   `getStsEndpointUri()` currently falls back to the KMS endpoint when `stsEndpoint` is unset. Is that intentional?
   
   For example, with `endpointInternal=https://kms.us-east-2.amazonaws.com` and no explicit `stsEndpoint`, this method returns the KMS endpoint for STS as well. KMS and STS are separate AWS services, so a future role-assumption path consuming this value would appear to direct STS requests to the KMS endpoint.
   
   I think the STS default should either remain unset and let the AWS SDK resolve its normal endpoint, or have separately defined resolution semantics rather than inheriting the KMS endpoint.
   



##########
spec/polaris-management-service.yml:
##########
@@ -1277,6 +1335,8 @@ components:
             type: string
         storageConfigInfo:
           $ref: "#/components/schemas/StorageConfigInfo"
+        kmsConfigInfo:

Review Comment:
   How should a client remove KMS configuration after it has been set?
   
   kmsConfigInfo is optional, but the update implementation starts from the current catalog and treats an omitted/null value as "no change". This means the API can add or replace a KMS configuration but cannot return the catalog to having no KMS configuration.
   
   I think an explicit clear/unset semantic is needed before we freeze the update contract.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Catalog-level KMS configuration for Iceberg table encryption support [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5127:
URL: https://github.com/apache/polaris/pull/5127#issuecomment-5389857212

   This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Catalog-level KMS configuration for Iceberg table encryption support [polaris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5127:
URL: https://github.com/apache/polaris/pull/5127#issuecomment-5389857212

   This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org