(self, monkeypatch)
| 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) |
nothing calls this directly
no test coverage detected