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

Set HttpOnly flag when sending guest_token cookie #2633

Merged
merged 1 commit into from
Mar 16, 2018

Conversation

luukveenis
Copy link

@luukveenis luukveenis commented Mar 15, 2018

The HttpOnly flag helps mitigate the damage XSS attacks by making the cookie inaccessible to JS via the Document.cookie API.

It's advisable to also set the Secure flag which only allows cookies to be sent over HTTPS, but that doesn't play nice with development environment so it shouldn't be the default here.

To enable secure cookies you can add the following to your Rails config:
config.force_ssl = true
This will enable secure cookies, HSTS, and TLS redirect, but each can be disabled independently:
http://api.rubyonrails.org/v5.1.5/classes/ActionDispatch/SSL.html

The HttpOnly flag prevents XSS attacks by making the cookie inaccessible
to JS via the Document.cookie API.

It's advisable to also set the Secure flag which only allows cookies to
be sent over HTTPS, but that doesn't play nice with development
environment so it shouldn't be set by default here.

To enable secure cookies you can add the following to your Rails config:
`config.force_ssl = true`
This will enable secure cookies, HSTS, and TLS redirect, but each can
be disabled independently:
http://api.rubyonrails.org/v5.1.5/classes/ActionDispatch/SSL.html
@jhawthorn jhawthorn merged commit 37627f3 into solidusio:master Mar 16, 2018
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.

3 participants