1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

validate proper duo hostnames (#12149)

This commit is contained in:
Kyle Spearrin
2024-11-25 11:57:49 -05:00
committed by GitHub
parent cf52c6030e
commit f65a39d6d8

View File

@@ -51,14 +51,12 @@ window.addEventListener("load", async () => {
*/
function redirectToDuoFrameless(redirectUrl: string) {
const validateUrl = new URL(redirectUrl);
const validDuoUrl =
validateUrl.protocol === "https:" &&
(validateUrl.hostname.endsWith(".duosecurity.com") ||
validateUrl.hostname.endsWith(".duofederal.com"));
if (
validateUrl.protocol !== "https:" ||
!(
validateUrl.hostname.endsWith("duosecurity.com") ||
validateUrl.hostname.endsWith("duofederal.com")
)
) {
if (!validDuoUrl) {
throw new Error("Invalid redirect URL");
}