fix(auth): drop unused mutable-ok suppressions flagged by LIT013 (LIT-8429)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
yucheng 2026-10-05 08:15:39 +00:00
parent 315c474af8
commit b20805b719
2 changed files with 4 additions and 6 deletions

View file

@ -233,7 +233,7 @@ class JWTHandler:
# Supported algos: https://pyjwt.readthedocs.io/en/stable/algorithms.html
# "Warning: Make sure not to mix symmetric and asymmetric algorithms that interpret
# the key in different ways (e.g. HS* and RS*)."
SUPPORTED_JWT_ALGORITHMS = [ # mutable-ok: list kept for backward compatibility
SUPPORTED_JWT_ALGORITHMS = [
*APPROVED_JWT_ALGORITHMS,
*LEGACY_JWT_ALGORITHMS,
]
@ -975,9 +975,9 @@ class JWTHandler:
allowed: Final = self.allowed_algorithms()
usable_keys: Final[JWKKeyValue] = (
list(jwks_keys_for(keys, allowed)) # mutable-ok: parse_keys consumes a JWKKeyValue list
list(jwks_keys_for(keys, allowed))
if isinstance(keys, list)
else next(iter(jwks_keys_for((keys,), allowed)), {}) # mutable-ok: single-key dict is a JWKKeyValue
else next(iter(jwks_keys_for((keys,), allowed)), {})
)
public_key: Final = self.parse_keys(keys=usable_keys, kid=kid)
if public_key is not None:

View file

@ -463,9 +463,7 @@ class MCPJWTSigner(CustomGuardrail):
from jwt import PyJWKSet
try:
jwks_set: Final = PyJWKSet.from_dict(
{"keys": list(approved_keys)} # mutable-ok: PyJWKSet.from_dict takes a dict
)
jwks_set: Final = PyJWKSet.from_dict({"keys": list(approved_keys)})
except Exception as exc:
raise jwt.exceptions.PyJWKSetError(f"Failed to parse JWKS from {jwks_uri!r}: {exc}") from exc