Browse Source

Make unzipped payload max configurable

James Kiger 1 year ago
parent
commit
0c4a19addc
2 changed files with 6 additions and 2 deletions
  1. 4 0
      glitchtip/settings.py
  2. 2 2
      sentry/middleware/proxy.py

+ 4 - 0
glitchtip/settings.py

@@ -86,6 +86,10 @@ GLITCHTIP_URL = env.url("GLITCHTIP_URL", default_url)
 if GLITCHTIP_URL.scheme not in ["http", "https"]:
     raise ImproperlyConfigured("GLITCHTIP_DOMAIN must start with http or https")
 
+GLITCHTIP_MAX_UNZIPPED_PAYLOAD_SIZE = env.int(
+    "GLITCHTIP_MAX_UNZIPPED_PAYLOAD_SIZE", global_settings.DATA_UPLOAD_MAX_MEMORY_SIZE
+)
+
 # Events and associated data older than this will be deleted from the database
 GLITCHTIP_MAX_EVENT_LIFE_DAYS = env.int("GLITCHTIP_MAX_EVENT_LIFE_DAYS", default=90)
 GLITCHTIP_MAX_TRANSACTION_EVENT_LIFE_DAYS = env.int(

+ 2 - 2
sentry/middleware/proxy.py

@@ -63,9 +63,9 @@ class ZDecoder(io.RawIOBase):
 
         n = 0
         max_length = len(buf)
-        # DOS mitigation - disallow unzipped payloads higher than upload max memory size
+        # DOS mitigation - block unzipped payloads larger than max allowed size
         self.counter += 1
-        if self.counter * max_length > settings.DATA_UPLOAD_MAX_MEMORY_SIZE:
+        if self.counter * max_length > settings.GLITCHTIP_MAX_UNZIPPED_PAYLOAD_SIZE:
             raise RequestDataTooBig()
 
         while max_length > 0: