Closed Bug 813994 Opened 12 years ago Closed 12 years ago

Alarm API - Need additional security checks for the "alarms" permission

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: bent.mozilla, Assigned: airpingu)

References

Details

Attachments

(1 file, 1 obsolete file)

Currently it looks like we only check the "alarms" permission in the child process for DOM access. A hacked child can send commands to the parent to cancel or add alarms.

Also, it looks like one process can modify or cancel another's alarms since appId is not stored along with alarmId. I'm happy to file another bug on that if needed.
Assignee: nobody → clian
blocking-basecamp: ? → +
(In reply to ben turner [:bent] from comment #0)
> Currently it looks like we only check the "alarms" permission in the child
> process for DOM access. A hacked child can send commands to the parent to
> cancel or add alarms.

Thanks Ben for pointing this out! I'll try to refine that.

> 
> Also, it looks like one process can modify or cancel another's alarms since
> appId is not stored along with alarmId. I'm happy to file another bug on
> that if needed.

Actually, I've already examined it in the parent process to ensure .getAll() and .remove() can only interact with alarms scheduled by the same app (Bug 777224).
(In reply to Gene Lian [:gene] from comment #1)
> Actually, I've already examined it in the parent process to ensure .getAll()
> and .remove() can only interact with alarms scheduled by the same app (Bug
> 777224).

Awesome! Sorry about that, I went on vacation and didn't look to see if anything had changed after I got back :-/
Blocks: alarm-api
Summary: Need additional security checks for the "alarms" permission → Alarm API - Need additional security checks for the "alarms" permission
Attached patch Patch (obsolete) — Splinter Review
Hi Bent,

Changes are trivial: just adding an |assertPermission()| check in the parent. The remaining changes are minor codes clean-ups for the ugly codes designed when I was still newbie, including:

  1. // [Upper-case-letter]...[.]
  2. Rephrase some comments.
  3. Remove trailing spaces.
  4. Wrap long line into 80-char ruler.\
  5. Adding braces for one line if-block.
  6. Alignment.

Thanks for your review! Please let me know if you have any other suggestions.
Attachment #685569 - Flags: review?(bent.mozilla)
Comment on attachment 685569 [details] [diff] [review]
Patch

Thanks, this is probably right, but it's generally not a good idea to mix lots of code cleanup into bug fixes (it makes chasing blame much harder and can sometimes introduce additional bugs). Can you please separate the changes and file a followup for the cleanup?
Attachment #685569 - Flags: review?(bent.mozilla) → review-
Attached patch Patch V2Splinter Review
Hi Bent,

You're right I shouldn't be too aggressive. Let's simply deal with this issue in this patch. :)

Btw, I clean up |secMan| and |this.hasPrivileges| since they're no longer used in the current codes, which are also permission-related. Please feel free to let me know if you don't like them present in this patch.

Thanks for the review!
Attachment #685569 - Attachment is obsolete: true
Attachment #686046 - Flags: review?(bent.mozilla)
Comment on attachment 686046 [details] [diff] [review]
Patch V2

Review of attachment 686046 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great! Thanks!
Attachment #686046 - Flags: review?(bent.mozilla) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/23363f443325
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: