-
Notifications
You must be signed in to change notification settings - Fork 327
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 Support to set the SameSite attribute on the cookie to mitigate CSRF attacks #210
Comments
yep, that seems like a good idea |
@jbwtan are you in a position to submit a PR? |
@bnfinet first time contributing but yes I can give this a go. Do i need to know anything else before submitting a PR? |
yeah that sounds fine, and please add a default (I'm assuming And i should ask, do you see a way that adding default and, @jbwtan thanks for helping to improve VP! |
Adding a default value would potentially break existing setups. Chrome <= Ver79 treats cookies without the SameSite attribute as SameSite=None. From February onwards "Chrome will treat cookies that have no declared SameSite value as SameSite=Lax cookies. Only cookies with the SameSite=None; Secure setting will be available for external access" In order to minimise impact on existing setups, perhaps the default behaviour if the proposed |
gotcha, yeah that sounds like the right way to handle it |
i'm sure you're very busy but is there any way this feature could be prioritised higher given this is a potential security issue? Happy to chip in where I can |
Just came across this.. "Cookies with SameSite=None must also specify Secure, meaning they require a secure context." I think there should be a It's tempting to just set secure (and explain to the user with log.warn) but since TLS is always handled by |
@jbwtan while testing #214 I came across this issue: Do you have any thoughts on |
@bnfinet thanks for looking into the issue. good spot. I think the right approach for backwards compatibility would be to not write a same site attribute at all (and which should be how things are right now and handling of the cookie would be dependent on the browser). In that case if http.SameSite(0) doesn't write an attribute at all then I would opt for that even though it feels like a workaround for the implementation of SameSiteDefaultMode. I don't think that SameSiteDefaultMode should add an attribute key with no value |
Nginx hack to add
|
Recommendations based on the CHANGING operation of chrome/ff/safari in recent versions releasing ~this week. Anyone using vouch to add auth to an API without same-origin front-ends (think localhost:80) is going to be annoyed by the defaults of My recommendations for this project
🤷♂ hope that helps. I already see a PR that would allow me to use this without hacks again |
@aroden-crowdstrike what do you think of not adding an attribute at all by default. @jbwtan that's what you're suggesting, yes? And, in order to not break existing setups would it be worth it to implement the logic detailed here.. |
Hi @bnfinet. Yep thats what I'm suggesting as my understanding is that existing versions of vouch-proxy will not have a SameSite attribute defined in any way. So by setting sameSite = http.SameSite(0) as per the link golang/go#36990 you kindly shared, no attribute will be declared and therefore shouldnt break existing setups |
As I understand Vouch currently, there is no way to stop the browser sending the VouchCookie if a malicious link to the same domain the Vouch cookie is set to in vouch.domains, vouch config.
If we could set the SameSite on the cookie then we could ensure that only links in a browser to the protected resource server work on a subdomain (because only a subdomain will be allowed to send the VouchCookie)
More information on SameSite: https://web.dev/samesite-cookies-explained/
The text was updated successfully, but these errors were encountered: