You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by "dimas-b (via GitHub)" <gi...@apache.org> on 2024/08/26 16:56:02 UTC

[PR] Correct the handling of access delegation mode [polaris]

dimas-b opened a new pull request, #211:
URL: https://github.com/apache/polaris/pull/211

   # Description
   
   Iceberg REST API spec defines two possible values for the `X-Iceberg-Access-Delegation`:
   * vended-credentials
   * remote-signing
   
   This change fixes Polaris docs to use the `vended-credentials` value instead of previous (incorrect) value of `true` and makes the REST API service validate the `X-Iceberg-Access-Delegation` header submitted by the client against the spec.
   
   Note: since old docs suggested invalid `X-Iceberg-Access-Delegation` header values (the string `true`), clients configured according to the old docs will _not_ be able to connect to the updated servers. Technically this is a breaking change, but it is necessary to align to the REST API spec. The old suggested value of `true` cannot be interpreted according to the spec, so it will result in error responses to the misconfigured clients.
   
   Detailed changes:
   
   * Add `AccessDelegationMode` enum to parse and represent specified
     delegation modes in java.
       
   * Update `IcebergCatalogAdapter` to validate that if access
     delegation is supported by the client, that "vended-credentials"
     is accepted ("remote-signing" is not supported by the server).
       
   * Remove unused method parameters.
   
   * Re-generate docs
   
   ## Type of change
   
   Please delete options that are not relevant.
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [x] Documentation update
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [x] This change requires a documentation update
   
   # How Has This Been Tested?
   
   Existing and new unit tests
   
   # Checklist:
   
   Please delete options that are not relevant.
   
   - [x] I have performed a self-review of my code
   - [x] I have commented my code, particularly in hard-to-understand areas
   - [x] I have made corresponding changes to the documentation


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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1733299418


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   After some offline thinking, I will add backward compatibility support for `true` presently.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

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


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   Makes sense, I think that's a decent tradeoff for now since "true" was unfortunately exposed through docs for awhile so this would facilitate migrating some initial proofs-of-concept for now.
   
   I agree with having strict validation in general, and agree erroring on unsupported `remote-signing` or any other invalid values for now is a good idea since it's easier to relax such behaviors than tighten in the future.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "collado-mike (via GitHub)" <gi...@apache.org>.
collado-mike commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731539002


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   For backward compatibility, can we support "true" for the time being? 



##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.service.catalog;
+
+import static org.apache.polaris.service.catalog.AccessDelegationMode.*;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.REMOTE_SIGNING;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.fromProtocolValuesList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.EnumSet;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+class AccessDelegationModeTest {

Review Comment:
   javadoc



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731980785


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.service.catalog;
+
+import com.google.common.base.Functions;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Represents access mechanisms defined in the Iceberg REST API specification (values for the {@code
+ * X-Iceberg-Access-Delegation} header).
+ */
+public enum AccessDelegationMode {
+  UNKNOWN("unknown"),
+  VENDED_CREDENTIALS("vended-credentials"),
+  REMOTE_SIGNING("remote-signing"),
+  ;
+
+  AccessDelegationMode(String protocolValue) {
+    this.protocolValue = protocolValue;
+  }
+
+  private String protocolValue;

Review Comment:
   Good catch - fixed



##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {
+      throw new IllegalArgumentException(
+          "Unsupported access delegation mode: " + accessDelegationMode);
+    }

Review Comment:
   updated



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on PR #211:
URL: https://github.com/apache/polaris/pull/211#issuecomment-2316653004

   @dimas-b Sorry about this but could you please rebase? Please ping me when you do so I can merge


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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

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


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.service.catalog;
+
+import com.google.common.base.Functions;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Represents access mechanisms defined in the Iceberg REST API specification (values for the {@code
+ * X-Iceberg-Access-Delegation} header).
+ */
+public enum AccessDelegationMode {
+  UNKNOWN("unknown"),
+  VENDED_CREDENTIALS("vended-credentials"),
+  REMOTE_SIGNING("remote-signing"),
+  ;
+
+  AccessDelegationMode(String protocolValue) {
+    this.protocolValue = protocolValue;
+  }
+
+  private String protocolValue;

Review Comment:
   Can we make it final?



##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {
+      throw new IllegalArgumentException(
+          "Unsupported access delegation mode: " + accessDelegationMode);
+    }

Review Comment:
   Minor suggestion: using `Preconditions.checkArgument()`?



##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {
+      throw new IllegalArgumentException(
+          "Unsupported access delegation mode: " + accessDelegationMode);
+    }

