Preserve interceptor-set signer properties across auth scheme and endpoint resolution#6961
Open
S-Saranya1 wants to merge 2 commits into
Conversation
alextwoods
reviewed
May 13, 2026
| public static final ExecutionAttribute<IdentityProviderUpdater> IDENTITY_PROVIDER_UPDATER = | ||
| new ExecutionAttribute<>("IdentityProviderUpdater"); | ||
|
|
||
| /** |
|
|
||
| AuthSchemeOption.Builder mergedOption = selectedAuthScheme.authSchemeOption().toBuilder(); | ||
|
|
||
| existingAuthScheme.authSchemeOption().forEachSignerProperty(new AuthSchemeOption.SignerPropertyConsumer() { |
Contributor
There was a problem hiding this comment.
Have we benchmarked this? I'm a little concerned about the performance impact - I'm wondering if theres some way we could at least short circuit this when no interceptors have run. Or can we do an identity check on the authSchemeOption (like beforeInterceptors.authSchemeOption() == selectedAuthScheme.authSchemeOption() ) -since they are immutable, if you change them, it requires building a new object, so could be a quick way to see if any mutation has happened?
Author
There was a problem hiding this comment.
Good point! Added the check to skips the merge when no interceptors have run.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Customers can override signing properties (like signing region, signing name, payload signing) through execution interceptors using AwsSignerExecutionAttribute. For example:
executionAttributes.putAttribute(AwsSignerExecutionAttribute.SIGNING_REGION, Region.of("eu-west-1"));
After moving auth scheme resolution and endpoint resolution from interceptors to pipeline stages (#6755, #6820), these interceptor-set values were being lost. This happened because:
Previously this worked because interceptors ran AFTER auth scheme resolution (which happened in a beforeExecution interceptor), so interceptor writes were the last mutation.
why simple merge won't work : A simple force-overwrite of all pre-existing properties would break services where endpoint rules legitimately change the signing region (e.g., IAM resolves to us-east-1 regardless of client region). The pre-existing SELECTED_AUTH_SCHEME contains both SDK-default values (set by AwsExecutionContextBuilder) and interceptor-set values, they look identical (both are signer properties on the auth scheme option). Force-overwriting all of them would cause SDK defaults to override endpoint-rules-resolved values. Using
putSignerPropertyIfAbsentfor all of them would cause interceptor-set values to be ignored (since the resolved scheme already has those properties). We need to distinguish between the two.Modifications
Core idea: Snapshot SELECTED_AUTH_SCHEME before and after interceptors run. Diff the two to identify which properties the interceptor explicitly changed. Force-overwrite those onto the resolved auth scheme, while letting resolved values win for unchanged (SDK-default) properties.
SdkInternalExecutionAttribute— Added two snapshot attributes:AwsExecutionContextBuilder— Snapshots SELECTED_AUTH_SCHEME before running interceptors.AuthSchemeResolutionStage— After resolving the auth scheme:EndpointResolutionStage— After the endpoint callback may overwrite SELECTED_AUTH_SCHEME, calls applyInterceptorModifiedProperties() which re-applies interceptor-modified properties using the same diff logic.AuthSchemeResolver— Added mergePreExistingAuthSchemeProperties() and applyInterceptorModifiedProperties() with the diff-based merge logic.ExecutionAttributeBackwardsCompatibilityTest— Removed the 3 attribute exclusions from the beforeExecution test. Previously, beforeExecution couldn't override signing region, signing name, and double-url-encode because endpoint rules would overwrite them. With the fix, all interceptor stages can now override all signer properties.Testing
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