-
Notifications
You must be signed in to change notification settings - Fork 377
feat: Add AWS STS Session Tags support for credential vending #3327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e3eb431
feat: Add AWS STS Session Tags support for credential vending
cf7d813
Minor fixes
7988098
Review comments
11f4c58
Review comments.
8cc852d
Remove request_id from the PR
13e9cad
Review comment: added activated roles
0b7ebcd
Review comments
3c6aee3
Update AwsSessionTagsBuilder.java
3c0c550
Spotless fixes
f67084d
Update StorageCredentialCacheKey.java
b81554a
fix failing tests
985454a
Review comments.
10892ab
Reverting last commit based on review comments for cache collisions.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
polaris-core/src/main/java/org/apache/polaris/core/storage/CredentialVendingContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.apache.polaris.core.storage; | ||
|
|
||
| import java.util.Optional; | ||
| import org.apache.polaris.immutables.PolarisImmutable; | ||
|
|
||
| /** | ||
| * Context information for credential vending operations. This context is used to provide metadata | ||
| * that can be attached to credentials as session tags (e.g., AWS STS session tags) for audit and | ||
| * correlation purposes in CloudTrail and similar logging systems. | ||
| * | ||
| * <p>When session tags are enabled, this context provides: | ||
| * | ||
| * <ul> | ||
| * <li>{@code catalogName} - The name of the catalog vending credentials | ||
| * <li>{@code namespace} - The namespace/database being accessed (e.g., "db.schema") | ||
| * <li>{@code tableName} - The name of the table being accessed | ||
| * <li>{@code activatedRoles} - Comma-separated list of activated principal roles | ||
| * </ul> | ||
| * | ||
| * <p>These values appear in cloud provider audit logs (e.g., AWS CloudTrail), enabling correlation | ||
| * between catalog operations and data access events. | ||
| */ | ||
| @PolarisImmutable | ||
| public interface CredentialVendingContext { | ||
|
|
||
| // Default session tag keys for cloud provider credentials (e.g., AWS STS session tags). | ||
| // These appear in cloud audit logs (e.g., CloudTrail) for correlation purposes. | ||
| String TAG_KEY_CATALOG = "polaris:catalog"; | ||
| String TAG_KEY_NAMESPACE = "polaris:namespace"; | ||
| String TAG_KEY_TABLE = "polaris:table"; | ||
| String TAG_KEY_PRINCIPAL = "polaris:principal"; | ||
| String TAG_KEY_ROLES = "polaris:roles"; | ||
|
|
||
| /** The name of the catalog that is vending credentials. */ | ||
| Optional<String> catalogName(); | ||
|
|
||
| /** | ||
| * The namespace being accessed, represented as a dot-separated string (e.g., "database.schema"). | ||
| */ | ||
| Optional<String> namespace(); | ||
|
|
||
| /** The name of the table being accessed. */ | ||
| Optional<String> tableName(); | ||
|
|
||
| /** | ||
| * The activated roles for the principal, represented as a comma-separated sorted string. This is | ||
| * included in the context (rather than extracted from PolarisPrincipal) to ensure it is part of | ||
| * the cache key when session tags are enabled. | ||
| */ | ||
| Optional<String> activatedRoles(); | ||
|
|
||
| /** | ||
| * Creates a new builder for CredentialVendingContext. | ||
| * | ||
| * @return a new builder instance | ||
| */ | ||
| static Builder builder() { | ||
| return ImmutableCredentialVendingContext.builder(); | ||
| } | ||
|
|
||
| /** | ||
| * Creates an empty context with no metadata. This is useful when session tags are disabled or | ||
| * when context information is not available. | ||
| * | ||
| * @return an empty context instance | ||
| */ | ||
| static CredentialVendingContext empty() { | ||
| return ImmutableCredentialVendingContext.builder().build(); | ||
| } | ||
|
|
||
| interface Builder { | ||
| Builder catalogName(Optional<String> catalogName); | ||
|
|
||
| Builder namespace(Optional<String> namespace); | ||
|
|
||
| Builder tableName(Optional<String> tableName); | ||
|
|
||
| Builder activatedRoles(Optional<String> activatedRoles); | ||
|
|
||
| CredentialVendingContext build(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.