Yurik has submitted this change and it was merged.

Change subject: Security fixes per review
......................................................................


Security fixes per review

* Set defaultProtocol to https
* Added an extra check to make sure protocol is http or https

Bug: T93126
Change-Id: If19d4e0204f17220ff49ab06bcc573be9f97e7b5
---
M routes/v1.js
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  CSteipp: Looks good to me, approved
  Yurik: Verified



diff --git a/routes/v1.js b/routes/v1.js
index 1fdf721..c4d041b 100644
--- a/routes/v1.js
+++ b/routes/v1.js
@@ -30,7 +30,7 @@
 /**
  * For protocol-relative URLs  (they begin with //), which protocol should we 
use
  */
-var defaultProtocol = 'http';
+var defaultProtocol = 'https';
 
 /**
  * Limit request to 10 seconds by default
@@ -110,6 +110,9 @@
             var parts = urllib.parse(url);
             if (!parts.protocol || !parts.hostname) {
                 url = null;
+            } else if (parts.protocol !== 'http:' && parts.protocol !== 
'https:') {
+                // load.sanitizeUrl() already does this, but double check to 
be safe
+                url = null;
             }
         }
         if (url && domainMap) {

-- 
To view, visit https://gerrit.wikimedia.org/r/202917
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If19d4e0204f17220ff49ab06bcc573be9f97e7b5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/graphoid
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to