Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/uid2/core/service/JWTTokenProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -154,7 +154,7 @@ private static KmsClient getKmsClient(KmsClientBuilder kmsClientBuilder, JsonObj
throw e;
}
} else {
WebIdentityTokenFileCredentialsProvider credentialsProvider = WebIdentityTokenFileCredentialsProvider.create();
DefaultCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Review: With WebIdentityTokenFileCredentialsProvider the IAM principal was always the IRSA service-account role β€” scope was predictable. With DefaultCredentialsProvider the resolved principal depends on the runtime environment (personal IAM user on a dev laptop, shared CI role, etc.). Confirm KMS key policies are updated to allow the new EKS Pod Identity role ARN, and that local/CI environments mock KMS or use a separate key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 getKmsClient (the else-branch changed here). Consider adding a test that passes a JsonObject without kmsAccessKey/kmsSecretKey and asserts the builder receives a DefaultCredentialsProvider, so a future regression would be caught by CI.


client = kmsClientBuilder
.region(Region.of(region))
Expand Down
Loading