mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-01 19:47:39 +03:00
Prevent using URL wildcards in TLD
This commit is contained in:
parent
9ba6ada266
commit
0b5ae1775c
2 changed files with 5 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue