mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix(proxy): clear LIT002 in /v2/key/info batch-cap guard
The two `or []` fallbacks only feed len(), so tuples do the job without a mutable literal. The detail dict mirrors the sibling HTTPException payload above and is never mutated, so it carries a mutable-ok reason.
This commit is contained in:
parent
ab9a3f4c6f
commit
f4406b4060
1 changed files with 2 additions and 2 deletions
|
|
@ -3675,11 +3675,11 @@ async def info_key_fn_v2(
|
|||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail={"message": "Malformed request. No keys passed in."},
|
||||
)
|
||||
requested_key_count: Final = len(data.keys or []) + len(data.key_aliases or [])
|
||||
requested_key_count: Final = len(data.keys or ()) + len(data.key_aliases or ())
|
||||
if requested_key_count > MAX_KEY_INFO_KEYS_PER_REQUEST:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail={
|
||||
detail={ # mutable-ok: one-shot HTTPException payload matching the sibling detail dict above; never mutated after construction
|
||||
"message": (
|
||||
f"Too many keys requested: {requested_key_count}. "
|
||||
f"At most {MAX_KEY_INFO_KEYS_PER_REQUEST} keys and key_aliases combined per request."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue