Skip to content

Commit 709d8bb

Browse files
author
josh
authored
chore: remove patch for django.http.parse_cookie (#20841)
1 parent 4ef045b commit 709d8bb

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

src/sentry/monkey/__init__.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,6 @@ def safe_httprequest_repr(self):
3636
HttpRequest.__repr__ = safe_httprequest_repr
3737

3838

39-
def patch_parse_cookie():
40-
try:
41-
from django.utils import six
42-
from django.utils.encoding import force_str
43-
from django.utils.six.moves import http_cookies
44-
from django import http
45-
except ImportError:
46-
# This module is potentially imported before Django is installed
47-
# during a setup.py run
48-
return
49-
50-
# Backported from 1.8.15: https://github.com/django/django/blob/1.8.15/django/http/cookie.py#L91
51-
# See https://www.djangoproject.com/weblog/2016/sep/26/security-releases/ for more context.
52-
def safe_parse_cookie(cookie):
53-
"""
54-
Return a dictionary parsed from a `Cookie:` header string.
55-
"""
56-
cookiedict = {}
57-
if six.PY2:
58-
cookie = force_str(cookie)
59-
for chunk in cookie.split(";"):
60-
if "=" in chunk:
61-
key, val = chunk.split("=", 1)
62-
else:
63-
# Assume an empty name per
64-
# https://bugzilla.mozilla.org/show_bug.cgi?id=169091
65-
key, val = "", chunk
66-
key, val = key.strip(), val.strip()
67-
if key or val:
68-
# unquote using Python's algorithm.
69-
cookiedict[key] = http_cookies._unquote(val)
70-
return cookiedict
71-
72-
http.parse_cookie = safe_parse_cookie
73-
74-
7539
def patch_django_views_debug():
7640
# Prevent exposing any Django SETTINGS on our debug error page
7741
# This information is not useful for Sentry development
@@ -98,7 +62,6 @@ def patch_celery_imgcat():
9862

9963

10064
for patch in (
101-
patch_parse_cookie,
10265
patch_httprequest_repr,
10366
patch_django_views_debug,
10467
patch_celery_imgcat,

0 commit comments

Comments
 (0)