Preserve AWS_CREDENTIALS during auth scheme resolution#6926
Merged
S-Saranya1 merged 2 commits intofeature/master/core-interceptors-migrationfrom Apr 30, 2026
Conversation
…-set AWS_CREDENTIALS during auth scheme resolution
dagnir
reviewed
Apr 30, 2026
| && (!requestHost.equals(preModifyUri.getHost()) | ||
| || !String.valueOf(request.protocol()).equals(preModifyUri.getScheme()) | ||
| || request.port() != preModifyUri.getPort()); | ||
| || (requestPort != null && requestPort != preModifyUri.getPort())); |
Contributor
There was a problem hiding this comment.
Can this be replaced with Objects.equals()?
Author
There was a problem hiding this comment.
Hmm, when no port is set, the SDK returns null but URI.getPort() returns -1, so Objects.equals() would be incorrect and needs special handling for this when no port is set case. So just skipping the comparison when port is null.
dagnir
approved these changes
Apr 30, 2026
21e089f
into
feature/master/core-interceptors-migration
13 of 30 checks passed
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation and Context
Previously some customers override AWS credentials for specific requests by setting AwsSignerExecutionAttribute.AWS_CREDENTIALS in their execution interceptors. After moving auth scheme resolution from interceptors to a dedicated pipeline stage (#6755), these interceptor-set credentials were being ignored.
This happened because after moving auth scheme resolution to a pipeline stage, credentials are now freshly resolved in AuthSchemeResolutionStage. Since this stage runs after all interceptors, the freshly resolved credentials replace whatever the interceptor had set via AWS_CREDENTIALS.
Modifications
Fix 1:
Updated IdentityProviderUpdater to accept ExecutionAttributes and check for interceptor-set AWS_CREDENTIALS before resolving credentials. If an interceptor has set credentials, they are wrapped in a StaticCredentialsProvider and used instead of the default provider.
Credentials are resolved in this priority order:
This matches the behavior before the migration.
Changes:
Fix 2 : Fixed NPE in EndpointResolutionStage on null port
Fixed a NullPointerException in EndpointResolutionStage when comparing request ports. The port can be null when no explicit port is set, and the comparison was not null-safe.
Testing
Verified with existing unit test in IdentityResolutionOverrideTest which covers credential override scenarios including interceptor-set AWS_CREDENTIALS, request-level overrides, and default credentials provider fallback.
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License