-
Notifications
You must be signed in to change notification settings - Fork 366
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 secure attribute to cookies if served over HTTPS #472
Add secure attribute to cookies if served over HTTPS #472
Conversation
Thanks for raising @ties-v - let me review and get back to you. |
please if this solution is correct, approve it, Currently, I have to manually delete the |
@natbusa that's strange - why are you having to delete the cookie when your app starts? |
Hi @stevehobbsdev, I am using the vue.js spa demo provided by auth0 https://github.com/auth0-samples/auth0-vue-samples aa a primer for my spa design. After refreshing the page the auth0.is.authenticated cookie is left back. After reloading however oauth0 cookies fail same site check on chrome. I was hoping this PR could help. |
@natbusa Thanks. To be clear, nothing is failing here, it's a warning about the cookie possibly being removed in the future. As it stands at the moment your app will still work just fine. Removing the cookie manually could cause unintended side effects. For example, you might find that your users will suddenly appear logged out when they refresh the page. |
@ties-v We've had a look at this and setting So we're proposing the following, if you'd like to update the PR:
For HTTP origins, this means that new browsers will default to Let me know your thoughts. Unit tests will need to be updated as well when you can find an environment to run them in. |
@stevehobbsdev Thanks for the clear feedback. It seems that once again something is not as simple as it looks 😉. The suggested strategy is a good one I think, so I'll implement it somewhere next week. Just to be sure: the proposed cookie flags are applicable to all cookies that the lib uses, right? |
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.
Just marking as "request changes" for visibility.
Just to be sure: the proposed cookie flags are applicable to all cookies that the lib uses, right?
Yes, all our cookies go through the storage broker, so it makes sense to make these changes there.
I've updated the code as discussed. But I was thinking if we could default (explicitly) to |
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.
@ties-v Thanks for the updates. Let's stick the plan and be explicit about setting SameSite=None
for secure browser requests, and no value (browser default) for non-secure requests.
Added |
Thanks @ties-v - let me review this week! |
This reverts commit e229241.
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
This PR adds the
secure
flag to the cookies used by auth0-spa-js, when the web app is served over https. Otherwise, it doesn't change anything.Old description
This PR adds
samesite=strict
to the cookies used by auth0-spa-js. This because browsers will reject cookies withsamesite=none
(which is the default) when served over http in the future.References
See #459
Testing
Checklist
master