Skip to content

Commit 14a91a3

Browse files
committed
Fix: Replace z.httpUrl() with z.url() constrained to http/https for localhost compatibility
z.httpUrl() rejects localhost URLs, causing Zod validation errors during local development when verifying email. z.url() with a protocol constraint still restricts to http/https while accepting localhost. Existing isExternalOrigin checks already handle redirect security. Closes #241
1 parent d83c4d0 commit 14a91a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/app/api/auth/confirm/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { z } from 'zod'
99
const confirmSchema = z.object({
1010
token_hash: z.string().min(1),
1111
type: OtpTypeSchema,
12-
next: z.httpUrl(),
12+
next: z.url({ protocol: /^https?$/ }),
1313
})
1414

1515
/**

src/server/api/models/auth.models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type OtpType = z.infer<typeof OtpTypeSchema>
1414
export const ConfirmEmailInputSchema = z.object({
1515
token_hash: z.string().min(1),
1616
type: OtpTypeSchema,
17-
next: z.httpUrl(),
17+
next: z.url({ protocol: /^https?$/ }),
1818
})
1919

2020
export type ConfirmEmailInput = z.infer<typeof ConfirmEmailInputSchema>

0 commit comments

Comments
 (0)