Passkeys: Fix parsing punycode domains

This commit is contained in:
varjolintu authored and Jonathan White committed 2026-09-21 22:26:59 -04:00
1 parent fd603849ee
commit dfdd561fc5
2 files changed
+6 -3

No files matched your search

+3 -3
View File
@@ -95,7 +95,7 @@ int PasskeyUtils::getEffectiveDomain(const QString& origin, QString* result) con
return ERROR_PASSKEYS_ORIGIN_NOT_ALLOWED;
}
const auto effectiveDomain = QUrl::fromUserInput(origin).host();
const auto effectiveDomain = QUrl::fromUserInput(origin).host(QUrl::FullyEncoded);
if (!isDomain(effectiveDomain)) {
return ERROR_PASSKEYS_DOMAIN_IS_NOT_VALID;
}
@@ -219,7 +219,7 @@ bool PasskeyUtils::isRegistrableDomainSuffix(const QString& hostSuffixString, co
return false;
}
const auto hostSuffix = QUrl::fromUserInput(hostSuffixString).host();
const auto hostSuffix = QUrl::fromUserInput(hostSuffixString).host(QUrl::FullyEncoded);
if (hostSuffix == originalHost) {
return true;
}
@@ -255,7 +255,7 @@ bool PasskeyUtils::isRegistrableDomainSuffix(const QString& hostSuffixString, co
bool PasskeyUtils::isDomain(const QString& hostName) const
{
const auto domain = QUrl::fromUserInput(hostName).host();
const auto domain = QUrl::fromUserInput(hostName).host(QUrl::FullyEncoded);
return !domain.isEmpty() && !domain.endsWith('.') && Tools::isAsciiString(domain)
&& !UrlTools::domainHasIllegalCharacters(domain) && !UrlTools::isIpAddress(hostName);
}
+3
View File
@@ -550,6 +550,9 @@ void TestPasskeys::testIsDomain()
QVERIFY(!passkeyUtils()->isDomain("example.com."));
QVERIFY(!passkeyUtils()->isDomain("127.0.0.1"));
QVERIFY(!passkeyUtils()->isDomain("127.0.0.1."));
QVERIFY(passkeyUtils()->isDomain("xn--e1afmkfd.xn--p1ai"));
QVERIFY(passkeyUtils()->isDomain("xn--x-zfa.fi"));
}
// List from https://html.spec.whatwg.org/multipage/browsers.html#is-a-registrable-domain-suffix-of-or-is-equal-to