AWS: Use assumed-role credentials for REST SigV4 signing#16794
Open
GabrielBBaldez wants to merge 1 commit into
Open
AWS: Use assumed-role credentials for REST SigV4 signing#16794GabrielBBaldez wants to merge 1 commit into
GabrielBBaldez wants to merge 1 commit into
Conversation
3 tasks
c17cfe7 to
c64c9eb
Compare
RESTSigV4AuthSession signs requests with AwsProperties#restCredentialsProvider(), whose decision chain only handled static rest.* keys, a custom client.credentials-provider, and otherwise the default credential chain. When the catalog is configured with AssumeRoleAwsClientFactory, the assumed role is applied to the S3/Glue/KMS/DynamoDB clients but never to the SigV4 REST signing path, so REST calls silently fall back to the default credential chain and diverge from the other AWS clients. Add an assume-role branch between the custom-provider and default-chain steps that returns an StsAssumeRoleCredentialsProvider built from the existing client.assume-role.* properties, mirroring AssumeRoleAwsClientFactory#createCredentialsProvider.
c64c9eb to
2c13a21
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
RESTSigV4AuthSessionsigns catalog requests withAwsProperties#restCredentialsProvider(), whose decision chain only handled three cases:rest.*keys →StaticCredentialsProviderclient.credentials-provider→ that providerDefaultCredentialsProviderThere was no branch for
client.assume-role.*. So when the catalog is configured withAssumeRoleAwsClientFactory, the assumed role is applied to the S3/Glue/KMS/DynamoDB clients (viaapplyAssumeRoleConfigurations) but never to the SigV4 REST signing path — REST calls silently fall back to the default credential chain and diverge from the other AWS clients.This adds an assume-role branch between the custom-provider and default-chain steps that returns an
StsAssumeRoleCredentialsProviderbuilt from the existingclient.assume-role.*properties (arn, region, session name, timeout, external id, tags), mirroringAssumeRoleAwsClientFactory#createCredentialsProvider. Explicit staticrest.*keys andclient.credentials-providerkeep precedence.This is the "fastest path" described in the issue. Happy to instead extract the STS provider construction into a shared utility (option 3 in the issue) if reviewers prefer to avoid the small duplication with
AssumeRoleAwsClientFactory.Closes #16667
Testing
New unit tests in
TestAwsProperties:restCredentialsProvider()returns anStsAssumeRoleCredentialsProviderDefaultCredentialsProviderrest.*keys → still returnsStaticCredentialsProvider(precedence preserved)./gradlew :iceberg-aws:test :iceberg-aws:spotlessJavaCheck :iceberg-aws:checkstyleMain :iceberg-aws:checkstyleTestpasses locally.