mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
fix(proxy): bound team member alert threshold key length before int parsing
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d1022dab91
commit
c191476361
2 changed files with 12 additions and 2 deletions
|
|
@ -5544,7 +5544,9 @@ def _team_member_max_budget_alert_check(
|
|||
per_key_cfg=raw_config if isinstance(raw_config, Mapping) else None,
|
||||
)
|
||||
alert_email_config: Final = {
|
||||
pct: emails for pct, emails in (merged_config or {}).items() if pct.isdigit() and 1 <= int(pct) <= 100
|
||||
pct: emails
|
||||
for pct, emails in (merged_config or {}).items()
|
||||
if pct.isdigit() and len(pct) <= 3 and 1 <= int(pct) <= 100
|
||||
}
|
||||
if not alert_email_config or spend <= 0:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
from collections.abc import Mapping
|
||||
from types import SimpleNamespace
|
||||
|
|
@ -3399,7 +3400,14 @@ async def test_team_member_max_budget_alert_check_drops_thresholds_outside_1_to_
|
|||
_team_member_max_budget_alert_check(
|
||||
team_id="team-1",
|
||||
team_alias="platform",
|
||||
team_metadata={"team_member_max_budget_alert_emails": {"0": ["a@co.com"], "50": [], "150": ["b@co.com"]}},
|
||||
team_metadata={
|
||||
"team_member_max_budget_alert_emails": {
|
||||
"0": ["a@co.com"],
|
||||
"50": [],
|
||||
"150": ["b@co.com"],
|
||||
"1" * (sys.int_info.default_max_str_digits + 1): ["c@co.com"],
|
||||
}
|
||||
},
|
||||
organization_id="org-1",
|
||||
user_id="user-1",
|
||||
user_email="member@co.com",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue