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

Add environment variable to override secure_flag on session cookie #980

Merged
merged 2 commits into from
Apr 21, 2016

Conversation

machira
Copy link

@machira machira commented Apr 11, 2016

This commit creates an environment variable that allows Developers to set the secure flag[1] on browser cookies. By default, this is set to False by flask[2].

  1. More on Secure Flag here: https://www.owasp.org/index.php/SecureFlag
  2. See SESSION_COOKIE_SECURE here: http://flask.pocoo.org/docs/0.10/config/

@@ -122,6 +122,8 @@ def all_settings():

JOB_EXPIRY_TIME = int(os.environ.get("REDASH_JOB_EXPIRY_TIME", 3600 * 6))
COOKIE_SECRET = os.environ.get("REDASH_COOKIE_SECRET", "c292a0a3aa32397cdb050e233733900f")
SESSION_COOKIE_SECURE = os.environ.get("REDASH_SESSION_COOKIE_SECURE", False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You should wrap it with parse_boolean like we do for the other boolean values (or it will be the string "True"/"true" instead of boolean value).
  2. I think a nice default would be to set this to the value of ENFORCE_HTTPS. What do you think?

@arikfr
Copy link
Member

arikfr commented Apr 14, 2016

Thanks!

Also wraps parse_boolean around the os.get call for the secure_flag variable
@machira
Copy link
Author

machira commented Apr 20, 2016

Hey @arikfr. Thanks for the feedback. I have incorporated it. Let me know what you think.

@arikfr arikfr merged commit d331285 into getredash:master Apr 21, 2016
@arikfr
Copy link
Member

arikfr commented Apr 21, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants