Do not accept compressed content from unauthenticated request

Closes #13142
This commit is contained in:
Cédric Krier
2024-04-17 09:47:20 +02:00
parent 4ecca33e0e
commit de9136eed7
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
* Do not accept compressed content from unauthenticated request (#13142)
* Set loading eager to visible xxx2many on form view
* Add loading attribute to form view
* Add a contextual read limit on Model.read
+5 -2
View File
@@ -72,8 +72,11 @@ class Request(_Request):
@property
def decoded_data(self):
if self.content_encoding == 'gzip':
zipfile = gzip.GzipFile(fileobj=BytesIO(self.data), mode='rb')
return zipfile.read()
if self.user_id:
zipfile = gzip.GzipFile(fileobj=BytesIO(self.data), mode='rb')
return zipfile.read()
else:
abort(HTTPStatus.UNSUPPORTED_MEDIA_TYPE)
else:
return self.data