Update browsermanager

This commit is contained in:
Cynthia Long
2026-03-10 17:27:34 +00:00
parent 28a06e44f9
commit 9041900df4
@@ -482,9 +482,12 @@ export class BrowserManager {
if (!url) { if (!url) {
return true; return true;
} }
if (typeof url !== 'string') {
throw new Error('Invalid URL: URL must be a string.');
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion try {
const parsedUrl = new URL(url as string); const parsedUrl = new URL(url);
const urlHostname = parsedUrl.hostname; const urlHostname = parsedUrl.hostname;
for (const domainPattern of allowedDomains) { for (const domainPattern of allowedDomains) {
@@ -502,6 +505,10 @@ export class BrowserManager {
} }
} }
} }
} catch {
throw new Error('Invalid URL: Malformed URL string.');
}
// If none matched, then deny // If none matched, then deny
return false; return false;
} }