Skip to content
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

fix(middleware-websocket): pass options to presign in WebsocketSignatureV4 sign #5015

Merged
merged 2 commits into from Jul 26, 2023

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Jul 26, 2023

Issue

Fixes: #5011

Description

When systemClockOffset is set for RekognitionStreamingClient, the updated signingDate is not passed in presigned URL, and the presigner uses default Date.now(). This results in InvalidSignatureException on a websocket connection.

This PR passes the signing options while presigning the URL which includes updated signing date.

Testing

Used repro from #5011

No system clock offset

System time is 8:28am Pacific, and X-Amz-Date is 152800 UTC. No errors are returned

offset-config-no-machine-no-url offset-config-no-machine-no-messages
System Clock Offset of one hour

In this setup, the system time is manually set ahead by one hour, and a systemClockOffset of negative one hour (-3600000) passed in RekognitionStreamingClient.

The System time is 9:29am Pacific, but X-Amz-Date is 152918 UTC as required. No errors are returned.

offset-config-yes-machine-yes-url offset-config-yes-machine-yes-messages

Enabled client-transcribe-streaming E2E test which uses websocket, and verified that it's succeessful.

$ client-transcribe-streaming> yarn test:e2e
yarn run v1.22.17
$ jest --config jest.config.e2e.js
 PASS  test/index.e2e.spec.ts (8.079 s)
  TranscribeStream client
    ✓ should stream the transcript (5091 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        8.126 s
Ran all test suites.
Done in 8.88s.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr marked this pull request as ready for review July 26, 2023 15:45
@trivikr trivikr requested a review from a team as a code owner July 26, 2023 15:45
@trivikr trivikr changed the title fix(middleware-websocket): pass signing options in WebsocketSignatureV4 sign fix(middleware-websocket): pass options to presign in WebsocketSignatureV4 sign Jul 26, 2023
@trivikr trivikr merged commit 3663a9b into aws:main Jul 26, 2023
3 checks passed
@trivikr trivikr deleted the fix-system-clock-offset-websocket branch July 26, 2023 16:24
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug][rekognitionstreaming] Signature not yet current
4 participants