Skip to content

Commit 053dd99

Browse files
committed
fix: Critical: Missing error handling for URL constructor.
1 parent a01e90e commit 053dd99

File tree

1 file changed

+9
-4
lines changed
  • infrastructure/eid-wallet/src/routes/(app)/scan-qr

1 file changed

+9
-4
lines changed

infrastructure/eid-wallet/src/routes/(app)/scan-qr/+page.svelte

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,20 @@ onMount(async () => {
111111
platform = params.get("platform");
112112
session = params.get("session");
113113
redirect = params.get("redirect");
114-
hostname = new URL(redirect as string).hostname;
115114
if (!redirect || !platform || !session) {
116115
console.error("Bad deeplink!");
117116
break;
118117
}
118+
try {
119+
hostname = new URL(redirect as string).hostname;
120+
} catch (error) {
121+
console.error("Invalid redirect URL:", error);
122+
break;
123+
}
119124
// Validate platform name
120125
if (!/^[a-zA-Z0-9-_.]+$/.test(platform)) {
121126
console.error("Invalid platform name format");
122-
return;
127+
break;
123128
}
124129
125130
// Validate session format (UUID)
@@ -129,7 +134,7 @@ onMount(async () => {
129134
)
130135
) {
131136
console.error("Invalid session format");
132-
return;
137+
break;
133138
}
134139
135140
// Validate redirect URL domain
@@ -139,7 +144,7 @@ onMount(async () => {
139144
)
140145
) {
141146
console.error("Invalid redirect URL format.");
142-
return;
147+
break;
143148
}
144149
codeScannedDrawerOpen = true;
145150
scanning = false;

0 commit comments

Comments
 (0)