-
Notifications
You must be signed in to change notification settings - Fork 333
charts/nginz: Add restrictive CORS headers to all URLs and explicitly… #1630
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
Conversation
208c7b5
to
4bc520b
Compare
Will have to test this, and write extensive CHANGELOG entry before merging this. We also have to update the wire installation docs so that new users are sure to not forget this! To be changed: |
4bc520b
to
b542f13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Needs rebase |
ffd4ee9
to
26d73d0
Compare
@jmatsushita this is ready for another review |
…tly allowlist allowed origins There is no reason not to have restrictive CORS on all endpoints; given our API is currently only consumed by internal services that we know apriori. We can loosen this restriction again in the future (e.g. when we have something like OAuth integration). We also move to an explicit allowlist instead of trusting the entirety of `external_env_domain`. Especially on-prem people might have many more services running on their base domain and we as Wire have no control over it. We do not want other services not in our control to be a vector for e.g. XSS attacks. Hence we require the user of our charts to explicitly allowlist all the expected origins. We will update the docs to guide people into making this update.
If people needs to adjust the subdomains, they can override them in their values.yaml But this makes sure things just 'work' out of the box in common case
The previous commits adding CORS configuration set the access control header to unconditionally return the Origin header sent with the request. This would cause fail-open behaviour, where any Origin sent by a client would be allowed. Instead, the $cors_header variable is used, as this is specifically set based on the request Origin header so that only origins which are explicitly in the Helm chart's allow list configuration may make cross-origin requests to nginz API endpoints.
19a9865
to
e9a5516
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change: we use and have been using 'account' (without s) everywhere in docs.wire.com and our own environments (except for accounts.wire.com - here we can do an override)
Looks fine, let's merge and deploy this to some of our environments.
Could you, after merging this, also add this to wire-docs somewhere?
Add restrictive CORS headers to all origins and explicitly allowlist allowed origins
There is no reason not to have restrictive CORS on all endpoints; given
our API is currently only consumed by known services. We can loosen this
restriction again in the future (e.g. when we have something like OAuth
integration).
We also move to an explicit allowlist instead of trusting the entirety
of
external_env_domain
. Especially on-prem people might have many moreservices running on their base domain and we as Wire have no control
over it. We do not want other services not in our control to be a vector
for e.g. XSS attacks. Hence we require the user of our charts to
explicitly allowlist all the expected origins. We will update the docs
to guide people into making this update if needed.
Checklist