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

This disables RackProtection::JsonCsrf which was causing problems in … #131

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

bertrama
Copy link
Member

@bertrama bertrama commented Aug 1, 2024

…production.

Overview

RackProtection::JsonCsrf will respond with a 403 status when a request is made, with the Referer header set, but no Origin header.

Javascript's fetch function was making requests with the Referer header set, but no Origin header, when the request was being made to the same site. Cross site requests set an Origin header, so this was not visible when evaluating a staging deployment.

Disabling RackProtection::JsonCsrf is likely not harmful because catalog browse does not do credentialed requests.

Anything else?

Consider re-enabling if requests are made with credentials.

Testing

Start up a development instance and run:

curl 'http://localhost:4567/carousel?query=GV1541%20.M28%201996' \
-H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br, zstd' \
-H 'Referer: https://search.lib.umich.edu/catalog/record/11103032259' \
-H 'Connection: keep-alive'

@bertrama bertrama merged commit 80d2e5d into main Aug 1, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant