Skip to content
Snippets Groups Projects
Verified Commit 147dc9d4 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Use allow list for URI schemes

parent b030eb92
No related branches found
No related tags found
No related merge requests found
Pipeline #1935 failed
......@@ -61,7 +61,17 @@ Nheko::openLink(QString link) const
QUrl url(link);
// Open externally if we couldn't handle it internally
if (!ChatPage::instance()->handleMatrixUri(url)) {
QDesktopServices::openUrl(url);
const QStringList allowedUrlSchemes = {
"http",
"https",
"mailto",
};
if (allowedUrlSchemes.contains(url.scheme()))
QDesktopServices::openUrl(url);
else
nhlog::ui()->warn("Url '{}' not opened, because the scheme is not in the allow list",
url.toDisplayString().toStdString());
}
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment