-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read only API has CORS disabled #2239
Comments
Seems that the current state was a quick security workaround from the time when entire API was writeable (#934 (comment)) and these days we should simply remove skipAPIheader and allow CORS headers everywhere. Gateway and API use separate settings trees now which gives us a good framework for writing specific security rules:
For the writable API it is possible to give CORS access only to a specific host:
Generally it should be possible to set up CORS if user choose to do so. PS. We should make sure CORS test suite gets updated to reflect those changes: PS2. INB4 CORS is not enough to prevent CSRF attacks (Token API is needed to fix it): until we have Token API app developers can simply blacklist destructive API methods at the reverse-proxy level. |
For me important and one that can be solved without API Tokens is lack of CORS on read-only API. It stops development of in browser applications that want to only read from the API. |
Config should include following as defaults for CORS to be supported on gateways:
Preferably before 0.4.0 is released. |
Solution above really doesn't solve much as:
|
@Kubuxu any plans of enabling this sometime soon-ish? :) |
Yeah, this can be closed as CORS looks fine in 2019 (go-ipfs v0.4.18): $ curl -Is 'https://ipfs.io/api/v0/dns/ipfs.io?r=true' | grep Access-Control
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: X-Requested-With, Range, Content-Range, X-Chunked-Output, X-Stream-Output
Access-Control-Expose-Headers: Content-Range, X-Chunked-Output, X-Stream-Output ps. Cleanup of |
Read-only API is accessible on public gateway but has CORS disabled.
This makes it impossible to use it from JS in browser which was a point of it.
IMHO CORS handling in general should be as follows:
There were opinions that read-only API isn't that read-only as it can make user download some content. It shouldn't be taken as issue as it is already possible with just gateway.
(API might want to introduce change that
GET
uses data only available locally and specifies non-standard request method (i.e.FETCH
) that downloads data from the network, this wayGET
does not have any side-effects).Example of missing CORS on read-only API response:
The text was updated successfully, but these errors were encountered: