diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index 0959c009ba..0b94416285 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Do not accept compressed content from unauthenticated request (#13142) Version 7.0.9 - 2024-04-04 -------------------------- diff --git a/trytond/trytond/protocols/wrappers.py b/trytond/trytond/protocols/wrappers.py index d3299fd680..ac6c3babfa 100644 --- a/trytond/trytond/protocols/wrappers.py +++ b/trytond/trytond/protocols/wrappers.py @@ -71,8 +71,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