Bug 1373293 ignore and report invalid origin permissions, r?aswan draft
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 16 Jun 2017 09:49:27 -0700
changeset 595675 d3d513781122e120da0a10e9e8146a2eb7f51c63
parent 593475 91134c95d68cbcfe984211fa3cbd28d610361ef1
child 633767 fe21ff46ef91c2a7f07725d271a1ad435cd3e47a
push id64404
push usermixedpuppy@gmail.com
push dateFri, 16 Jun 2017 16:50:06 +0000
reviewersaswan
bugs1373293
milestone56.0a1
Bug 1373293 ignore and report invalid origin permissions, r?aswan MozReview-Commit-ID: 3CYjIJCcaeh
toolkit/components/extensions/Extension.jsm
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -558,20 +558,25 @@ this.ExtensionData = class {
         if (!acceptedExtensions.split(",").includes(this.id)) {
           this.manifestError("Only whitelisted extensions are allowed to access the geckoProfiler.");
           continue;
         }
       }
 
       let type = classifyPermission(perm);
       if (type.origin) {
-        let matcher = new MatchPattern(perm, {ignorePath: true});
+        try {
+          let matcher = new MatchPattern(perm, {ignorePath: true});
 
-        whitelist.push(matcher);
-        perm = matcher.pattern;
+          whitelist.push(matcher);
+          perm = matcher.pattern;
+        } catch (e) {
+          Cu.reportError(`Invalid origin permission ignored: ${perm}`);
+          continue;
+        }
       } else if (type.api) {
         this.apiNames.add(type.api);
       }
 
       this.permissions.add(perm);
     }
     this.whiteListedHosts = new MatchPatternSet(whitelist);