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
feat: support per-request region and service override in signer #1444
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1444 +/- ##
==========================================
- Coverage 79.69% 79.65% -0.05%
==========================================
Files 302 296 -6
Lines 11402 11392 -10
Branches 2438 2435 -3
==========================================
- Hits 9087 9074 -13
- Misses 2315 2318 +3
Continue to review full report at Codecov.
|
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.
LGTM, some minor nits
signingService, | ||
} = options; | ||
const credentials = await this.credentialProvider(); | ||
const region = signingRegion || (await this.regionProvider()); |
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.
Use Nullish coalescing operator (??)?
const region = signingRegion || (await this.regionProvider()); | |
const region = signingRegion ?? (await this.regionProvider()); |
Ditto on other places when ||
is used: 137, 178, 180 etc
The codebuild succeeds after retry. See log |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Description of changes:
The PR makes change to SigV4 signer to support per-request region and service override. Specifically, users can specify
signingRegion
andsigningService
when signing a request, string, or event. ThesigningRegion
andsigningService
will override theregion
andservice
configuration specified in SigV4 constructor. The override is only effective for one sign invocation.In the
@aws-sdk/middleware-signing
, the signing middleware will inspect the value in theHandlerExecutionContext
looking forsigning_region
andsigning_service
value. If the values are set by previous middleware, it mean the signer should use a different signing region or signing service for the specified request. So the middleware will call thesign()
with the overriden region or service.This change is useful in infering region or signing service from the operation parameters, e.g. ARN supplied in s3 bucket parameter
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.