1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix lint errors

This commit is contained in:
Mark Stacey 2022-05-03 14:05:40 -02:30
parent c1ca70d732
commit 0110bd9571

View File

@ -37,13 +37,15 @@ function start() {
});
const redirectTarget = new URL(suspect.href, window.location.href);
// validate redirect url
const invalidProtocol = !(['https:', 'http:'].includes(redirectTarget.protocol));
const invalidProtocol = !['https:', 'http:'].includes(
redirectTarget.protocol,
);
// if in valid, show warning and abort
if (invalidProtocol) {
// we intentionally dont display to the user any potential attacker-written content here
console.error(`Invalid redirect url.`);
return;
};
}
// use the validated url instance
window.location.href = redirectTarget.href;
});