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

Update the use of CORS_ORIGIN_ALLOW_ALL #207

Open
ctgraham opened this issue Aug 18, 2022 · 2 comments
Open

Update the use of CORS_ORIGIN_ALLOW_ALL #207

ctgraham opened this issue Aug 18, 2022 · 2 comments
Assignees

Comments

@ctgraham
Copy link

The use of CORS_ORIGIN_ALLOW_ALL is superseded and is not recommended:

argo/argo/settings.py

Lines 154 to 155 in 05a65fc

# CORS settings
CORS_ORIGIN_ALLOW_ALL = True

https://pypi.org/project/django-cors-headers/#cors-allow-all-origins-bool

Better would be to use the strategy from the request broker to name allowed origins:
https://github.com/RockefellerArchiveCenter/request_broker/blob/9fc371944a231181f98fec90d29f9e7521e9cd9b/request_broker/settings.py#L136-L137

ctgraham added a commit to ulsdevteam/argo that referenced this issue Aug 18, 2022
@helrond
Copy link
Member

helrond commented Aug 19, 2022

Setting this boolean to True was a conscious choice we made to support the broadest use of our collections API as possible. I'm curious what downsides you see to this approach.

@ctgraham
Copy link
Author

Ah, I see where you are coming from there.

I will confess that this was 90% me troubleshooting a CORS failure for argo, finding this setting hardcoded and reading the python docs on not using is as-such.

Reflecting on it, I do think it would be appropriate to allow cross origin requests from anywhere, so long as they were application/json requests. Currently argo is responding even to text/html requests with the header "Access-Control-Allow-Origin: *", which I think is outside of your proposed use-case.

@ctgraham ctgraham self-assigned this Aug 23, 2022
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