Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json

VERIFIED FIXED in Firefox 51

Status

defect
P1
normal
VERIFIED FIXED
3 years ago
Last year

People

(Reporter: bsilverberg, Assigned: bsilverberg)

Tracking

({addon-compat})

unspecified
mozilla51
Dependency tree / graph

Firefox Tracking Flags

(firefox51 verified)

Details

(Whiteboard: triaged)

Attachments

(1 attachment)

This is a follow-up to bug #1297752 to change the warning to an error. The intent is to uplift bug #1297752, which only generates a warning, to beta, and then to let this bug, which will generate an error, preventing installation, to ride the trains.
Assignee: nobody → bob.silverberg
Status: NEW → ASSIGNED
Comment on attachment 8787333 [details]
Bug 1298923 - Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json,

https://reviewboard.mozilla.org/r/76130/#review75242

::: toolkit/mozapps/extensions/internal/XPIProvider.jsm:934
(Diff revision 1)
>      logger.warn("Ignoring applications property in manifest");
>    }
>  
>    // A * is illegal in strict_min_version
>    if (bss.strict_min_version && bss.strict_min_version.split(".").some(part => part == "*")) {
> -    logger.warn("The use of '*' in strict_min_version is deprecated");
> +    throw new Error("The use of '*' in strict_min_version is forbidden");

s/forbidden/invalid/

::: toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js:385
(Diff revision 1)
> +    try {
>        yield AddonManager.installTemporaryAddon(addonDir);
> -    });
> -    ok(messages.some(msg => msg.message.includes("The use of '*' in strict_min_version is deprecated")),
> -       "Deprecation warning for strict_min_version with '*' was generated");
> -
> -    let addon = yield promiseAddonByID(newId);
> +    } catch (err) {
> +      if (err.message == "The use of '*' in strict_min_version is forbidden") {
> +        expectedExceptionThrown = true;
> +      }
> +    }

`Assert.throws`
Comment on attachment 8787333 [details]
Bug 1298923 - Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json,

https://reviewboard.mozilla.org/r/76130/#review75242

> `Assert.throws`

I've tried converting this to `Assert.throws` a number of ways, but none of them work. I end up with `Missing expected exception.` I've left one example in the latest commit. I've also tried `yield`ing inside the function passed to `Assert.throws` but that doesn't help. Can you suggest a syntax that would work?
Comment on attachment 8787333 [details]
Bug 1298923 - Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json,

https://reviewboard.mozilla.org/r/76130/#review75242

> I've tried converting this to `Assert.throws` a number of ways, but none of them work. I end up with `Missing expected exception.` I've left one example in the latest commit. I've also tried `yield`ing inside the function passed to `Assert.throws` but that doesn't help. Can you suggest a syntax that would work?

Sorry, it needs to be `yield Assert.rejects(...)` in this case.
Comment on attachment 8787333 [details]
Bug 1298923 - Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json,

https://reviewboard.mozilla.org/r/76130/#review76724
Attachment #8787333 - Flags: review?(kmaglione+bmo) → review+
Try looks good. Requesting check-in.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/e2707a19e5cb
Prevent installation of an extension when "*" is used as part of strict_min_version in a WebExtension manifest.json, r=kmag
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/e2707a19e5cb
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Confirm that there is generated an error while trying to install a webextension which uses "*" as part of strict_min_version on Firefox 51.0a2 (2016-09-29) under Windows 10 64-bit and Ubuntu 16.04 32-bit.

   - error thrown while installing via drag&drop/install from file: http://pastebin.com/Fgcxvtzd
   - error thrown while installing via about:debugging: http://pastebin.com/iA8GdCDT , http://screencast.com/t/QHgsihoWrt
Status: RESOLVED → VERIFIED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.