Potential fix for code scanning alert no. 97: Incomplete URL substring sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Tanmay Deep Sharma
2025-05-28 20:22:03 +05:30
committed by GitHub
co-authored by Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
parent e4cd585513
commit 7c4e8346f8
@@ -124,7 +124,14 @@ export default {
handleSignupMessage(event) {
// Handle Facebook embedded signup message events
if (!event.origin.endsWith('facebook.com')) return;
try {
const originUrl = new URL(event.origin);
const allowedHosts = ['facebook.com', 'www.facebook.com'];
if (!allowedHosts.includes(originUrl.hostname)) return;
} catch (error) {
// Invalid origin URL, reject the event
return;
}
try {
const data = JSON.parse(event.data);