We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef3d93f commit 0a67d32Copy full SHA for 0a67d32
src/shared/auth.ts
@@ -9,12 +9,8 @@ export const SafeUrlSchema = z.string().url()
9
{message: "URL must be parseable"}
10
).refine(
11
(url) => {
12
- const u = url.trim().toLowerCase();
13
- return !(
14
- u.startsWith('javascript:') ||
15
- u.startsWith('data:') ||
16
- u.startsWith('vbscript:')
17
- );
+ const u = new URL(url);
+ return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:';
18
},
19
{ message: "URL cannot use javascript:, data:, or vbscript: scheme" }
20
);
0 commit comments