Closed Bug 772605 Opened 13 years ago Closed 13 years ago

Consider allowing cross-origin requests for certain API calls

Categories

(addons.mozilla.org Graveyard :: API, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2012-07-26

People

(Reporter: Fallen, Assigned: Fallen)

Details

Attachments

(1 file, 1 obsolete file)

When we remake the Calendar website, I would like to include a widget with a download button like on AMO that displays the latest version. To do so, I would like to make an XMLHttpRequest to https://services.addons.mozilla.org/en-US/thunderbird/api/1.5/addon/lightning and get the data from the XML. Obviously, this will fail since our page is on www.mozilla.org so its cross-origin. Therefore I propose one of two things: A) Allow cross origin calls for the API fully, i.e set Access-Control-Allow-Origin: * in the response headers. B) Allow cross origin calls for all mozilla.org sites, i.e set Access-Control-Allow-Origin: $_REQUEST["HTTP_ORIGIN"] if the origin is part of mozilla.org. What do you think?
We support cross-origin requests on our statistics data I don't think adding this to our other views would be a problem. I don't think we should add it universally though - the API continues to expand and adds new functionality (including functions other than just retrieving data) so I'd like to keep us on a whitelist system.
(In reply to Wil Clouser [:clouserw] from comment #1) > We support cross-origin requests on our statistics data I don't think adding > this to our other views would be a problem. I don't think we should add it > universally though - the API continues to expand and adds new functionality > (including functions other than just retrieving data) so I'd like to keep us > on a whitelist system. Definitely, I was thinking the same when I wrote the bug but I see I forgot a few words to make that clear.
So, what are the next steps on this bug? I guess it won't make it into the 27th update, or is it an easy fix?
need a=rforbes and then, yeah, it's a low priority.
Attached patch Fix - v1 (obsolete) β€” β€” Splinter Review
This should do it for the addon details, you just have to say what other api calls should have it allowed.
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Attachment #644683 - Flags: review?(clouserw)
Comment on attachment 644683 [details] [diff] [review] Fix - v1 Tests coming up shortly.
Attachment #644683 - Attachment is obsolete: true
Attachment #644683 - Flags: review?(clouserw)
Attached patch Fix - v2 β€” β€” Splinter Review
This patch includes tests, choosing cvan for the review since he talked me through it on IRC (thanks!)
Attachment #644686 - Flags: review?(cvan)
Comment on attachment 644686 [details] [diff] [review] Fix - v2 Looks very good. I've made the small changes myself and merged in your patch: https://github.com/mozilla/zamboni/commit/dbfa18a I wanted to make sure that your patch lands for our push this Thursday (7/26). Thanks!
Attachment #644686 - Flags: review?(cvan) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2012-07-26
Looks like you changed the line with the ^L control character, was that on purpose? @@ -133,7 +133,7 @@ class ControlCharacterTest(TestCase): - a.name = "I ove You" + a.name = "Iove You"
(In reply to Philipp Kewisch [:Fallen] from comment #10) > Looks like you changed the line with the ^L control character, was that on > purpose? > > > @@ -133,7 +133,7 @@ class ControlCharacterTest(TestCase): > - a.name = "I ove You" > + a.name = "Iove You" Yeah, I saw that. I'll fix it with a different editor. Test still passes (not surprisingly), but I'll amend it. Thanks.
just saw this. i am ok with it.
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: