Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60903


Change subject: Bug fix to protocol sanitizer.
......................................................................

Bug fix to protocol sanitizer.

Thanks, jshint!

Change-Id: Idd2d7b519785f3da7cb597f392045899a45d1398
---
M js/lib/ext.core.Sanitizer.js
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/03/60903/1

diff --git a/js/lib/ext.core.Sanitizer.js b/js/lib/ext.core.Sanitizer.js
index bf3c6bf..9e9c446 100644
--- a/js/lib/ext.core.Sanitizer.js
+++ b/js/lib/ext.core.Sanitizer.js
@@ -559,7 +559,7 @@
                this.noEndTagHash = { br: 1 };
 
                this.tagWhiteListHash = 
Util.arrayToHash(WikitextConstants.Sanitizer.TagWhiteList);
-               this.validProtocolsRE = new RegExp("^(" + 
this.validUrlProtocols.join('|') + ")$" );
+               this.validProtocolsRE = new RegExp("^(" + 
this.validUrlProtocols.join('|') + ")$", "i" );
                //|/?[^/])[^\\s]+$");
                this.cssDecodeRE = computeCSSDecodeRegexp();
                this.attrWhiteList = computeAttrWhiteList(this.globalConfig);
@@ -616,7 +616,7 @@
                proto = bits[1];
                host = bits[2];
                path = bits[3];
-               if ( ! proto.match(this.hrefRE)) {
+               if ( ! proto.match(this.constants.validProtocolsRE)) {
                        // invalid proto, disallow URL
                        return null;
                }
@@ -886,7 +886,6 @@
        var html5Mode = this.constants.globalConfig.html5Mode;
        var xmlnsRE   = this.constants.XMLNS_ATTRIBUTE_RE;
        var evilUriRE = this.constants.EVIL_URI_RE;
-       var hrefRE    = this.constants.validProtocolsRE;
 
        var wlist = this.getAttrWhiteList(tag);
        //console.warn('wlist: ' + JSON.stringify(wlist));

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd2d7b519785f3da7cb597f392045899a45d1398
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

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

Reply via email to