Fix isClientSignerOverridden to check actual value #4473
Merged
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
isSignerOverridden is used in AwsExecutionContextBuilder.
The SIGNER_OVERRIDDEN ExecutionAttribute is set here
aws-sdk-java-v2/core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/AwsExecutionContextBuilder.java
Line 110 in 32390a2
And isSignerOverridden is called here
aws-sdk-java-v2/core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/AwsExecutionContextBuilder.java
Line 156 in 32390a2
which is called here
aws-sdk-java-v2/core/aws-core/src/main/java/software/amazon/awssdk/awscore/internal/AwsExecutionContextBuilder.java
Lines 129 to 136 in 32390a2
So when the client is configured if SIGNER_OVERRIDDEN is non-null, loadSigner would have been true. In master branch, SIGNER_OVERRIDDEN was always null or true. In the SRA branch now, it can be null or true or false. See comment in.
In SRA branch now, Signer is always null, so even if loadSigner is called, the ExecutionContext.signer here will be null, so the SRA HttpSigner gets used, which is all fine. However, the call to
addCredentialsToExecutionAttributesmeans identity resolution happens there a second time (1st time happened in AuthSchemeInterceptor, which happens before this point). More than the issue of happening twice (which adds a small risk of that call failing), because of the derived attribute logic from #4396, addCredentialsToExecutionAttributes will result in the identity to be updated in SelectedAuthScheme, which would break identity property based auth resolution for an upcoming service.Modifications
Check that the value of SIGNER_OVERRIDDEN is present instead of just isPresent.
Testing
I realized this issue while stepping through the debugger for some other testing I was doing and noticed going into loadSigner branch unexpectedly. Verified after this change, it doesn't go into that branch.
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