mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-13 01:26:37 -04:00
Prevent using URL wildcards in TLD
This commit is contained in:
parent
8d1898bd0b
commit
6197893e01
@ -195,7 +195,7 @@ bool UrlTools::isUrlValid(const QString& urlField, bool looseComparison) const
|
||||
// Prevent TLD wildcards
|
||||
if (looseComparison && url.contains(UrlTools::URL_WILDCARD)) {
|
||||
const auto tld = getTopLevelDomainFromUrl(url);
|
||||
if (qUrl.host() == QString("%1.%2").arg(UrlTools::URL_WILDCARD, tld)) {
|
||||
if (tld.contains(UrlTools::URL_WILDCARD) || qUrl.host() == QString("%1.%2").arg(UrlTools::URL_WILDCARD, tld)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,10 @@ void TestUrlTools::testIsUrlValidWithLooseComparison()
|
||||
urls["*.com/"] = false;
|
||||
urls["*.com/*"] = false;
|
||||
urls["**.com/**"] = false;
|
||||
urls["*.*"] = false;
|
||||
urls["https://example.*"] = false;
|
||||
urls["https://*.example.*"] = false;
|
||||
urls["https://example.c*"] = false;
|
||||
|
||||
QHashIterator<QString, bool> i(urls);
|
||||
while (i.hasNext()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user