-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Allow CORS wildcard headers #44651
base: main
Are you sure you want to change the base?
Allow CORS wildcard headers #44651
Conversation
According to spec all 3 headers can be set to wildcard "*".
@StaticBR Can you clarify please why is it necessary ? Quarkus would set As far as |
@sberyozkin I think that if a Developer explicitly set a configuration property to To your points:
This is a suitable default. But if the config property is set, why use the default?
Sorry i do not understand what you mean by that. These headers are in the test case.
Yes, and if my decision is to expose all headers for an origin, I have currently no possibility to set this via the configuration property. |
Your test case has which is when https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers is expected to be returned: |
@sberyozkin Long story short: |
@sberyozkin ^ ping. |
@StaticBR Apologies for a delay. So, first of all, I'm a bit generally cautions now about letting users just to solve all CORS concerns with That was my question, why exactly do you need this optimization ? I agree it is simpler, but while, with Origins, it can be hard in devmode to list all the origins in Kubernetes, in other deployments, where And also, looks like one of us, possibly me, is confused about the test. I believe these headers like I've noticed the Fetch spec says something about So I'd like to have much more clarity for us to progress on this PR if it proves possible. CC @cescoffier |
@sberyozkin
I totally agree, we have to be cautions. And i also always argue for sensible default values. But why should quarkus be more restrictive as the W3C Standard? Why would you force a developer to be not able to use one specific value?
I agree here, since the HTTP commands are a finite list. I changed this just for consistent behavior of the parameters.
This is the one i disagree with you, and was also my point when i stumbled upon this.
My change only changed the value of following headers:
Maybe because the fetch request will filter all headers that are not listed within the
Hope you have more clarity now 😁. |
@StaticBR, thanks
Because IMHO we can't afford following every standard's security text blindly but offer an opinionated treatment of some parts of such texts, anything related to wildcards is certainly one such part.
Because the practice shows the developers would embrace wildcards to push CORS concerns aside at dev time and very likely keep them in prod. Also, wildcard is not really a specific value. As far as the rest of the comments are concerned, they indeed make things clearer to me, thanks for that. I'm not too concerned about not doing the same for allowed methods because IMHO, it is a small, restricted set, it is not hard to specify. Also, IMHO we should not be touching exposed headers because this is really about letting scripts access known, concrete headers, which users should configure. As far as allowed methods and exposed headers are concerned, personally, I'd be open to allowing wildcards in Back to the allowed headers. I think the way you changed the code is not correct - because if , during the preflight request, |
Unfortunately I think we two have a different design philosophy there. I would argue that an developer, who explicitly sets a value, knows what he is doing. And therefor a framework should not prohibit him to do so. But like I said, different styles. If it is intentional diverging from the W3C standard, it would be nice to add this to the documentation.
I would argue against that behavior. Handling of this headers should not be different in
Okay I will make one last try to convince you why I changed it this way. Client upload Data ( Client download Data Anyway if you are still convinced this is a bad idea, or does not fit your design philosophy please feel free to close this pull request. |
@sberyozkin ^ ping. |
@sberyozkin ^ ping |
@StaticBR I missed your pings, sorry, but one ping is enough :-)
What I'm saying is that, since you have the browser sending the concrete header values in
I think this use case is valid. |
It is not about the design philosophy, but about us trying to be defensive against some optimistic spec texts and also minimizing the risk of users going with wildcards into prod without quite understanding the possible consequences. We've had some issues with wildcards so this is why there has to be a very convincing case to allow them. IMHO your exposed headers case fits this requirement. The same for dynamic headers - but like I said, your implementation gives more to the client than what was actually asked for, the configured wildcard should allow echoing concrete requested header names back. There is no dynamism in the allowed methods case as far as the server implementation is concerned, so IMHO we should avoid wildcards here. Thanks |
Currently it is not possible to set wildcard header values for some CORS Headers.
This bug concerns:
All of which can, according to the specs set to "*".
Setting this value in the quarkus properies, results in quarkus not setting the header field. This is not correct, since the default values are not "*".
This PR fixes this behavior.