-
Notifications
You must be signed in to change notification settings - Fork 229
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 secure flag for remember_me cookie #295
base: master
Are you sure you want to change the base?
Conversation
Ah, so this allows users to set secure cookies to true without needing Just to sanity check, @paderinandrey does your use-case prevent you from using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is potentially dangerous, depending on how Rails handles the interaction between force_ssl
and secure: false
. Needs verification.
@@ -71,7 +71,8 @@ def set_remember_me_cookie!(user) | |||
value: user.send(user.sorcery_config.remember_me_token_attribute_name), | |||
expires: user.send(user.sorcery_config.remember_me_token_expires_at_attribute_name), | |||
httponly: Config.remember_me_httponly, | |||
domain: Config.cookie_domain | |||
domain: Config.cookie_domain, | |||
secure: Config.remember_me_secure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be worried that this has the potential to overwrite the default of secure: true
when using force_ssl
. We'll need to double check that interaction before merging this in. Ideally, adding a test or two.
def merge_remember_me_defaults! | ||
@defaults.merge!(:@remember_me_httponly => true) | ||
@defaults.merge!(:@remember_me_httponly => true, :@remember_me_secure => false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nil
would likely be a safer default here. Still would need to sanity check how this interacts with force_ssl
either way.
Added the ability to set the secure flag for the remember_me cookie
Please ensure your pull request includes the following: