-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Review CrossOriginFilter #1053
Comments
I'm working on adding CrossOriginFilter to a high traffic application and I noticed few other issues as well. Some are very outdated and not performant for large scale applications. For example,
So, Could I take this up and work on this Filter as it would help for my application and the community as well. |
@Narasimman you are welcome to contribute on this issue. Please make sure that you follow the Jetty Contribution Guidelines here. Would be great if you can work on each feature singularly, issue a pull request, and I'll review it. Regarding your bullet 2, the regexp is created anyway so I would prefer to not have to lookup any file for configuration - they are always a mess and source of security issues; your bullet 3 should be done with JMX. So would be great if you can work on your bullet 1, my first bullet (remove skipping WebSocket upgrades) and your bullet 3 but with JMX - please on separate pull requests. Thanks ! |
I think this should also have the "Security" label and a high priority, as bypassing the CORS would allow other sitest to perform arbitrary actions on the behalf of logged users (that visit the malicious site), therefore potentially leaking data and performing unwanted actions. Also, to allow any origin by default is a pretty unsafe configuration: It should rather be the opposite. Do NOT allow any origin to make cross requests by default. |
@freetom I agree we should increase the priority of this, however I'm not sure I agree with the point about the default, as CORS requires explicit configuration to be meaningful |
@gregw thanks for the clarification. By the way, I stumbled on a site in the wild that appeared to be using Jetty and had weak CORS protection. The issue laid on the fact that it was allowing too many values in the Let's say that the site had name However I don't think regular expressions of this kind (using the wildcard Another thing I noticed was that the site was allowing Version of Jetty on |
Hi, I was reviewing the CrossOriginFilter and I got stuck with the first two bullets of Narasimman (Dec 20, 2016): the performance of recompiling the the regex for each request, and the need to use regex that do not contains * character, for example https?:[/]/[.]foo[.]com(|:\d+). I can probably create a patch for the first bullet, but probably not for the second (as it requires to define new params) |
Be aware of https://tools.ietf.org/html/rfc6454#section-3.4.3 Returning invalid Furthermore, those domains should enforce the connectivity with HSTS, otherwise, a single, trusted subdomain without HSTS could get exploited by a MITM attack to make Cross-Site Requests on the trustee(s) domain. |
#1952 for the reuse of patterns (avoid compiling the patterns for each request). |
Avoid recreating for each request the value of the header Access-Control-Allow-Method. Cheaper matching: Previously an array list was iterated to try to match the method. Now a single Pattern is used. Related to: jetty#1053 (Review CrossOriginFilter) Might conflict with: jetty#1952 (CrossOriginFilter performace: reuse matcher) Signed-off-by: Juan F. Codagnone <[email protected]>
Allows to use full regex support for matching origins without the need of having a *. Declares a new parameter `allowedOriginsRegex' that superseed allowedOrigins. Related to: jetty#1053 (Review CrossOriginFilter) Extends: jetty#1952 (CrossOriginFilter performace: reuse matcher) Might conflict with: jetty#1953 (CrossOriginFilter: performance: allowedMethods) Signed-off-by: Juan F. Codagnone <[email protected]>
Avoid recreating for each request the value of the header Access-Control-Allow-Method. Cheaper matching: Previously an array list was iterated to try to match the method. Now a single Pattern is used. Related to: jetty#1053 (Review CrossOriginFilter) Might conflict with: jetty#1952 (CrossOriginFilter performace: reuse matcher) Signed-off-by: Juan F. Codagnone <[email protected]>
Allows to use full regex support for matching origins without the need of having a *. Declares a new parameter `allowedOriginsRegex' that superseed allowedOrigins. Related to: jetty#1053 (Review CrossOriginFilter) Extends: jetty#1952 (CrossOriginFilter performace: reuse matcher) Might conflict with: jetty#1953 (CrossOriginFilter: performance: allowedMethods) Signed-off-by: Juan F. Codagnone <[email protected]>
My current thinking is :
This would not break existing configurations, give warnings about wildcard usage and allow sophisticated users to do whatever they like. |
From recommendation of @freetom Signed-off-by: Greg Wilkins <[email protected]>
Another CrossOriginFilter PR #3346 was created to address the |
@sbordet nudge |
is this still a high priority security issue? |
I don't think it is. |
Hello, |
@arsenalzp I don't think this issue is valid anymore.
If there are unsolved problems that I missed, or new problems, please open a new issue. |
CrossOriginFilter
was written many years ago; the comments show references to Chrome 5 (!) that may not be up to date anymore.In particular:
StrictCrossOriginFilter
that does not let the request that fails the CORS check go to the application, and reply with 403 or something alone those lines.The text was updated successfully, but these errors were encountered: