Skip to content

Conversation

@Ompragash
Copy link
Member

@Ompragash Ompragash commented Apr 7, 2025

Summary

The current implementation of the S3 client creation doesn't correctly handle scenarios where both primary credentials (access/secret keys, web identity, or initial role assumption) and secondary role assumption (via UserRoleArn) are used together. This causes authentication failures when users need to authenticate with one method and then assume a different role for S3 operations.

Solution

Refactor createS3Client method to properly chain authentication methods:

  1. First establish primary credentials (static credentials, web identity tokens, or initial role assumption)
  2. Create an authenticated session with those credentials
  3. If UserRoleArn is provided, use that authenticated session to assume the secondary role
  4. Preserve all configuration options (endpoint, path style, region, etc.) when creating the final client

Verification

The solution has been verified to work across all target environments:

IRSA Environment: Successful execution
Regular Kubernetes: Successful execution
Cloud Build: Successful execution

@Ompragash Ompragash marked this pull request as ready for review April 9, 2025 19:34
@Ompragash Ompragash requested a review from jamie-harness April 9, 2025 19:38
@Ompragash Ompragash merged commit 6655f98 into master Apr 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants