-
Notifications
You must be signed in to change notification settings - Fork 8
UID2-4739: use DefaultCredentialsProvider for KMS client in JWTTokenProvider #406
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| import java.util.function.Supplier; | ||
|
|
||
| import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; | ||
| import software.amazon.awssdk.auth.credentials.WebIdentityTokenFileCredentialsProvider; | ||
| import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; | ||
| import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; | ||
| import software.amazon.awssdk.core.SdkBytes; | ||
| import software.amazon.awssdk.regions.Region; | ||
|
|
@@ -154,7 +154,7 @@ private static KmsClient getKmsClient(KmsClientBuilder kmsClientBuilder, JsonObj | |
| throw e; | ||
| } | ||
| } else { | ||
| WebIdentityTokenFileCredentialsProvider credentialsProvider = WebIdentityTokenFileCredentialsProvider.create(); | ||
| DefaultCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude Review: With
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude Review: No unit tests appear to cover the non-static-credentials branch of |
||
|
|
||
| client = kmsClientBuilder | ||
| .region(Region.of(region)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude Review:
DefaultCredentialsProvider.create()walks a multi-step chain on first call: env vars β system properties β web-identity token file β EKS Pod Identity β EC2 IMDS β ECS credentials. In a cold-start or misconfigured environment this can add latency (IMDS timeouts are 1 s by default, retried twice) before failing. Consider whether the KMS client construction path is latency-sensitive at startup; if so, add an inline comment naming the expected credential source so operators know what to look for when diagnosing slow starts.