I'm sure someone with more knowledge in security would better chime in.
I'm sure someone with more knowledge in security would better chime in.
No modern browser allows access to localhost without that header.
But it's still possible to forge a request using curl or whatever to bypass CORS. So as the parent post suggest - use a token of some sort.
I also recommend using a strict Content-Security-Policy to stop X-site injection attacks. (eg someone adding an image to your page/app with src="/api/cmd=rm -rf /"
A further limitation of CORS is that certain requests are allowed even if they are not from an allowed origin.
To conclude, you definitely need a secret.
Creating a cert during "install" probably adds a good bit of complexity (especially if the map has multiple env targets)
I assume someone could have a look at the JavaScript on the browser and see hey this must be the secret stored here because it is passed to the server on every request. Then write there XSS attack to use that.