mirror of
https://github.com/python/cpython.git
synced 2026-11-09 06:00:54 +08:00
gh-161569: Check cookie policy before deleting expired cookies in `http.cookiejar` (GH-161570)
gh-161569: Check cookie policy before deleting expired cookies in http.cookiejar
An expired Set-Cookie header was allowed to delete a stored cookie using
the Domain and Path attributes taken verbatim from the header, before
CookiePolicy.set_ok() was consulted. A response from one host could
therefore delete cookies belonging to any other domain in a shared jar.
The policy is now consulted before an expired cookie may delete an
existing one, as required by RFC 6265 section 5.3.
(cherry picked from commit 8eb3d2c1c4)
Co-authored-by: Kirill Podoprigora <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>