env var for controling allowed origins ?
See original GitHub issueHi,
We have a scenario were we want to use table data from within another application (a map) served from another domain than our Grist domain.
I’ve first tried to add CORS headers in the Treafik proxy, but then I hit a check in grist-core. So I’ve discovered that there is a small CORS management in Grist, great! 😃
I understand that the API keys are “full powered” at this time, so exposing them in an application may be quite risky. But it seems that if the document is “public access: on”, we can get the data through the API without a key (not totally sure about this point, though).
So, a suggestion would be to add an (optional) env var GRIST_ALLOWED_HOSTS
to allow more hosts.
Does that make sense ?
Thanks for your inputs,
Yohan
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Add environment variables to control cors configuration in ...
Add environment variables to control cors configuration in docker images #59 ... Is there any reason to add more than "allowed origins"?
Read more >CORS settings with environment variables | Article
The environment variable GX_CORS_ALLOW_ORIGIN enables CORS for the selected host. The values accepted by the variable are URL or "*". For ...
Read more >Specifying @CrossOrigin orgins via an environment variable
You can configure spring using following code. <mvc:cors> <mvc:mapping path="/api/**" allowed-origins="http://domain1.
Read more >Environment variable - Wikipedia
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of...
Read more >Environment Variables | Cypress Documentation
In Cypress, "environment variables" are variables that are accessible via Cypress.env . These are not the same as OS-level environment variables.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The ability to set a list of allowed origins on a per-document basis would definitely be useful, and Document Settings would be a good place for it. For self-managed Grist, an optional
GRIST_ALLOWED_HOSTS
environment variable that enumerates a set of trusted sites associated with the entire installation also makes sense. Since the environment variable is much easier to implement, and an immediate need for you, I agree @LouisDelbosc that it is a good place to start.I think it would be helpful if the environment variable functioned like the existing
ALLOWED_WEBHOOK_DOMAINS
variable, which is a comma-separated list of domains that may be used in webhooks (e.g.webhook.site,zapier.com
). In that case, subdomains of the listed domains are permitted, and I think that would be desirable here too for consistency.It would be nice setting a list of allowed origins on a per-document basis.
It would allow things like adding a record to Grist (including hosted Grist) directly from a form on a webpage (using some Javascript). There is a risk that it would tempt people to put sensitive API keys into pages, which we should discourage as much as possible. But it would be legitimately useful for unauthenticated requests, since you could make a Grist document public and use granular access rules to limit what unauthenticated requests can do.