You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "cccs-cat001 (via GitHub)" <gi...@apache.org> on 2025/11/26 14:14:09 UTC
[PR] Support Aws STS AssumeRoleWithWebIdentity [polaris]
cccs-cat001 opened a new pull request, #3170:
URL: https://github.com/apache/polaris/pull/3170
Here is a preliminary pass at fixing https://github.com/apache/polaris/issues/3038, I've added in an option to have the sts use assumeRoleWithWebIdentity and pass along the user credentials. This will allow the STS to know who is asking for credentials instead of the request coming from some shared service credentials.
We've found that using our on-prem S3 solution that the way Polaris accesses the STS results in connectivity errors, and the recommended way of accessing the STS is with a web identity token (A.K.A. access token), so adding this optional feature will result in Polaris being usable by more S3 appliances than just AWS :)
## Checklist
- [ ] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [x] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #
- [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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572302886
##########
runtime/service/build.gradle.kts:
##########
@@ -103,7 +102,7 @@ dependencies {
implementation("com.fasterxml.jackson.core:jackson-annotations")
implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.core:jackson-databind")
-
+ implementation(libs.apache.httpclient5)
Review Comment:
Nope!
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569588354
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -76,6 +76,7 @@ class CatalogsCommand(Command):
sts_endpoint: str
sts_unavailable: bool
path_style_access: bool
+ user_token_sts: bool
Review Comment:
Later is fine... we need to settle on the config names in API first :sweat_smile:
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3582306885
Alright dumb question; I need to rebuild the `api/management-model` project so it regenerates its classes to include the new `userTokenSts` option in the `AwsStorageConfigInfo`, but I'm not sure how those classes get generated ๐
I think getting those classes to regenerate will fix the tests. I added the new userTokenSts option to the `./spec/polaris-management-service.yaml` already...
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572307901
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
Access down-scoping (policy-based restrictions) makes more sense in the case when Polaris has its own "service" credential because we do not want to delegate more rights to the user than what is necessary for the API request.
In this case the STS session is based in the unmodified API user identity. The user can gain the same access by talking to STS directly.
The only reason for restricting access might be to enforce catalog-level location settings. However, that would be mostly about preventing accidental mistakes on the client side rather than a true security control.
That said, for the sake of narrowing Polaris behaviour variations it might still be worth applying the same policy as in the "service" account case... just for ease of reasoning about how the system works.
Taking this one step further, it might be worth controlling the policy application with yet another config property, if there are use cases when the extra policy is not desirable.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582626983
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisPrincipal.java:
##########
@@ -74,4 +106,8 @@ static PolarisPrincipal of(String name, Map<String, String> properties, Set<Stri
* as permissions, preferences, or other metadata.
*/
Map<String, String> getProperties();
+
+ /** Returns the access token of the current user. */
+ @Nullable
+ String getToken();
Review Comment:
You may want to hold this until you deal with `StorageCredentialCacheKey`, then use whatever is more convenience on the cache side.
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisPrincipal.java:
##########
@@ -74,4 +106,8 @@ static PolarisPrincipal of(String name, Map<String, String> properties, Set<Stri
* as permissions, preferences, or other metadata.
*/
Map<String, String> getProperties();
+
+ /** Returns the access token of the current user. */
+ @Nullable
+ String getToken();
Review Comment:
You may want to hold this until you deal with `StorageCredentialCacheKey`, then use whatever is more convenient on the cache side.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569580204
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.auth;
+package org.apache.polaris.core.auth;
Review Comment:
I believe it happens here: https://github.com/apache/polaris/blob/3c5dbaf2bc93bb2861b5fb0407ffc1597e48bdd2/runtime/service/src/main/java/org/apache/polaris/service/auth/DefaultAuthenticator.java#L97
The effectiveness of the new STS request mode will depend on the `Authenticator` implementations supporting token propagation. It is a bit obscure, but I think it aligns well with the general authentication flows in Polaris.
In any case, there's only one `Authenticator` in OSS code ATM.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569584188
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.auth;
+package org.apache.polaris.core.auth;
Review Comment:
Note: for OIDC flows, the JWT in `PolarisCredential` is already authenticated by Quarkus by the time `DefaultAuthenticator` is called.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572296954
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
Review Comment:
Yeah we pass the polaris token directly to the STS. Again, not an S3 or STS expert, but our STS and storage appliance seems happy to accept the polaris token. I don't have the means to test any other storage appliance with any other configurations unfortunately.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572190629
##########
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java:
##########
@@ -72,6 +72,7 @@ public void testJsonFormat() throws JsonProcessingException {
+ "\"storageConfigInfo\":{"
+ "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
+ "\"allowedKmsKeys\":[],"
+ + "\"propagateApiUserIdentity\":false,"
Review Comment:
nit: could you handle `propagateApiUserIdentity` similar to `stsUnavailable` so that old clients will not need this entry unless it's set explicitly?
##########
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java:
##########
@@ -72,6 +72,7 @@ public void testJsonFormat() throws JsonProcessingException {
+ "\"storageConfigInfo\":{"
+ "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
+ "\"allowedKmsKeys\":[],"
+ + "\"propagateApiUserIdentity\":false,"
Review Comment:
nit: could you handle `propagateApiUserIdentity` similar to `stsUnavailable` so that old clients will not see this entry unless it's set explicitly?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2566609565
##########
runtime/service/src/main/java/org/apache/polaris/service/auth/PolarisCredential.java:
##########
@@ -31,14 +31,22 @@
public interface PolarisCredential extends Credential {
static PolarisCredential of(
- @Nullable Long principalId, @Nullable String principalName, Set<String> principalRoles) {
Review Comment:
Generally speaking, it is preferable to add new builder methods for new optional parameters (and chain old methods into them). This way existing code that does not use new optional parameter won't have to change.
##########
spec/polaris-management-service.yml:
##########
@@ -1136,6 +1136,11 @@ components:
for accessing data and metadata files within the related catalog. Setting this property to `true`
effectively disables vending storage credentials to clients. This setting is intended for configuring
catalogs with S3-compatible storage implementations that do not support STS.
+ userTokenSts:
Review Comment:
suggestion: `propagateApiUserIdentity` - it is more directly connected to actual code behaviour... at least for me ๐
I'd welcome other naming suggestions too. Better have this discussion now than after the stuff is released :)
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -76,6 +76,7 @@ class CatalogsCommand(Command):
sts_endpoint: str
sts_unavailable: bool
path_style_access: bool
+ user_token_sts: bool
Review Comment:
nit: Combining CLI changes and backend changes in the same PR is ok, but these areas usually attract different sets of reviewers. As for me, I usually do CLI changes in a follow-up PR. I also usually do not usually have material opinions about CLI code changes :) all in all, it might be easier for reviewers to have CLI and java changes in different PRs... I guess.
##########
integration-tests/src/main/java/org/apache/polaris/service/it/test/CatalogFederationIntegrationTest.java:
##########
@@ -159,6 +159,7 @@ private void setupCatalogs() {
AwsStorageConfigInfo.builder()
.setStorageType(StorageConfigInfo.StorageTypeEnum.S3)
.setPathStyleAccess(true)
+ .setUserTokenSts(false)
Review Comment:
Is this required? Could we handle defaults transparently to code areas not affected by the new feature?
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.auth;
+package org.apache.polaris.core.auth;
Review Comment:
I'm not sure about moving this class to core ๐ค
Why not add the token as a well-known property to `PolarisPrincipal`?
##########
client/python/apache_polaris/cli/command/__init__.py:
##########
@@ -54,6 +54,7 @@ def options_get(key, f=lambda x: x):
allowed_locations=options_get(Arguments.ALLOWED_LOCATION),
role_arn=options_get(Arguments.ROLE_ARN),
external_id=options_get(Arguments.EXTERNAL_ID),
+ user_token_sts=options_get(Arguments.USER_TOKEN_STS),
Review Comment:
I made a comment about this name on the API yaml. Let's discuss actual name there.
Once that is decided, my personal opinion is that using the same name in Python CLI is quite appropriate.
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -44,13 +46,15 @@
import software.amazon.awssdk.policybuilder.iam.IamStatement;
import software.amazon.awssdk.services.sts.StsClient;
import software.amazon.awssdk.services.sts.model.AssumeRoleRequest;
-import software.amazon.awssdk.services.sts.model.AssumeRoleResponse;
+import software.amazon.awssdk.services.sts.model.AssumeRoleWithWebIdentityRequest;
+import software.amazon.awssdk.services.sts.model.Credentials;
/** Credential vendor that supports generating */
public class AwsCredentialsStorageIntegration
extends InMemoryStorageIntegration<AwsStorageConfigurationInfo> {
private final StsClientProvider stsClientProvider;
private final Optional<AwsCredentialsProvider> credentialsProvider;
+ private final SecurityIdentity securityIdentity;
Review Comment:
Depending on Quarkus classes in core is really not desirable... AFAIK, sorry.
##########
runtime/service/src/main/java/org/apache/polaris/service/auth/PolarisCredential.java:
##########
@@ -31,14 +31,22 @@
public interface PolarisCredential extends Credential {
static PolarisCredential of(
- @Nullable Long principalId, @Nullable String principalName, Set<String> principalRoles) {
Review Comment:
Please add a new `of()` method for the new parameter (since it's optional). This way existing code that does not use the token, does not have to change.
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -44,13 +46,15 @@
import software.amazon.awssdk.policybuilder.iam.IamStatement;
import software.amazon.awssdk.services.sts.StsClient;
import software.amazon.awssdk.services.sts.model.AssumeRoleRequest;
-import software.amazon.awssdk.services.sts.model.AssumeRoleResponse;
+import software.amazon.awssdk.services.sts.model.AssumeRoleWithWebIdentityRequest;
+import software.amazon.awssdk.services.sts.model.Credentials;
/** Credential vendor that supports generating */
public class AwsCredentialsStorageIntegration
extends InMemoryStorageIntegration<AwsStorageConfigurationInfo> {
private final StsClientProvider stsClientProvider;
private final Optional<AwsCredentialsProvider> credentialsProvider;
+ private final SecurityIdentity securityIdentity;
Review Comment:
`PolarisPrincipal` should be injectable into `StorageAccessConfigProvider` and then it should be possible to propagate it to this class as method parameters... WDYT?
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -31,14 +31,22 @@
public interface PolarisCredential extends Credential {
static PolarisCredential of(
- @Nullable Long principalId, @Nullable String principalName, Set<String> principalRoles) {
+ @Nullable String token,
+ @Nullable Long principalId,
+ @Nullable String principalName,
+ Set<String> principalRoles) {
Review Comment:
Please add a new `of()` method for the new parameter (since it's optional). This way existing code that does not use the token, does not have to change.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3627154783
Closing this PR in favour of #3224 and #3236
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572295177
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
from what I gather with this flow, we don't need to provide a policy string. Seems that the STS reads the users token and provides you with all the credentials you have permission for.
I'm not an expert in S3 or STS so I could be way off and feel free to correct me if I am, but from testing with our appliance this is the way it seems to be.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3607337956
> Is everything set up so that I can just @Inject Token token;? ๐ค
Injecting in `runtime/service` classes should be ok, but `polaris-core` should remain CDI-neutral by convention (i.e. no CDI annotations in core).
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3607116715
I support @adutra 's point about Polaris _not_ acting as a token broker or authorization server. Polaris, in general, should be a resource server in OAuth2 terms.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3606973902
> By creating this approach, we are introducing a security loophole that is completely against Polaris' security modelling today.
I am completely failing to see what security loopholes we would be introducing by leveraging `AssumeRoleWithWebIdentity`. Propagating the user's access token to AWS STS using `AssumeRoleWithWebIdentity` is the standard pattern recommended by AWS itself for federated OIDC access.
> the client should be modified to talk to STS directly to gain credentials without Polaris' involvement. IMO Polaris should not be involved in abetting ANY security loopholes.
Are you serious about allowing clients to talk to STS directly? THAT, indeed, would be a giant security loophole.
> Or we can look towards [...] setting Polaris up as an intermediate token broker which the "STS" service trusts, a new credential can be minted for the client to access the storage layer.
IMHO this is unrealistic, and over-engineered. That would require a form of token exchange and would be extremely hard to implement for little added-value. And again: **let's please stop considering Polaris as an OAuth2 token broker. This is legacy behavior.**
> Trying to fit a simplistic solution to quick-solve a problem for a system we don't even fully support is a _very_ dangerous precedence to set.
Can you clarify what "simplistic solution" you are talking about and what is this "system [that] we don't [...] fully support"?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2585136936
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
Review Comment:
> I'm not sure I understand this part properly (I read through the email thread as well) - are we passing in the user's token directly to STS? If so, what type of token is this: a Polaris authN token or a WebIdentityToken?
It's the authenticated principal's OAuth2 access token, as provided by the authentication layer.
> how does STS translate between this token and an IAM trust policy enforcement - which should state which users are allowed to assume this role? And if such a translation does exist, where in Polaris is this logic?
The IAM role being assumed must have a pre-configured trust policy that explicitly trusts the IDP and potentially specifies conditions like the expected audience and subject of the token. The STS service is supposed to validate the signature and claims of the provided token against the registered IDP before issuing credentials.
> this seems to be breaking the general architecture of Polaris where Polaris serves as a trusted credential broker and clients are assumed to not be able to bypass Polaris in order to get storage credentials.
It's not that simple. The remote client may be in possession of valid OAuth2 credentials for WebIdentity, but you still need an STS client to issue the `AssumeRoleWithWebIdentityRequest`. The STS client requires its own credentials. If the remote client doesn't have those credentials, it cannot talk to STS.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572301802
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisPrincipal.java:
##########
@@ -74,4 +106,8 @@ static PolarisPrincipal of(String name, Map<String, String> properties, Set<Stri
* as permissions, preferences, or other metadata.
*/
Map<String, String> getProperties();
+
+ /** Returns the access token of the current user. */
+ @Nullable
+ String getToken();
Review Comment:
Seems the same to me, what's bad about using `@Nullable`?
##########
site/content/in-dev/unreleased/command-line-interface.md:
##########
@@ -151,6 +151,7 @@ options:
--role-arn (Only for AWS S3) A role ARN to use when connecting to S3
--region (Only for S3) The region to use when connecting to S3
--external-id (Only for S3) The external ID to use when connecting to S3
+ --propagate-api-user-identity (Only for S3) Whether to use the requesting users identity when connecting to the STS
Review Comment:
sure does! my bad :)
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3627157730
Closing this PR in favour of #3224 and #3236
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adnanhemani (via GitHub)" <gi...@apache.org>.
adnanhemani commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2566086594
##########
client/python/apache_polaris/cli/command/__init__.py:
##########
@@ -54,6 +54,7 @@ def options_get(key, f=lambda x: x):
allowed_locations=options_get(Arguments.ALLOWED_LOCATION),
role_arn=options_get(Arguments.ROLE_ARN),
external_id=options_get(Arguments.EXTERNAL_ID),
+ user_token_sts=options_get(Arguments.USER_TOKEN_STS),
Review Comment:
I find "user_token_sts" not so clear. Given that these tokens must be WebIdentityTokens (as per STS spec), I'd suggest renaming to something more specific, like "use_sts_web_identity_token".
Or, I think this property could be useful for similar features in Azure/GCP in the future (e.g. Azure's Federated Credentials or GCP's Workload Identity Federation) - and maybe we keep it something a bit vague like "use_subject_token" so as to not make it specifically named for STS.
@dimas-b WDYT?
##########
runtime/service/build.gradle.kts:
##########
@@ -30,7 +30,6 @@ dependencies {
implementation(project(":polaris-api-management-service"))
implementation(project(":polaris-api-iceberg-service"))
implementation(project(":polaris-api-catalog-service"))
-
Review Comment:
Unnecessary change
##########
runtime/service/src/test/java/org/apache/polaris/service/auth/external/OidcPolarisCredentialAugmentorTest.java:
##########
@@ -109,7 +109,7 @@ public void testAugmentOidcPrincipal() {
.addRole("ROLE1")
.addAttribute(TENANT_CONFIG_ATTRIBUTE, config)
.build();
-
+ when(oidcPrincipal.getRawToken()).thenReturn("this_is_a_token");
Review Comment:
nit: let's separate "this_is_a_token" into a shared variable.
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
Review Comment:
To be clear, I'm making this assumption that the token is a user's token based off of https://github.com/apache/polaris/pull/3170/files#diff-204e04f3365ea6ec898018ebfe943ca22277ae4643b58d1ca31462f70662c618R94. If the SecurityIdentity is populating with the server's token (not sure this makes sense to me, but feel free to correct me), then that may open a different set of questions.
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
Review Comment:
I'm not sure I understand this part properly (I read through the email thread as well) - are we passing in the user's token directly to STS? If so, what type of token is this: a Polaris authN token or a WebIdentityToken?
If a Polaris AuthN token, how does STS translate between this token and an IAM trust policy enforcement - which should state which users are allowed to assume this role? And if such a translation does exist, where in Polaris is this logic?
If a WebIdentityToken, then what stops this token from contacting STS directly to assume the role and get credentials for S3?
I understand there may be some special rules you have in place for an on-prem solution that may limit the ability of a user to contact STS directly or to translate between a Polaris token and an identity that STS can understand - but this seems to be breaking the general architecture of Polaris where Polaris serves as a trusted credential broker and clients are assumed to not be able to bypass Polaris in order to get storage credentials.
##########
.gitignore:
##########
@@ -105,4 +105,5 @@ hs_err_pid*
.vscode/
# Python Virtual Env
-.venv
\ No newline at end of file
+.venv
+venv
Review Comment:
Unnecessary change
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
Don't see a `policy` block added here (like it is in the non-token code path). If this is intentional, please explain why the scoping-down of credentials isn't applicable here?
##########
runtime/service/build.gradle.kts:
##########
@@ -103,7 +102,7 @@ dependencies {
implementation("com.fasterxml.jackson.core:jackson-annotations")
implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.core:jackson-databind")
-
Review Comment:
Unnecessary change
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2566609565
##########
runtime/service/src/main/java/org/apache/polaris/service/auth/PolarisCredential.java:
##########
@@ -31,14 +31,22 @@
public interface PolarisCredential extends Credential {
static PolarisCredential of(
- @Nullable Long principalId, @Nullable String principalName, Set<String> principalRoles) {
Review Comment:
Generally speaking, it is preferable to add new builder methods for new optional parameters (and chain old methods into them). This way existing code that does not use new optional parameter won't have to change.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2566615076
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -31,14 +31,22 @@
public interface PolarisCredential extends Credential {
static PolarisCredential of(
- @Nullable Long principalId, @Nullable String principalName, Set<String> principalRoles) {
+ @Nullable String token,
+ @Nullable Long principalId,
+ @Nullable String principalName,
+ Set<String> principalRoles) {
Review Comment:
Please add a new `of()` method for the new parameter (since it's optional). This way existing code that does not use the token, does not have to change.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582624413
##########
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java:
##########
@@ -72,6 +72,7 @@ public void testJsonFormat() throws JsonProcessingException {
+ "\"storageConfigInfo\":{"
+ "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
+ "\"allowedKmsKeys\":[],"
+ + "\"propagateApiUserIdentity\":false,"
Review Comment:
The latest state of the PR LGTM. As long as the new property does not show up when unset, it's fine. Resolving this thread.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3608346092
@tokoko : AFAIK (and @cccs-cat001 may have a better answer) this feature is mostly intended for custom systems. Using the workflow it enables with AWS, for example, may be possible, yet whether it is the best approach with AWS is subject to specific user demands. I tend to agree that this may not be the best approach for MinIO or AWS S3.
Nonetheless, I do not see why Polaris as an OSS project should not open this use case for deployments what may benefit from it. The feature is well isolated under a catalog property, there is no impact to other use cases.
For reference, here's the related dev ML thread: https://lists.apache.org/thread/tm76ntbgdqt31r6402dro8vb7m4pdzzq
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 closed pull request #3170: Support Aws STS AssumeRoleWithWebIdentity
URL: https://github.com/apache/polaris/pull/3170
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3590005550
@adutra : could you double check quarkus auth integration changes (they LGTM)
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2580790772
##########
.gitignore:
##########
@@ -105,4 +105,5 @@ hs_err_pid*
.vscode/
# Python Virtual Env
-.venv
\ No newline at end of file
+.venv
+venv
Review Comment:
Can't we just slip in a quick little gitignore change ๐ฅบ
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3607792373
> That is to say, I think current `PolarisPrincipal` changes will probably have to remain.
True, at some point we'd need to pass the token as a parameter. @cccs-cat001 please don't rush into using token propagation if you can't find a simple path forward โ what you have currently is perfectly acceptable.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2568159375
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.auth;
+package org.apache.polaris.core.auth;
Review Comment:
That's a fantastic question and I completely agree! Problem is I couldn't find where the PolarisPrincipal was getting set up and the classes you referenced for me were setting up a PolarisCredential so I ran with that lol
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2568167608
##########
client/python/apache_polaris/cli/command/__init__.py:
##########
@@ -54,6 +54,7 @@ def options_get(key, f=lambda x: x):
allowed_locations=options_get(Arguments.ALLOWED_LOCATION),
role_arn=options_get(Arguments.ROLE_ARN),
external_id=options_get(Arguments.EXTERNAL_ID),
+ user_token_sts=options_get(Arguments.USER_TOKEN_STS),
Review Comment:
yeah I think `propagateApiUserIdentity` is good, it's generic enough that it can work with any other storage appliance, not just S3, if it's ever 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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569455547
##########
spec/polaris-management-service.yml:
##########
@@ -1136,6 +1136,11 @@ components:
for accessing data and metadata files within the related catalog. Setting this property to `true`
effectively disables vending storage credentials to clients. This setting is intended for configuring
catalogs with S3-compatible storage implementations that do not support STS.
+ userTokenSts:
Review Comment:
Discussion happening in the other thread (https://github.com/apache/polaris/pull/3170#discussion_r2566597009), will close this comment
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582617684
##########
runtime/service/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java:
##########
@@ -88,7 +91,8 @@ public PolarisStorageIntegrationProviderImpl(
new AwsCredentialsStorageIntegration(
(AwsStorageConfigurationInfo) polarisStorageConfigurationInfo,
stsClientProvider,
- stsCredentials);
+ stsCredentials,
+ context);
Review Comment:
@cccs-cat001 : just for clarity, from my POV this is the only issue that is really critical to resolve before merging.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adnanhemani (via GitHub)" <gi...@apache.org>.
adnanhemani commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3609340565
> Propagating the user's access token to AWS STS using AssumeRoleWithWebIdentity is the standard pattern recommended by AWS itself for federated OIDC access.
This is only the standard pattern recommended by AWS for federated OIDC access - _if you do not have a governance system in between_. If you feel that's wrong, please feel free to drop links to the AWS documentation here that support your claim.
> Are you serious about allowing clients to talk to STS directly? THAT, indeed, would be a giant security loophole.
(Also mentioned in Laurent's email to the Dev ML regarding this approach) Isn't this possible today with how the code is written? If it isn't, what stops it? Is it a network policy? And as a result, are we betting the whole of Polaris' security posture on such a network policy? Is that truly wise?
Let's compare this to the `AssumeRole` path we have today. In our best practices, are IAM roles allowed to be assumed by the clients directly? That is clearly not the model that Polaris has today - so why are we breaking that security model for this feature?
> Nonetheless, I do not see why Polaris as an OSS project should not open this use case for deployments what may benefit from it. The feature is well isolated under a catalog property, there is no impact to other use cases.
Not sure I agree, we are enabling a use case here that does not align with our current security best practices. And to be clear, this is not as a result of there not being a better way of doing this, but rather because this is the fastest way of achieving this goal. Trampling security best practices for velocity is not something that we have a track record of within this project.
I agree that this use case is a valid one - and that we should be supporting it. But I highly disagree in the way that this implementation does so. Rather than bending the security model that we have today (which generally can be stated like: Polaris user who is unprivileged with regards to storage credentials, authenticates and authorizes with Polaris in order to gain storage credentials) to fit this use case, we should be tailoring the implementation of this use case to fit the security model.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2584720528
##########
runtime/service/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java:
##########
@@ -88,7 +91,8 @@ public PolarisStorageIntegrationProviderImpl(
new AwsCredentialsStorageIntegration(
(AwsStorageConfigurationInfo) polarisStorageConfigurationInfo,
stsClientProvider,
- stsCredentials);
+ stsCredentials,
+ context);
Review Comment:
Yeah I'm working on it, I'm just dumb ๐
๐
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572202402
##########
runtime/service/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java:
##########
@@ -88,7 +91,8 @@ public PolarisStorageIntegrationProviderImpl(
new AwsCredentialsStorageIntegration(
(AwsStorageConfigurationInfo) polarisStorageConfigurationInfo,
stsClientProvider,
- stsCredentials);
+ stsCredentials,
+ context);
Review Comment:
This "provider" is `@ApplicationScoped`, but `SecurityContext` is conceptually request-scoped. `AwsCredentialsStorageIntegration` is accessed via `StorageCredentialCache`.
Current setup creates a logical inconsistency: the cache may return data from memory, while the request-scoped context contains a different token. The cache does not "see" this context.
I believe it would be preferably to carry the token through the method parameter so that the cache can take it into account when it computes its key. This will increase cache churn, of course, but it's a matter of correctness at this point, not optimization (I think).
##########
site/content/in-dev/unreleased/command-line-interface.md:
##########
@@ -151,6 +151,7 @@ options:
--role-arn (Only for AWS S3) A role ARN to use when connecting to S3
--region (Only for S3) The region to use when connecting to S3
--external-id (Only for S3) The external ID to use when connecting to S3
+ --propagate-api-user-identity (Only for S3) Whether to use the requesting users identity when connecting to the STS
Review Comment:
Does this belong in the CLI PR? ๐ค
##########
runtime/service/build.gradle.kts:
##########
@@ -103,7 +102,7 @@ dependencies {
implementation("com.fasterxml.jackson.core:jackson-annotations")
implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.core:jackson-databind")
-
+ implementation(libs.apache.httpclient5)
Review Comment:
Is this required for the new Assume Role With Web Identity call?
##########
.gitignore:
##########
@@ -105,4 +105,5 @@ hs_err_pid*
.vscode/
# Python Virtual Env
-.venv
\ No newline at end of file
+.venv
+venv
Review Comment:
I agree with @cccs-cat001 on this topic, but I'd propose to make this change in a separate PR to avoid mixing QOL changes with feature changes ๐
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisPrincipal.java:
##########
@@ -74,4 +106,8 @@ static PolarisPrincipal of(String name, Map<String, String> properties, Set<Stri
* as permissions, preferences, or other metadata.
*/
Map<String, String> getProperties();
+
+ /** Returns the access token of the current user. */
+ @Nullable
+ String getToken();
Review Comment:
nit: WDYT about `Optional<String>` here?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2580929495
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
okay, I'll test out the policy string on our storage before committing 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: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569597446
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -76,6 +76,7 @@ class CatalogsCommand(Command):
sts_endpoint: str
sts_unavailable: bool
path_style_access: bool
+ user_token_sts: bool
Review Comment:
CLI does not _have to_ be always 1:1 with the REST API spec... We can evolve it separately... even across release boundaries... but I hope we can finish all for 1.4.0 :wink:
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569451627
##########
.gitignore:
##########
@@ -105,4 +105,5 @@ hs_err_pid*
.vscode/
# Python Virtual Env
-.venv
\ No newline at end of file
+.venv
+venv
Review Comment:
I disagree. Some people (including myself) use venv instead of .venv and it's a good QOL addition to not have to sift through the venv to find your changes.
That being said, is there any security issues or genuine concerns that arise having this `venv` directory ignored?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572307901
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
Access down-scoping (policy-based restrictions) makes more sense in the case when Polaris has its own "service" credential because we do not want to delegate more rights to the user than what is necessary for the API request.
In this case the STS session is based in the unmodified API user identity. The user can gain the same access by talking to STS directly.
The only reason for restricting access might be to enforce catalog-level location settings. However, that would be mostly about preventing accidental mistakes on the client side rather than a true security control.
That said, for the sake of narrowing Polaris behaviour variations it might still be worth applying the same policy as in the "service" account case... just for ease of reasoning about how the system works.
Taking this one step further, it might be worth controlling the policy application with yet another config property, if there are use case when the extra policy in not desirable.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2572307901
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
Access down-scoping (policy-based restrictions) makes more sense in the case when Polaris has its own "service" credential because we do not want to delegate more rights to the user than what is necessary for the API request.
In this case the STS session is based in the unmodified API user identity. The user can gain the same access by talking to STS directly.
The only reason for restricting access might be to enforce catalog-level location settings. However, that would be mostly about preventing accidental mistakes on the client side rather than a true security control.
That said, for the sake of narrowing Polaris behaviour variations it might still be worth applying the same policy as in the "service" account case... just for ease of reasoning about how the system works.
Taking this one step further, it might be worth to control the policy application with yet another config property, if there are use case when the extra policy in not desirable.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3607320032
> I find the changes in this PR a bit invasive tbh. I would rather explore Quarkus OIDC token propagation techniques, and more specifically, I would try to inject `io.quarkus.oidc.client.Tokens` wherever necessary:
>
> https://quarkus.io/guides/security-openid-connect-client-reference#inject-tokens
>
> But I don't want to delay this PR that is extremely useful. I think we can go with the approach taken here and then switch to token propagation in a follow-up PR.
that looks pretty simple compared to all the changes I'm making tbh. Is everything set up so that I can just `@Inject Token token;`? ๐ค
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "tokoko (via GitHub)" <gi...@apache.org>.
tokoko commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3608238917
To be honest I'm very confused about the implementation in the PR as well. Not sure about other s3-compatible systems, but in the case of minio, (if I'm reading this correctly...) this option will only work if all catalog users have the ability to assume the role that's configured centrally on the catalog level and which also needs to have read/write privileges on all catalog locations. I fail to see how this can be useful to anyone. why would anyone hand out assume role privileges on what's basically a superuser?
If the problem that the PR is trying to solve is simply to support those systems that only support `AssumeRoleWithWebIdentity`, the more straightforward solution would be to enable the catalog to acquire required web identity instead of acquiring it from a user. The same way that the standard `AssumeRole` option relies on AWS environment variables to authenticate the call, the new `AssumeRoleWithWebIdentity` solution should read necessary oauth configs and have an internal background process that obtains and refreshes a token needed to authenticate AssumeRoleWithWebIdentity calls. I'm not sure why we would complicate this with some sort of token pass-through mechanism.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3613708011
Marking as draft as tests are failing for unknown reasons, they'll potentially be fixed with #3203, so we'll wait for that.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569511868
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -76,6 +76,7 @@ class CatalogsCommand(Command):
sts_endpoint: str
sts_unavailable: bool
path_style_access: bool
+ user_token_sts: bool
Review Comment:
I've split out the CLI changes and will post a new PR after this one.
Or should I post it now too?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2569584188
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisCredential.java:
##########
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.polaris.service.auth;
+package org.apache.polaris.core.auth;
Review Comment:
Note: for OIDC flows, the JWT in the request is already authenticated by Quarkus by the time `DefaultAuthenticator` is called... It may still need to be passed through `PolarisCredential`, but at least that part does not touch "core".
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2566602739
##########
client/python/apache_polaris/cli/command/catalogs.py:
##########
@@ -76,6 +76,7 @@ class CatalogsCommand(Command):
sts_endpoint: str
sts_unavailable: bool
path_style_access: bool
+ user_token_sts: bool
Review Comment:
nit: Combining CLI changes and backend changes in the same PR is ok, but these areas usually attract different sets of reviewers. As for me, I usually do CLI changes in a follow-up PR. Also, I usually do not have material opinions about CLI code changes :) all in all, it might be easier for reviewers to have CLI and java changes in different PRs... I guess.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2588839871
##########
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java:
##########
@@ -72,6 +72,7 @@ public void testJsonFormat() throws JsonProcessingException {
+ "\"storageConfigInfo\":{"
+ "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
+ "\"allowedKmsKeys\":[],"
+ + "\"propagateApiUserIdentity\":false,"
Review Comment:
Okay so I've been banging my head against the wall with this for a little bit. The only difference I can find between this and the `stsUnavailable` is that we have `propagateApiUserIdentity` default to false, this was so that we didn't get errors in `AwsCredentialsStorageIntegration.java L101`, but I've since added the `Boolean.TRUE.equals` so I think it's fine to remove the default in the `polaris-management-service.yml`?
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "cccs-cat001 (via GitHub)" <gi...@apache.org>.
cccs-cat001 commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2580900967
##########
api/management-model/src/test/java/org/apache/polaris/core/admin/model/CatalogSerializationTest.java:
##########
@@ -72,6 +72,7 @@ public void testJsonFormat() throws JsonProcessingException {
+ "\"storageConfigInfo\":{"
+ "\"roleArn\":\"arn:aws:iam::123456789012:role/test-role\","
+ "\"allowedKmsKeys\":[],"
+ + "\"propagateApiUserIdentity\":false,"
Review Comment:
I'm not sure what I did differently from `stsUnavailable` tbh. I'm gonna remove that change and see if this was just a "quirk" of my local setup
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582611297
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisPrincipal.java:
##########
@@ -74,4 +106,8 @@ static PolarisPrincipal of(String name, Map<String, String> properties, Set<Stri
* as permissions, preferences, or other metadata.
*/
Map<String, String> getProperties();
+
+ /** Returns the access token of the current user. */
+ @Nullable
+ String getToken();
Review Comment:
It's a "nit" comment :) `Optional` is slightly preferable IMHO because it's an essential piece of information for making the `StorageAccessConfig`, but the content of the token is optional... really fine point :) I'm ok either way.
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582599424
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -90,35 +96,46 @@ public StorageAccessConfig getSubscopedCreds(
StorageAccessConfig.Builder accessConfig = StorageAccessConfig.builder();
if (shouldUseSts(storageConfig)) {
- AssumeRoleRequest.Builder request =
- AssumeRoleRequest.builder()
- .externalId(storageConfig.getExternalId())
- .roleArn(storageConfig.getRoleARN())
- .roleSessionName("PolarisAwsCredentialsStorageIntegration")
- .policy(
- policyString(
- storageConfig,
- allowListOperation,
- allowedReadLocations,
- allowedWriteLocations,
- region,
- accountId)
- .toJson())
- .durationSeconds(storageCredentialDurationSeconds);
- credentialsProvider.ifPresent(
- cp -> request.overrideConfiguration(b -> b.credentialsProvider(cp)));
@SuppressWarnings("resource")
// Note: stsClientProvider returns "thin" clients that do not need closing
StsClient stsClient =
stsClientProvider.stsClient(StsDestination.of(storageConfig.getStsEndpointUri(), region));
-
- AssumeRoleResponse response = stsClient.assumeRole(request.build());
- accessConfig.put(StorageAccessProperty.AWS_KEY_ID, response.credentials().accessKeyId());
- accessConfig.put(
- StorageAccessProperty.AWS_SECRET_KEY, response.credentials().secretAccessKey());
- accessConfig.put(StorageAccessProperty.AWS_TOKEN, response.credentials().sessionToken());
- Optional.ofNullable(response.credentials().expiration())
+ Credentials credentials;
+ if (storageConfig.getUserTokenSTS()) {
+ AssumeRoleWithWebIdentityRequest.Builder request =
+ AssumeRoleWithWebIdentityRequest.builder()
+ .webIdentityToken(
+ securityIdentity.getCredential(PolarisCredential.class).getToken())
+ .roleArn(storageConfig.getRoleARN())
+ .roleSessionName("PolarisAwsCredentialsStorageIntegration")
+ .durationSeconds(storageCredentialDurationSeconds);
Review Comment:
from my POV, it would be ok to do the policy change in a follow-up PR. Current change is already under a dedicated config, so existing clients and servers will not be not affected even if we merge "as is".
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #3170:
URL: https://github.com/apache/polaris/pull/3170#discussion_r2582594882
##########
.gitignore:
##########
@@ -105,4 +105,5 @@ hs_err_pid*
.vscode/
# Python Virtual Env
-.venv
\ No newline at end of file
+.venv
+venv
Review Comment:
I'm ok with this... just proposing a faster (IMHO) path :slightly_smiling_face:
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3603739547
@cccs-cat001 : please resolve conflicts... otherwise CI does not run :shrug:
--
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] Support Aws STS AssumeRoleWithWebIdentity [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #3170:
URL: https://github.com/apache/polaris/pull/3170#issuecomment-3607783959
> that looks pretty simple compared to all the changes I'm making tbh. Is everything set up so that I can just `@Inject Token token;`? ๐ค
You may need to add the `io.quarkus:quarkus-oidc-client` dependency, I don't remember if it's already there or not.
--
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