MCPcopy Create free account
hub / github.com/mpdavis/python-jose / test_jwe_zip_with_excessive_data

Method test_jwe_zip_with_excessive_data

tests/test_jwe.py:542–552  ·  view source on GitHub ↗
(self, monkeypatch)

Source from the content-addressed store, hash-verified

540
541 @pytest.mark.skipif(AESKey is None, reason="No AES backend")
542 def test_jwe_zip_with_excessive_data(self, monkeypatch):
543 # Test that a fix for CVE-2024-33664 is in place.
544 enc = ALGORITHMS.A256CBC_HS512
545 alg = ALGORITHMS.RSA_OAEP_256
546 monkeypatch.setattr("jose.constants.JWE_SIZE_LIMIT", 1024)
547 encrypted = jwe.encrypt(b"Text" * 64 * 1024, PUBLIC_KEY_PEM, enc, alg, zip=ZIPS.DEF)
548 assert len(encrypted) < jose.constants.JWE_SIZE_LIMIT
549 header = json.loads(base64url_decode(encrypted.split(b".")[0]))
550 with pytest.raises(JWEError) as excinfo:
551 actual = jwe.decrypt(encrypted, PRIVATE_KEY_PEM)
552 assert "Decompressed JWE string exceeds" in str(excinfo.value)

Callers

nothing calls this directly

Calls 3

base64url_decodeFunction · 0.90
encryptMethod · 0.45
decryptMethod · 0.45

Tested by

no test coverage detected