Sanitize URLs before passing them to FindProxyForURL
authorAlbert Astals Cid <aacid@kde.org>
Tue, 28 Feb 2017 18:00:48 +0000 (19:00 +0100)
committerMaximiliano Curia <maxy@debian.org>
Wed, 5 Apr 2017 08:10:59 +0000 (09:10 +0100)
Remove user/password information
For https: remove path and query

Thanks to safebreach.com for reporting the problem

CCMAIL: yoni.fridburg@safebreach.com
CCMAIL: amit.klein@safebreach.com
CCMAIL: itzik.kotler@safebreach.com

Gbp-Pq: Name Sanitize-URLs-before-passing-them-to-FindProxyForURL.patch

src/kpac/script.cpp

index b009bc993573678f560678a5809d1106ad108fb6..916f647a8ae8450c1b5e146f4311f417f5adc792 100644 (file)
@@ -754,9 +754,16 @@ QString Script::evaluate(const QUrl &url)
         }
     }
 
+    QUrl cleanUrl = url;
+    cleanUrl.setUserInfo(QString());
+    if (cleanUrl.scheme() == QLatin1String("https")) {
+        cleanUrl.setPath(QString());
+        cleanUrl.setQuery(QString());
+    }
+
     QScriptValueList args;
-    args << url.url();
-    args << url.host();
+    args << cleanUrl.url();
+    args << cleanUrl.host();
 
     QScriptValue result = func.call(QScriptValue(), args);
     if (result.isError()) {