authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:41:03-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:41:03-07:00
logcb58dfd6453171a88183fc7bf1587bae6929c0e4
treef0bbd8b9144cc89e12d3424ab0096d070353edac
parent6270a6f88bea4c2fe07a43e69693a918cf94a353
signature Signed by PGP key B5690EEEBB952194

refactor(shared): remove unused Clerk hostname predicate (#10008)


2 files changed, 0 insertions(+), 22 deletions(-)

packages/shared/src/relayAuth.test.ts-11
......@@ -5,7 +5,6 @@ import {
55 ClerkPublishableKeyFrontendApiError,
66 clerkFrontendApiHostnameFromPublishableKey,
77 clerkFrontendApiUrlFromPublishableKey,
8 isAllowedClerkFrontendApiHostname,
98} from "./relayAuth.ts";
109
1110const clerkPublishableKey = (hostname: string): string => `pk_test_${btoa(`${hostname}$`)}`;
......@@ -75,14 +74,4 @@ describe("Clerk relay auth", () => {
7574 });
7675 expect((error as ClerkPublishableKeyFrontendApiError).cause).toBeInstanceOf(Error);
7776 });
78
79 it("allows standard Clerk hosts and an exact configured custom hostname", () => {
80 expect(isAllowedClerkFrontendApiHostname("example.clerk.accounts.dev", null)).toBe(true);
81 expect(isAllowedClerkFrontendApiHostname("example.clerk.accounts.com", null)).toBe(true);
82 expect(isAllowedClerkFrontendApiHostname("clerk.t3.codes", "clerk.t3.codes")).toBe(true);
83 expect(isAllowedClerkFrontendApiHostname("attacker.example", "clerk.t3.codes")).toBe(false);
84 expect(isAllowedClerkFrontendApiHostname("nested.clerk.t3.codes", "clerk.t3.codes")).toBe(
85 false,
86 );
87 });
8877});
packages/shared/src/relayAuth.ts-11
......@@ -81,17 +81,6 @@ export function clerkFrontendApiHostnameFromPublishableKey(publishableKey: strin
8181 return parseClerkFrontendApi(publishableKey).hostname;
8282}
8383
84export function isAllowedClerkFrontendApiHostname(
85 hostname: string,
86 configuredHostname: string | null,
87): boolean {
88 return (
89 hostname.endsWith(".clerk.accounts.dev") ||
90 hostname.endsWith(".clerk.accounts.com") ||
91 hostname === configuredHostname
92 );
93}
94
9584export function relayClerkTokenOptions(template: string) {
9685 return {
9786 template,