Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 469
feat(backend): Limit handshake to document requests#2352
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
99c6620b103ec7412c5f5841b0eb0759578df9aba8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@clerk/backend': patch | ||
| --- | ||
| Update the handshake flow to only trigger for document requests. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -123,6 +123,7 @@ export default (QUnit: QUnit) => { | ||
| const defaultHeaders: Record<string, string> = { | ||
| host: 'example.com', | ||
| 'user-agent': 'Mozilla/TestAgent', | ||
| 'sec-fetch-dest': 'document', | ||
| }; | ||
| const mockRequest = (headers = {}, requestUrl = 'http://clerk.com/path') => { | ||
| @@ -268,9 +269,7 @@ export default (QUnit: QUnit) => { | ||
| test('cookieToken: returns handshake when clientUat is missing or equals to 0 and is satellite and not is synced [11y]', async assert => { | ||
| const requestState = await authenticateRequest( | ||
| mockRequestWithCookies( | ||
| { | ||
| 'Sec-Fetch-Dest': 'document', | ||
| }, | ||
| {}, | ||
| { | ||
| __client_uat: '0', | ||
| }, | ||
| @@ -299,6 +298,7 @@ export default (QUnit: QUnit) => { | ||
| mockRequestWithCookies( | ||
| { | ||
| ...defaultHeaders, | ||
| 'sec-fetch-dest': 'empty', | ||
| 'user-agent': '[some-agent]', | ||
| }, | ||
| { __client_uat: '0' }, | ||
| @@ -388,12 +388,13 @@ export default (QUnit: QUnit) => { | ||
| assert.strictEqual(requestState.toAuth(), null); | ||
| }); | ||
| test('cookieToken: returns undefined when crossOriginReferrer in development and is satellite [6n]', async assert => { | ||
| test('cookieToken: returns signedIn when satellite but valid token and clientUat', async assert => { | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test name was inaccurate 🧐 | ||
| // Scenario: after auth action on Clerk-hosted UIs | ||
| const requestState = await authenticateRequest( | ||
| mockRequestWithCookies( | ||
| { | ||
| ...defaultHeaders, | ||
| 'sec-fetch-dest': 'empty', | ||
| // this is not a typo, it's intentional to be `referer` to match HTTP header key | ||
| referer: 'https://clerk.com', | ||
| }, | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Now that we're defaulting to
sec-fetch-dest: document, we need to explicitly set it to empty for this test case