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

relationship between sameSite and the secure option? #268

Closed
2 tasks done
johaven opened this issue Dec 22, 2023 · 4 comments
Closed
2 tasks done

relationship between sameSite and the secure option? #268

johaven opened this issue Dec 22, 2023 · 4 comments

Comments

@johaven
Copy link

johaven commented Dec 22, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

From my understanding there is no relationship between the secure option and the sameSite option that can be applied to the cookie. This code makes it impossible to configure sameSite to 'strict' for non https connections (a little annoying for developments).

Additionally the sameSite option is examined during serialization

if (opts.secure === 'auto') {
    if (isConnectionSecure(reply.request)) {
      opts.secure = true
    } else {
      opts.sameSite = 'lax' // remove this
      opts.secure = false
    }
  }
@mcollina
Copy link
Member

I don't understand what's the ask here. Can you clarify?

@johaven
Copy link
Author

johaven commented Dec 26, 2023

I don't understand why the sameSite value is set here, it doesn't make any sense. I think it should be deleted

@gurgunday
Copy link
Member

What problem do you encounter when it's set to lax like that?

Lax should be the minimum default but I agree that it could be applied more consistently

Maybe ||= could be preferred to not override a user setting

@johaven
Copy link
Author

johaven commented Dec 26, 2023

By setting the value to strict we actually obtain the Lax value if we are not in a secure context, but there is no meaningful relationship between secure and samesite. In any case this parameter is examined later, when serializing the cookie, as you prefer :)

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

No branches or pull requests

3 participants