Skip to content
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

Setting blank string origin in config allows all origins #139

Closed
kimroen opened this issue Jul 6, 2017 · 0 comments
Closed

Setting blank string origin in config allows all origins #139

kimroen opened this issue Jul 6, 2017 · 0 comments

Comments

@kimroen
Copy link

kimroen commented Jul 6, 2017

If you pass in a blank string to origins in your Rack::Cors-config…

allow do
  origins ''
  ...
end

…you allow all origins access.

The empty string is turned into a regex at lib/rack/cors.rb:264.

Now, this probably wouldn't be typed in like this, but it could end up like this because of some mistake like this:

allow do
  origins /\Amyactualappdomain[01]\.com\z/, APP_CONFIG.some_other_domain
  ...
end

where that config is set to an empty string for whatever reason.

This, combined with the default setting of true for Access-Control-Allow-Credentials (see #126) could potentially be quite dangerous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants