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 SESSION_COOKIE_HTTPONLY #1303

Conversation

yuya-takeyama
Copy link

Related to #980

Problem

I deployed Re:dash to HTTPS environment and set REDASH_ENFORCE_COOKIE=true.
Then I noticed that it returns weird session cookie.

set-cookie:session=***; Secure; HttpOnly; Path=/

It contains both of Secure and HttpOnly.

Solution

Flask has a configuration named SESSION_COOKIE_HTTPONLY.
http://flask.pocoo.org/docs/0.10/config/

I think it should always be inverse of SESSION_COOKIE_SECURE.

With this change, now Re:dash returns session cookie correctly.

set-cookie:session=***; Secure; Path=/

Please review, thanks!

@arikfr
Copy link
Member

arikfr commented Oct 5, 2016

I don't understand why one should be the inverse of the other. Secure defines how the cookie can be transmitted while HttpOnly defines how it can be accessed, there is nothing that prevents using them both. Even one of the examples for Set-Cookie header on MDN includes them both.

If you think you need this, you can add this setting with default value of True, but it shouldn't be related to the value of SESSION_COOKIE_SECURE.

@yuya-takeyama
Copy link
Author

@arikfr
Ah sorry, I misunderstood the meaning of HttpOnly!
Then current implementation has no problem.

Let me close now.

@yuya-takeyama yuya-takeyama deleted the set-session_cookie_httoponly branch October 5, 2016 12:15
@arikfr
Copy link
Member

arikfr commented Oct 5, 2016

👍

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.

2 participants