Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

unnecessary list, leads to insecure CORS configurations #300

Open
chrisdlangton opened this issue Nov 22, 2021 · 1 comment
Open

unnecessary list, leads to insecure CORS configurations #300

chrisdlangton opened this issue Nov 22, 2021 · 1 comment

Comments

@chrisdlangton
Copy link

:type origins: list, string or regex

The value for header Access-Control-Allow-Origin allows one origin, and only one.

When the value is zero origins, or more than 1 origin, produces Reason: CORS header 'Access-Control-Allow-Origin' missing in chrome because it is a malformed (and thus ignored) value for Access-Control-Allow-Origin header.

This means anything other than a single origin for origin attribute is an invalid CORS configuration, and results in the browser having evaluated the page without any valid Access-Control-Allow-Origin header values being sent and default to default same-origin policy without CORS.

@derek-adair
Copy link

derek-adair commented Oct 25, 2022

I dont feel the list is unnecessary; I have a mailgun proxy app that I whitelist any domains that need access to mailgun. However, the app CAN CANT return more than one result (read the code here, it simply checks the request_origin against the list and returns the origin as the access-control-allow-origin header), and should certainly not work if a user fails to supply an origin at all.

Are you able provide steps to reproduce multiple header records. Even literally putting duplicate records in a list will not produce multiple header records.

As for not providing anything for origins, this is in fact still a bug.

Not sure what the owner would like to do but setting the default origins to wildcard seems like a bad idea but probably not that big of a deal. IMO just throwing a warning would suffice.

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

No branches or pull requests

2 participants