-
Notifications
You must be signed in to change notification settings - Fork 616
fix(middleware-sdk-transcribe-streaming): unsign the non host headers #1336
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1336 +/- ##
=======================================
Coverage 77.67% 77.67%
=======================================
Files 286 287 +1
Lines 11955 11970 +15
Branches 2623 2626 +3
=======================================
+ Hits 9286 9298 +12
- Misses 2669 2672 +3
Continue to review full report at Codecov.
|
f50c592
to
c0bc9cb
Compare
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
const signedRequest = await this.signer.presign({ ...toSign, body: "" }, { | ||
expiresIn: 5 * 60 // presigned url must be expired within 5 mins | ||
} as any); | ||
// the payload hash would be UNSINGED-PAYLOAD |
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.
nit
// the payload hash would be UNSINGED-PAYLOAD | |
// the payload hash would be UNSIGNED-PAYLOAD |
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.
This is fixed
} | ||
}); | ||
const signed = await signer.sign(toSign); | ||
expect(toSign).toMatchObject(signed); |
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.
presign is mocked, so it should return undefined. So I'm not sure how this expect is successful.
Add a mockImplementation for presign function, and check the value returned with signed.
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.
It is fixed in 6e86721
c0bc9cb
to
55f45b9
Compare
55f45b9
to
4b148a3
Compare
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. |
Issue #, if available:
Description of changes:
Transcribe streaming's WebSocket request omits the request headers. So we should not sign any header other than
host
. Because if the header is signed, but not sent to the service, the signature is mismatch.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.