Review Comment:
   Also I think we shouldn't throw in case of empty, as the callers will do something differently for empty `delegationModes`. 
   https://github.com/polaris-catalog/polaris/blob/main/polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java#L197-L197



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

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


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/AccessDelegationMode.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.service.catalog;
+
+import com.google.common.base.Functions;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Represents access mechanisms defined in the Iceberg REST API specification (values for the {@code
+ * X-Iceberg-Access-Delegation} header).
+ */
+public enum AccessDelegationMode {
+  UNKNOWN("unknown"),
+  VENDED_CREDENTIALS("vended-credentials"),
+  REMOTE_SIGNING("remote-signing"),
+  ;
+
+  AccessDelegationMode(String protocolValue) {
+    this.protocolValue = protocolValue;
+  }
+
+  private final String protocolValue;
+
+  public String protocolValue() {
+    return protocolValue;
+  }
+
+  public static EnumSet<AccessDelegationMode> fromProtocolValuesList(String protocolValues) {
+    if (protocolValues == null || protocolValues.isEmpty()) {
+      return EnumSet.noneOf(AccessDelegationMode.class);
+    }
+
+    // Backward-compatibility case for old clients that still use the unofficial value of `true` to
+    // request credential vending. Note that if the client requests `true` among other values it
+    // will be parsed as `UNKNOWN` (by the code below this `if`) since the client submitting
+    // multiple access modes is expected to be aware of the Iceberg REST API spec.
+    if (protocolValues.trim().toLowerCase(Locale.ROOT).equals("true")) {
+      return EnumSet.of(VENDED_CREDENTIALS);
+    }

Review Comment:
   This isn't a blocker for this PR, but I think we need a plan to deprecate it. 



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731610083


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   We could, but is it critical enough to justify carrying this baggage forward? Note that `true` is an invalid header values according to the Iceberg REST Catalog spec and Polaris is not released yet.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731929861


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   > The server may choose to supply access via any or none of the requested mechanisms.
   
   My reading of this is that if the client specifies some access modes via the header, the server must use zero, one or more of them. The server may not use a delegation mode that the client did not request (for the client may not be able to handle it).
   
   In this PR, if the client does not request any delegation mode, the server will _not_ use "vended credentials" (same as before). If the client sends "vended credentials" and something else, the server will use "vended credentials" (same as before).
   
   If the client requests `true` - that will lead to an error response (change in behaviour).
   
   If the client requests only `remote signing` - that will lead to an error response (change in behaviour). Previously, the server would still use "vended credentials", so this is a bug fix, IMHO.
   
   I'm not against adding config for more lenient processing, but given that there's no released Polaris version that supported old values, I think we can use simpler and stricter validation logic. It is easier to relax conditions after a release than tighten them if we have to.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731610083


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   We could, but is it critical enough to justify carrying this baggage forward? Note that `true` is an invalid header value according to the Iceberg REST Catalog spec and Polaris is not released yet.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

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


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {
+      throw new IllegalArgumentException(
+          "Unsupported access delegation mode: " + accessDelegationMode);
+    }

Review Comment:
   Also I think we shouldn't throw in case of empty, as the callers will do something differently for empty `delegationModes`. 
   https://github.com/polaris-catalog/polaris/blob/main/polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java#L197-L197



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "collado-mike (via GitHub)" <gi...@apache.org>.
collado-mike commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1733202001


##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.service.catalog;
+
+import static org.apache.polaris.service.catalog.AccessDelegationMode.*;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.REMOTE_SIGNING;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.fromProtocolValuesList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.EnumSet;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+class AccessDelegationModeTest {

Review Comment:
   Sorry - knee jerk response. I didn't realize this was a test class. 🤦🏽‍♂️
   As a rule, I think all public classes ought to have javadocs. But I don't think this holds true for test classes



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1731612995


##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.service.catalog;
+
+import static org.apache.polaris.service.catalog.AccessDelegationMode.*;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.REMOTE_SIGNING;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.fromProtocolValuesList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.EnumSet;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+class AccessDelegationModeTest {

Review Comment:
   Is the class name not descriptive enough? I can certainly add javadoc, but it will be equivalent to the information conveyed by the class name :)



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #211:
URL: https://github.com/apache/polaris/pull/211#issuecomment-2318839142

   @RussellSpitzer : rebased :)


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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer merged PR #211:
URL: https://github.com/apache/polaris/pull/211


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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

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


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   It seems like there will be some need to reconcile "strict intent" vs "hints" better in the future, since right now a lot of the Iceberg spec is open-ended about interpretation -- for example, the spec currently says:
   
       The server may choose to supply access via any or none of the requested mechanisms.
   
   This also relates to https://github.com/apache/iceberg/pull/10359 in that some behaviors currently can only "guess" at the caller's intent.
   
   I agree that any hard-coding of "true" is probably not good baggage to carry forward. I would say though that extrapolating from https://github.com/apache/polaris/pull/77 and how the Tabular "demo REST docker image" provides hooks for directly returning the server-wide application credentials in credential-vending, maybe it's worth providing some extensibility here.
   
   What if we extract a server-level configuration parameter or two:
   
   - SUPPORTED_ACCESS_DELEGATION_MODES=vended-credentials,...
   - ERROR_ON_FAILED_NEGOTIATION_FOR_ACCESS_DELEGATION_MODE=true
   
   The first one would just be a set-intersection between the list of modes the client wants and the set that the server claims to accept. I suppose the later mapping of declared modes to access-delegation impl will be something to add in the future once we actually need to plumb it through to `PolarisCatalogHandlerWrapper` to do different things for different modes.
   
   The second one will dictate whether the server should be in "strict" mode and return an error response, or instead be permissive and just log a warning (or if there was a way to return helpful warnings in Iceberg REST responses that'd be great).
   
   To the last point I wonder if we should also think of proposing some standard scaffolding for "warning notices" in REST responses that client-libraries can start to support to display to a caller in whatever way is most natural for the client-library. I know cloud providers have gone through this exercise before so that individual service providers can have a standard way to start providing deprecation notices, etc.



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1733324067


##########
polaris-service/src/main/java/org/apache/polaris/service/catalog/IcebergCatalogAdapter.java:
##########
@@ -171,28 +173,39 @@ public Response updateProperties(
         .build();
   }
 
+  private EnumSet<AccessDelegationMode> parseAccessDelegationModes(String accessDelegationMode) {
+    EnumSet<AccessDelegationMode> delegationModes =
+        AccessDelegationMode.fromProtocolValuesList(accessDelegationMode);
+    if (!delegationModes.isEmpty() && !delegationModes.contains(VENDED_CREDENTIALS)) {

Review Comment:
   backward compatibility added



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

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


Re: [PR] Correct the handling of access delegation mode [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #211:
URL: https://github.com/apache/polaris/pull/211#discussion_r1733298218


##########
polaris-service/src/test/java/org/apache/polaris/service/catalog/AccessDelegationModeTest.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.service.catalog;
+
+import static org.apache.polaris.service.catalog.AccessDelegationMode.*;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.REMOTE_SIGNING;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.VENDED_CREDENTIALS;
+import static org.apache.polaris.service.catalog.AccessDelegationMode.fromProtocolValuesList;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.EnumSet;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.EnumSource;
+
+class AccessDelegationModeTest {

Review Comment:
   agreed



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

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