-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Take regexps into account when setting access-control-allow-credentials #44054
Conversation
This comment has been minimized.
This comment has been minimized.
Failures are unrelated (Docker rate limiting in action). |
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.
Changes, code and expected behavior makes sense to me, but I'll leave it to @sberyozkin because I didn't change this file before IIRC.
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java
Show resolved
Hide resolved
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java
Outdated
Show resolved
Hide resolved
Thanks Guillaume @gsmet for starting looking at it, I suggested a minor optimization. I think we should either update the origins configuration property to recommend users to avoid wildcard or regular expressions in prod and list precise Origin values, or keep insisting on the precise Origin match only... I'm leaning toward retaining the current status quo, but it can become difficult to manage when a lot of origins are involved... How about adding a dedicated property on the allowed credentials header, we retain the current status quo by default, only if a precise Origin match is achieved, this header is returned. If users say It may be one more property too many, but it will require users double-confirm their intention that they really want to allow |
@gsmet You are right that having regexs to support various subdomains with otherwise rather complete URLs in the expressions is reasonable, I'd only like to exclude expressions like |
We used to only consider exact matches which looks like an oversight. Fixes quarkusio#43736
@sberyozkin I think I addressed your concern in the second commit. I let you check all is good for you as I'm not exactly familiar with this code :). |
Thanks very much @gsmet, let me do a minor tweak with a separate commit to try to restrict it a bit further |
Can you clarify what you're trying to do? I would like to avoid ending up with a Frankenstein monster and something that is hard to understand? |
@gsmet Sure, I'd like to make sure that if it is a wildcard (regex or not), then Currently you have:
Right now, we'll have both I'd like to add only
It will avoid allowing credential access, and also do a tiny optimization, if the origin is set to I've just realized only now once I started typing that this is all I wanted to do, I was not sure what exactly to suggest... I just wanted to save you some time as opposed to keeping adding some vague comments :-), but please add this one extra boolean check and it will be good to go |
Ah yes, you're right, it should be fixed, thanks for catching it. |
@gsmet If you are busy with backports, I can do it, just let me know |
This comment has been minimized.
This comment has been minimized.
Hey @gsmet I did that minor test and added a test, should be ready to go... FYI, the allow credentials header is null if the Origin is wrong, but Let me approve - and if you happy yourself with the latest update - please merge Cheers ! |
Status for workflow
|
Thanks! |
We used to only consider exact matches which looks like an oversight.
Fixes #43736