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 c7ff3b1 commit cd6b912Copy full SHA for cd6b912
apps/dashboard/src/app/login/isValidEncodedRedirectPath.ts
@@ -1,10 +1,11 @@
1
export function isValidEncodedRedirectPath(encodedPath: string): boolean {
2
try {
3
- // Decode the URI component
4
const decodedPath = decodeURIComponent(encodedPath);
5
- // ensure the path always starts with a _single_ slash
6
- // double slash could be interpreted as `//example.com` which is not allowed
7
- return decodedPath.startsWith("/") && !decodedPath.startsWith("//");
+ if (!decodedPath.startsWith("/")) {
+ return false;
+ }
+ const url = new URL(decodedPath, "https://thirdweb.com");
8
+ return url.hostname === "thirdweb.com";
9
} catch {
10
// If decoding fails, return false
11
return false;
0 commit comments