Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/polite-poems-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Correctly use updated protocol verification in all code paths
7 changes: 5 additions & 2 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import type {

import type { MountComponentRenderer } from '../ui/Components';
import {
ALLOWED_PROTOCOLS,
buildURL,
completeSignUpFlow,
createAllowedRedirectOrigins,
Expand Down Expand Up @@ -782,8 +783,10 @@ export class Clerk implements ClerkInterface {

let toURL = new URL(to, window.location.href);

if (toURL.protocol !== 'http:' && toURL.protocol !== 'https:') {
console.warn('Clerk: Not a valid protocol. Redirecting to /');
if (!ALLOWED_PROTOCOLS.includes(toURL.protocol)) {
console.warn(
`Clerk: "${toURL.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`,
);
toURL = new URL('/', window.location.href);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/clerk-js/src/utils/windowNavigate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const CLERK_BEFORE_UNLOAD_EVENT = 'clerk:beforeunload';

const ALLOWED_PROTOCOLS = [
export const ALLOWED_PROTOCOLS = [
'http:',
'https:',
// Refers to https://wails.io/
Expand Down