Closed
Bug 986057
Opened 11 years ago
Closed 11 years ago
Loop Server — Should accept cross origin requests
Categories
(Hello (Loop) :: Server, defect, P1)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: alexis+bugs, Assigned: alexis+bugs)
References
Details
(Whiteboard: [s=mlpnightly1, p=.25][qa!])
Attachments
(2 files)
We should allow cross origin resource sharing for some URLs, that will be called from the WebApp.
To do that, add the following headers:
res.set("Access-Control-Allow-Origin", "*");
res.set("Access-Control-Allow-Methods", "GET,POST");
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #8394445 -
Flags: review?(rhubscher)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → alexis+bugs
Status: NEW → ASSIGNED
Comment 2•11 years ago
|
||
Uh, this is generally not a safe practice, since effectively this
removes all CSRF protection. Why can't you identify the correct
friendly origin URLs?
Please address this question prior to landing this patch.
Flags: needinfo?(alexis+bugs)
Assignee | ||
Comment 3•11 years ago
|
||
Basically, I was considering this URL unique and as one that can only be accessed by people who know it exists, so CSRF doesn't really seem a treat to me here.
Nevertheless, I agree it is possible to narrow the list of hosts that will expose the pages (theses are the CDNs) and probably that should be good practice, too.
I've updated the patch with a way to define the list of authorized domains in the settings file.
Flags: needinfo?(alexis+bugs)
Comment 4•11 years ago
|
||
Comment on attachment 8394445 [details] [review]
link to github PR
For now it is good enough, but we should add a list to decide how we want to handle multiple domain authorization.
See http://stackoverflow.com/questions/1653308/access-control-allow-origin-multiple-origin-domains
Attachment #8394445 -
Flags: review?(rhubscher) → review+
Comment 5•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 6•11 years ago
|
||
This doesn't seem like the right way to accept multiple domains, so I'm reopening this one until we fix that.
The link you pointed to says we should have the Allow-Origin match the Origin of the request that had been made, and now I remember that's the way it should be implemented.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 7•11 years ago
|
||
We should define the OPTION HTTP verb as well.
As NiKo` noticed they might be interresting though here: https://gist.github.com/cuppster/2344435
Assignee | ||
Comment 8•11 years ago
|
||
For GET / POST with JSON we should't need a preflight (OPTION) request to be made.
Why are you suggesting to answer to OPTION for this specific case? What's the request that's not working okay?
Assignee | ||
Comment 9•11 years ago
|
||
Actually, after reading back the CORS spec, it seems that we need to support OPTIONS if we want an accept-header different than one of application/x-www-form-urlencoded, multipart/form-data, or text/plain.
Assignee | ||
Updated•11 years ago
|
Severity: normal → blocker
Right, this bug is currently preventing from testing the Loop webapp using the server. Blocker.
Priority: -- → P1
https://github.com/troygoode/node-cors/ might be just what we need here.
Comment 12•11 years ago
|
||
Yes looks to be a great as possible :+1:
Assignee | ||
Comment 13•11 years ago
|
||
Attachment #8395618 -
Flags: review?(standard8)
Comment 14•11 years ago
|
||
Comment on attachment 8395618 [details] [review]
link to github PR
Looks good, r=Standard8
Attachment #8395618 -
Flags: review?(standard8) → review+
Assignee | ||
Comment 15•11 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Whiteboard: [s=mlpnightly1, p=.25]
QA Contact: jbonacci
Whiteboard: [s=mlpnightly1, p=.25] → [s=mlpnightly1, p=.25][qa!]
You need to log in
before you can comment on or make changes to this bug.
Description
•