Description
Rack CORS has a fundamental problem. Setting origin: '*' should return a "Access-Control-Allow-Origin: *" and should not reflect the origin header.
Defaulting to Access Control Allow Credentials: true is also inherently insecure, and when combined with this unexpected reflection of the origin header means thousands of sites have "turned off" SAMEORIGIN policy.
Why should it be like this?
Because origin:* means that Credentials should never be passed to the cross origin site. The way you are doing it, developers who mean to set Access-Control-Allow-Origin: * (safely) are getting unexpected unsafe behavior that allows their credentials to be sent cross origin.
What should happen instead?
Origin: "" should return an Access-Control-Allow-Origin: header, instead of a reflected origin header.
It should not be possible to reflect the origin header, as there is no real use case for this that is not covered by Access-Control-Allow-Origin: *.
Activity