mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-24 11:01:38 -08:00
Passkeys: Fix parsing punycode domains
This commit is contained in:
1 parent
fd603849ee
commit
dfdd561fc5
2 files changed
+6
-3
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user