Skip to content

AWS: Support assumed role credentials for REST SigV4 signing#16687

Open
Martozar wants to merge 1 commit into
apache:mainfrom
Martozar:aws-rest-sigv4-assume-role
Open

AWS: Support assumed role credentials for REST SigV4 signing#16687
Martozar wants to merge 1 commit into
apache:mainfrom
Martozar:aws-rest-sigv4-assume-role

Conversation

@Martozar
Copy link
Copy Markdown

@Martozar Martozar commented Jun 5, 2026

Motivation

When client.assume-role.arn is set, AWS clients created by AssumeRoleAwsClientFactory (S3, Glue, DynamoDB, KMS) assume the configured role, but the REST catalog SigV4 signer keeps signing requests with the base credentials. Catalog requests and data access are therefore performed as two different identities, which breaks credential-less setups (instance profile / IRSA base credentials + a cross-account role) against SigV4-signed REST catalogs.

Changes

  • AwsProperties.restCredentialsProvider() wraps the base credentials in an auto-refreshing StsAssumeRoleCredentialsProvider when client.assume-role.arn is set, reusing the existing client.assume-role.* properties (session name, external-id, timeout, tags) consistently with AssumeRoleAwsClientFactory.
  • The returned provider is SdkAutoCloseable and closes the underlying STS client and therefore performed as two different identities, which breaks credential-less setups (instance profile / IRSA base credentials + a cross-account role) against SigV4-signed REST catalogs.

Changes

  • AwsProperties.restCredentialsProvider() wraps the base credentials in an auto-refreshing StsAssumeRoleCredentialsProvider when client.assume-role.arn is set, auto-refreshing StsAssumeRoleCredentialsProvider when client.assume-role.arn is set, reusing the existing client.assume-role.* properties (session name, external-id, timeout, tags) consistently with AssumeRoleAwsClientFactory.
  • The returned provider is SdkAutoCloseable and closes the underlying STS client and base provider; RESTSigV4AuthSession already closes closeable providers since #.

Behavior change

Users who set client.assume-role.arn for data access while SigV4-signing with base credentials will now sign catalog requests with the assumed role. This is the intended consistency fix, but it changes the signing identity for that configuration.

Alternatives considered

client.credentials-provider with a custom provider class: requires every user to ship a wrapper class, since the SDK's StsAssumeRoleCredentialsProvider has no static create()/create(Map) factory.

Testing

New unit tests in TestAwsProperties and TestRESTSigV4AuthSession; ./gradlew :iceberg-aws:check passes.

AI disclosure

Drafted with AI assistance (Claude Code) based on a patch we run in production against StarRocks-bundled Iceberg; design, tests and verification reviewed by the author. Reviewer attention welcome on the STS client lifecycle/closing in AssumeRoleRestCredentialsProvider.

When client.assume-role.arn is set, AWS clients created by
AssumeRoleAwsClientFactory assume the configured role, but the REST
catalog SigV4 signer kept signing requests with the base credentials.

Wrap the base credentials in an auto-refreshing
StsAssumeRoleCredentialsProvider so that REST catalog requests and data
access are performed with the same assumed role. This enables
credential-less SigV4 REST catalog authentication (e.g. instance
profile or IRSA base credentials combined with a cross-account role).

The returned provider closes the underlying STS client and base
credentials provider when the auth session is closed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant