Solve CNAME Javascript interactions w/ the API #1504
Labels
Improvement
Minor improvement to code
Needed: more information
A reply from issue author is required
Uh oh!
There was an error while loading. Please reload this page.
Description
Currently we don't really support any kind of writing via the API from CNAME'd websites. This is mainly because of the cross domain requirements inside the browser. We've done some basic work w/ CORS to look into supporting this, but there are some security implications we need to think through before we turn on any kind of real access.
Proposed Solution
We now have Domain objects that are associated with each project. This means that when we get a request from a specific domain, we can map against the Domain object, and return the proper CORS headers for their domains. This should allow CNAME's to be able to have proper CORS requests against our API.
Implementation
We will build middleware that intercepts OPTIONS and GET requests to custom Domains, then does a lookup on the Domain object, and gives proper access. We will likely need to do some kind of mapping from the Domain coming in to verify that the requested URL's belong to the project associated with the domain.
We will also limit this functionality to a whitelist of API calls that we expect from documentation pages. The main thing we need to protect against is full API access for custom Domains against the RTD API. Currently I believe we only need to whitelist
/api/v2/search/
and/api/v2/footer/
.Testing
When this work is done:
References
Sponsorship
This work is being sponsored by Citus Data
The text was updated successfully, but these errors were encountered: