diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py index 68cf16c93cc1c8..13e5b104a81ea2 100644 --- a/Lib/http/cookiejar.py +++ b/Lib/http/cookiejar.py @@ -1032,10 +1032,13 @@ def set_ok_domain(self, cookie, request): if j == 0: # domain like .foo.bar tld = domain[i+1:] sld = domain[j+1:i] - if sld.lower() in ("co", "ac", "com", "edu", "org", "net", - "gov", "mil", "int", "aero", "biz", "cat", "coop", - "info", "jobs", "mobi", "museum", "name", "pro", - "travel", "eu") and len(tld) == 2: + known_slds = ( + "co", "ac", "com", "edu", "org", "net", + "gov", "mil", "int", "aero", "biz", "cat", "coop", + "info", "jobs", "mobi", "museum", "name", "pro", + "travel", "eu", "tv", "or", "nom", "sch", "web", + ) + if sld.lower() in known_slds and len(tld) == 2: # domain like .co.uk _debug(" country-code second level domain %s", domain) return False diff --git a/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst new file mode 100644 index 00000000000000..5a01cfeb489a2e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-15-03-38-13.gh-issue-135528.XssMeM.rst @@ -0,0 +1,2 @@ +:mod:`http.cookiejar`: add "tv", "or", "nom", "sch", and "web" +to the list of supported country code second-level domains.