Limit token size to 250 KB
Bump on this
Unfortunately the proposed fix just checks that the incoming uncompressed data is no more than than 250KB. I don't know what the maximum size a maliciously crafted 250KB token could expand to, but I imagine it could be significant. Some basic tests suggest that a 250KB token can expand to about 250MB.
In addition to sensibly checking the size of the compressed token, I would suggest changing the decompress function in jwe.py to use the decompress method on an instance of zlib.Decompress. The decompress method accepts a max_length which can limit the size of the decompressed data.
@princekhunt see above ☝️
I've already opened a pull request for a more robust fix. See https://github.com/mpdavis/python-jose/pull/352
👌
This appears duplicative to https://github.com/mpdavis/python-jose/pull/352 - I will close this in favor of the other PR.