Skip to content

Rack CORS is fundamentally insecure. #126

Closed
@ejcx

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions