Skip to content

Support for Partitioned cookies attribute #112713

Closed

Description

@giles-v

Feature or enhancement

Proposal:

Chrome is phasing out support for Third Party Cookies in Q1 2024, and for several key use cases, the proposed solution is CHIPS (https://github.com/privacycg/CHIPS).

See Chrome's blogpost about these changes: https://developer.chrome.com/en/docs/privacy-sandbox/third-party-cookie-phase-out/#partitioned

Currently, cookies with the Partitioned attribute cannot be set from within the http.cookies library. I'm proposing that we add support for that attribute.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Dec 4, 2023
  2. giles-v commented on Jan 17, 2024

    @giles-v
    ContributorAuthor

    Hey there @AlexWaygood, just a ping on this issue per the contributors guide -- this issue and the PR have been up for about six weeks now. A review would be appreciated, thank you!

  3. Flecart commented on Feb 10, 2024

    @Flecart

    I need this feature, for starlette. Kludex/starlette#2500.

  4. added a commit that references this issue on Feb 10, 2024
  5. merwok commented on Feb 12, 2024

    @merwok
    Member

    AFAIU this is a proposed / experimental thing for now, and from MDN it’s not implemented in Firefox or Safari yet.
    If this becomes a standard (with WHATWG or W3C), it could be considered for Python.

  6. self-assigned this
    on Feb 14, 2024
  7. moved this to In Progress in Cookies issues 🍪on Feb 14, 2024
  8. merwok commented on Feb 14, 2024

    @merwok
    Member

    @gpshead could you reply to my note here before going on with the PR?

  9. gpshead commented on Feb 14, 2024

    @gpshead
    Member

    Sorry I missed your comment earlier. Holding off awaiting a standard is fine, I misread it and thought it'd been implemented already rather than seeing those were the prior attempts.

    This really just seems to be adding an attribute that adds an additional string to a cookie. If it winds up not meaning anything, it wouldn't be the end of the world - though we'd obviously need different docs than what the PR contains right now.

    What's the alternative within the existing http.cookies API for adding Partitioned to a cookie it creates and checking for Partitioned when parsing today without implementing your own parsing? (that could expand into a bigger question about whether the stdlib API is actually a good one)

  10. assigned and unassigned on Feb 14, 2024
  11. 4 remaining items

  12. merwok commented on Feb 21, 2024

    @merwok
    Member

    OK, there seems to be consensus, so this can be added to 3.13

  13. picnixz commented on Sep 9, 2024

    @picnixz
    Member

    FTR: issues with type-feature always target the latest branch.

  14. merwok commented on Sep 9, 2024

    @merwok
    Member

    ok but why remove the tag indicating the version that a feature will or does appear in?

  15. picnixz commented on Sep 9, 2024

    @picnixz
    Member

    I think it's because the feature may or may not be included in that version when it's being merged. (Actually, I'm only following the devguide: https://devguide.python.org/triage/labels/#type-labels). We however use the 3.x labels for indicating the versions being affected by bugs (and those labels are then mirrored on the PR with "need backport 3.x")

  16. jinnatar commented on Dec 6, 2024

    @jinnatar

    FYI, current behavior is to just silently drop cookie data when encountering any unsupported field such as partitioned, which leads to downstream weirdness that's difficult to troubleshoot. In my case it's expecting response cookies to be stored in an aiohttp session and some of them just not getting stored with zero errors. I would have expected an exception to be raised on invalid input.

    python -i
    Python 3.13.0 experimental free-threading build (main, Oct 16 2024, 03:26:14) [Clang 18.1.8 ] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from http.cookies import SimpleCookie
    >>> c=SimpleCookie()
    >>> c.load('TOKEN=foo; path=/; expires=Fri, 06 Dec 2024 18:10:39 GMT; samesite=none; secure; httponly; partitioned;')
    >>> c
    <SimpleCookie: >
    >>> c.load('TOKEN=foo; path=/; expires=Fri, 06 Dec 2024 18:10:39 GMT; samesite=none; secure; httponly;')
    >>> c
    <SimpleCookie: TOKEN='foo'>
  17. giles-v commented on Jan 22, 2025

    @giles-v
    ContributorAuthor

    @merwok @gpshead just wanted to bump #112714 (comment) -- I think the PR to resolve this remains ready for review.

  18. moved this from Todo to In Progress in Cookies issues 🍪on Jan 24, 2025
  19. gpshead commented on Jan 24, 2025

    @gpshead
    Member

    Thanks for your work and patience. the PR is approved and set to automerge!

  20. added a commit that references this issue on Jan 24, 2025
  21. added a commit that references this issue on Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions