Skip to content

Commit 63932f1

Browse files
committed
fix: remove raw value from ExceededSizeError
GHSA-frfh-8v73-gjg4
1 parent ad9d57c commit 63932f1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/joserfc/_rfc7515/registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ def check_header(self, header: Header) -> None:
101101

102102
def validate_header_size(self, header: bytes) -> None:
103103
if header and len(header) > self.max_header_length:
104-
raise ExceededSizeError(f"Header size of '{header!r}' exceeds {self.max_header_length} bytes.")
104+
raise ExceededSizeError(f"Header size exceeds {self.max_header_length} bytes.")
105105

106106
def validate_payload_size(self, payload: bytes) -> None:
107107
if payload and len(payload) > self.max_payload_length:
108-
raise ExceededSizeError(f"Payload size of '{payload!r}' exceeds {self.max_payload_length} bytes.")
108+
raise ExceededSizeError(f"Payload size exceeds {self.max_payload_length} bytes.")
109109

110110
def validate_signature_size(self, signature: bytes) -> None:
111111
if len(signature) > self.max_signature_length:
112-
raise ExceededSizeError(f"Signature of '{signature!r}' exceeds {self.max_signature_length} bytes.")
112+
raise ExceededSizeError(f"Signature of exceeds {self.max_signature_length} bytes.")
113113

114114
@classmethod
115115
def guess_alg(cls, key: Any, strategy: Strategy) -> str | None:

src/joserfc/_rfc7516/registry.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,25 @@ def check_header(self, header: Header, check_more: bool = False) -> None:
102102

103103
def validate_protected_header_size(self, header: bytes) -> None:
104104
if header and len(header) > self.max_protected_header_length:
105-
raise ExceededSizeError(f"Header size of '{header!r}' exceeds {self.max_protected_header_length} bytes.")
105+
raise ExceededSizeError(f"Header size exceeds {self.max_protected_header_length} bytes.")
106106

107107
def validate_encrypted_key_size(self, ek: bytes) -> None:
108108
if ek and len(ek) > self.max_encrypted_key_length:
109-
raise ExceededSizeError(f"Encrypted key size of '{ek!r}' exceeds {self.max_encrypted_key_length} bytes.")
109+
raise ExceededSizeError(f"Encrypted key size exceeds {self.max_encrypted_key_length} bytes.")
110110

111111
def validate_initialization_vector_size(self, iv: bytes) -> None:
112112
if iv and len(iv) > self.max_initialization_vector_length:
113113
raise ExceededSizeError(
114-
f"Initialization vector size of '{iv!r}' exceeds {self.max_initialization_vector_length} bytes."
114+
f"Initialization vector size exceeds {self.max_initialization_vector_length} bytes."
115115
)
116116

117117
def validate_ciphertext_size(self, ciphertext: bytes) -> None:
118118
if ciphertext and len(ciphertext) > self.max_ciphertext_length:
119-
raise ExceededSizeError(f"Ciphertext size of '{ciphertext!r}' exceeds {self.max_ciphertext_length} bytes.")
119+
raise ExceededSizeError(f"Ciphertext size exceeds {self.max_ciphertext_length} bytes.")
120120

121121
def validate_auth_tag_size(self, tag: bytes) -> None:
122122
if tag and len(tag) > self.max_auth_tag_length:
123-
raise ExceededSizeError(f"Auth tag size of '{tag!r}' exceeds {self.max_auth_tag_length} bytes.")
123+
raise ExceededSizeError(f"Auth tag size exceeds {self.max_auth_tag_length} bytes.")
124124

125125
def get_alg(self, name: str) -> JWEAlgModel:
126126
"""Get the allowed ("alg") algorithm instance of the given name.

0 commit comments

Comments
 (0)