Closed Bug 786710 Opened 12 years ago Closed 12 years ago

The launch_path of a manifest allows for absolute URLs to launch an app at - this should not be allowed

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(blocking-basecamp:+)

RESOLVED FIXED
mozilla18
blocking-basecamp +

People

(Reporter: jsmith, Assigned: marco)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed, Whiteboard: [WebAPI:P0], [qa-])

Attachments

(2 files, 4 obsolete files)

Example manifest:

{
  "name":"Test App ({subdomain})",
  "description":"This app has been automatically generated by testmanifest.com",
  "version":"1.0",
  "icons":{
    "16":"http://testmanifest.com/icon-16.png",
    "48":"http://testmanifest.com/icon-48.png",
    "128":"http://testmanifest.com/icon-128.png"
  },
  "installs_allowed_from":[
    "*"
  ],
  "launch_path": "http://www.google.com",
  "developer":{
    "name":"Gregory Koberger",
    "url":"http://gkoberger.net"
  }
}

Expected:

This app should fail to install - relative URLs should only be allowed in the launch_path.

Actual:

The app successfully can be installed. Launching the app starts at the absolute URL in the launch_path.
blocking-basecamp: --- → ?
What does the spec say on this?  Is this something we need to decide now so we aren't faced with trying to change this later?
Whiteboard: [blocked-on-input Fabrice Desré]
launch_path can never be absolute, and is always relative to the origin of the app.
(In reply to Andrew Overholt [:overholt] from comment #1)
> What does the spec say on this?  Is this something we need to decide now so
> we aren't faced with trying to change this later?

Bill Walker I know was concerned about this bug existing, as am I. This essentially removes a key point behind the app manifest - starting within the app origin. Therefore, I think this blocks basecamp. Anant - Do you agree or disagree?
Whiteboard: [blocked-on-input Fabrice Desré]
Yes, absolute paths should not be allowed in launch_path. Especially since we won't support multiple apps per origin for basecamp, this should be fixed.
Blocker.  Can you take this, Anant?  If not, who should?
Assignee: nobody → anant
blocking-basecamp: ? → +
Anant - Marco is interested in working on this bug. Can he take it?
Attached patch Patch 1 (obsolete) — Splinter Review
Assignee: anant → mar.castelluccio
Status: NEW → ASSIGNED
Attached patch Patch 2 (obsolete) — Splinter Review
Another option.
Attachment #658250 - Flags: review?(fabrice)
Attachment #658251 - Flags: review?(fabrice)
Comment on attachment 658250 [details] [diff] [review]
Patch 1

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

I prefer the approach in patch 2.
Attachment #658250 - Flags: review?(fabrice) → review-
Comment on attachment 658251 [details] [diff] [review]
Patch 2

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

There are a couple of issues with this patch in its current form:
- entry_points launch paths must also be checked.
- the checkManifest method is growing a bit too much to be replicated in the .js and in the .jsm
Attachment #658251 - Flags: review?(fabrice) → review-
Thanks for jumping in Marco!
Attached patch Patch (obsolete) — Splinter Review
I've moved the checkManifest function to the AppsUtils.jsm module and imported the module in Webapps.js.

I've added some tests:
> invalid_launch_path
The manifest contains an absolute launch path.

> invalid_entry_point
The manifest contains an absolute launch path for an entry point.

> invalid_locale_entry_point
The manifest contains an absolute launch path for a locale entry point.

> wild_crazy_with_launch_paths
A correct manifest with relative launch paths (launch_path and entry_points launch paths).
Attachment #658250 - Attachment is obsolete: true
Attachment #658251 - Attachment is obsolete: true
Attachment #658913 - Flags: review?(fabrice)
Whiteboard: [WebAPI:P0]
Comment on attachment 658913 [details] [diff] [review]
Patch

Marco: I just landed bug 785545, which significantly rewrote the test code in dom/tests/mochitest/webapps/, so you'll need to update the test code in this patch to account for that.  Note in particular that there is no longer a "wild crazy" webapp, just a "basic" one, and wild_crazy_with_launch_paths.webapp should be simply launch_paths.webapp.
Attached patch Patch with updated tests (obsolete) — Splinter Review
The launch_paths test is just a basic test, we can improve it in another bug (that I'll file soon).
I hope I didn't forgot anything during the change between the two test methods (I have to say the new method is a lot better).
Attachment #658913 - Attachment is obsolete: true
Attachment #658913 - Flags: review?(fabrice)
Attachment #659057 - Flags: review?(fabrice)
Blocks: 789345
Comment on attachment 659057 [details] [diff] [review]
Patch with updated tests

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

I haven't looked at the tests in detail yet. Could you split up your patch in 2 parts (implementation and tests) ?

::: dom/apps/src/AppsUtils.jsm
@@ +129,5 @@
> +  checkManifest: function(aManifest, aInstallOrigin) {
> +    if (aManifest.name == undefined)
> +      return false;
> +
> +    function cbOrigin(aOrigin) {

nit: the function name is not very descriptive.

@@ +154,5 @@
>    }
>  }
> +
> +// Non exported utility functions
> +

Nit: you could move them in checkManifest()

@@ +166,5 @@
> +}
> +
> +function checkAbsoluteEntryPoint(entryPoints) {
> +  for (let name in entryPoints) {
> +    if (entryPoints[name].path && isAbsolute(entryPoints[name].path)) {

this is |launch_path|, not |path|
Attachment #659057 - Flags: review?(fabrice) → review-
Attached patch PatchSplinter Review
Sorry for the delay, I was studying for an exam.
Attachment #659057 - Attachment is obsolete: true
Attachment #663690 - Flags: review?(fabrice)
Attached patch TestsSplinter Review
Attachment #663691 - Flags: review?(fabrice)
Attachment #663690 - Flags: review?(fabrice) → review+
Attachment #663691 - Flags: review?(fabrice) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/47f4395d89dd
https://hg.mozilla.org/mozilla-central/rev/897268730c68
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Whiteboard: [WebAPI:P0] → [WebAPI:P0], [qa-]
Keywords: dev-doc-needed
Depends on: 854975
See Also: → 952696
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: