Closed Bug 1227451 Opened 10 years ago Closed 10 years ago

chrome.alarms API doesn't check 'alarms' permission

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox46 verified, firefox48 verified)

VERIFIED FIXED
mozilla46
Iteration:
46.2 - Jan 11
Tracking Status
firefox46 --- verified
firefox48 --- verified

People

(Reporter: sdna.muneaki.nishimura, Assigned: rpl)

References

Details

(Whiteboard: [alarms])

Attachments

(2 files)

Attached file alarms.xpi
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36 Steps to reproduce: The 'chrome.alarms' API for WebExtensions ignores 'alarms' permission so any extensions can set alarms without user's consent. Attached is a sample extension that can reproduce the issue. Actual results: When you click the button of this extension and wait for few seconds an alert dialog is opened from the chrome.alarms.onAlarm handler. However, manifest.json of this extension doesn't declare any permissions. Expected results: The chrome.alarms property should be invisible if an extension doesn't declare 'alarms' permission in their manifest.json. MDN says 'alarms' permission is "currently available" but it's not implemented appropriately. https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions
Component: General → WebExtensions
Flags: needinfo?(amckay)
Product: Core → Toolkit
Permissions haven't been implemented yet. Does this need to be a security bug?
Flags: needinfo?(amckay)
Maybe the MDN documentation could mention that? Is there a bug filed on that work?
Flags: needinfo?(amckay)
Group: core-security
Depends on: 1193837, 1197420
The one I found 1197420 implements the permissions API which is related to the permissions in the manifest. This does raise a more interesting question of should all this structure be in place before more APIs are written. Otherwise we'll be generating security bugs all over the place.
Flags: needinfo?(amckay)
So it turns out some have been implemented, not others.
Whiteboard: [alarms]
Flags: blocking-webextensions?
This should be a one-line change. I didn't know about the alarms permission.
Assignee: nobody → luca.greco
Flags: blocking-webextensions? → blocking-webextensions+
This patch turns the "registeredAPI" alarms API into a "registeredPrivilegedAPI" and add a new test case into "test_ext_alarms.html" to check that the alarm API object is not enabled if the permission is not declared by the addon in the manifest.
Attachment #8703725 - Flags: review?(wmccloskey)
Attachment #8703725 - Flags: review?(wmccloskey) → review+
Status: NEW → ASSIGNED
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Iteration: --- → 46.2 - Jan 11
I was able to reproduce the initial issue on Firefox 44.0a1 (2015-10-21) under Windows 10 64-bit. The alert dialog is no longer displayed on Firefox 46.0b6 (20160328182534) and Firefox 48.0a1 (2016-03-27/28) under Windows 10 64-bit, Mac OS X 10.11.2 and Ubuntu 12.04 32-bit.
Status: RESOLVED → VERIFIED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: