-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-29613: Added support for SameSite cookies #6413
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
Conversation
And suggestions by members.
Doc/library/http.cookies.rst
Outdated
@@ -153,6 +159,9 @@ Morsel Objects | |||
:attr:`~Morsel.coded_value` are read-only. Use :meth:`~Morsel.set` for | |||
setting them. | |||
|
|||
.. versionchanged:: 3.8 | |||
Added support for :attr:`samesite` attribute. |
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.
for the
Doc/library/http.cookies.rst
Outdated
|
||
The attribute :attr:`httponly` specifies that the cookie is only transferred | ||
in HTTP requests, and is not accessible through JavaScript. This is intended | ||
to mitigate some forms of cross-site scripting. | ||
|
||
The attribute :attr:`samesite` specifies that browser is not allowed to send the |
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.
"the browser"
Doc/library/http.cookies.rst
Outdated
|
||
The attribute :attr:`httponly` specifies that the cookie is only transferred | ||
in HTTP requests, and is not accessible through JavaScript. This is intended | ||
to mitigate some forms of cross-site scripting. | ||
|
||
The attribute :attr:`samesite` specifies that browser is not allowed to send the | ||
cookie along with cross-site requests. This help to mitigate CSRF attacks. Valid |
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.
help -> helps
Lib/test/test_http_cookies.py
Outdated
@@ -121,6 +121,19 @@ def test_set_secure_httponly_attrs(self): | |||
self.assertEqual(C.output(), | |||
'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Secure') | |||
|
|||
def test_samesite_attrs(self): | |||
samesite_values = ['Strict', 'Lax'] |
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.
Might add tests for 'strict' and 'lax' as the values are case-insensitive from what I read.
Thanks! Feedback addressed |
@akash0x53 I would encourage you to apply for a Google Patch Reward for your work on this: https://www.google.com/about/appsecurity/patch-rewards/ |
This is a rebase of #214.
Closes #214
https://bugs.python.org/issue29613