-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Specify allowed headers explicitly instead of using a wildcard #2969
Specify allowed headers explicitly instead of using a wildcard #2969
Conversation
This isn't sufficient as there are more headers vault uses and more it may use in the future. We could maybe set it to the current list but then I'd want to refactor things so that we have less risk of leaving something out later. But even then a newer client against an older vault server may have problems. |
I was wondering if there are other headers that Vault uses. So how do you want to go about it? Because in its current form, CORS support is pretty much not working. |
I've added two more headers to the allowed list: |
This is illustrating my point -- you've added two more headers, but you've still omitted actual Vault headers that Vault clients can legitimately set. |
Yes, I get what you are saying. No need to merge this PR (though I will keep updating my branch to ensure things work for me). That said, I don't think CORS support is usable until this issue is fixed. I also grepped though the source to figure out which other headers vault clients might use. Is this all, or are there any headers that I've missed?
|
All of those can be supplied by a client except the Internal-No-Request-Forwarding one. However, thinking about this, I think really the right thing to do would be to have that be a default list, but expand the CORS support to allow specifying allowed headers in addition to allowed origins. This is especially useful since there is now support to allow specifying headers to be audit-logged for request tracing purposes. It's more work but in the end ensures that all uses can be satisfied. Any chance you'd be willing to dive in on that? |
Yes, this makes sense.
Unfortunately I can't. I am unfamiliar with both Go and Vault internals, and with no time to spare, it doesn't look possible for me to pick up. (As for the status of my fork, I will use it for the time being. However, to stay upto date with upstream over the long term, unless this issue gets fixed, it makes sense to use a reverse proxy that will serve both vault and the UI from the same origin). |
I'd be happy to work on this PR if someone else isn't already. |
@naunga Nobody is working on this currently, just an open issue. Thanks! |
Fixed by #3023 |
While testing out the recently merged CORS support I faced this error in both Chrome and Firefox:
Vault sets the value of
Access-Control-Allow-Headers
to*
. This, it turns out, is still an open spec issue and has not yet been merged in either Chrome or Firefox: whatwg/fetch#548The fix is to explicitly specify the list of headers that should be allowed e.g.
Content-Type
,X-Vault-Token
, etc. The changes here fix that.