-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Fixed #34613 -- Added support for Partitioned cookies #19603
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
base: main
Are you sure you want to change the base?
Conversation
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.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
django/http/response.py
Outdated
|
||
``partitioned`` can be: | ||
- True to enable partitioned cookies (CHIPS - Cookies Having | ||
Independent Partitioned State) | ||
- False (default) for standard cookie behavior |
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 don't think we need to describe the parameter here - we don't for the other boolean parameters. The documentation is the source of truth for Django's APIs.
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 appreciate your comment. I removed the comment with this commit: 6a7c528
# Add support for the Partitioned cookie attribute (CHIPS - Cookies Having | ||
# Independent Partitioned State). This is needed for Chrome's third-party | ||
# cookie handling in iframes. | ||
# https://developers.google.com/privacy-sandbox/3pcd/chips | ||
# Only patch if Python version doesn't have native support for it. | ||
# Python 3.14+ has native support for partitioned cookies. | ||
if "partitioned" not in cookies.Morsel._flags: | ||
cookies.Morsel._flags.add("partitioned") | ||
cookies.Morsel._reserved.setdefault("partitioned", "Partitioned") |
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.
Since you asked about this on the forum, I'd say it's fine as it has precedence: 9a56b4b#diff-53ebbe2eee45e69ba2a4a071d31269c34e4640cf61f613e95512a7b9d421a3dbR6-R7
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.
Thanks for the comment, I will leave this implementation then unless no one else complains 👍
P.S. |
Trac ticket number
ticket-34613
Branch description
This PR adds support for Partitioned cookies to Django, implementing the CHIPS (Cookies Having Independent Partitioned State) specification that enhances privacy and security for third-party contexts.
infrastructure
the Partitioned attribute
cookies:
settings
Checklist
main
branch.