mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* fix(policies): reject non-existent team/key/model scope entries on attachment create Creating a policy attachment accepted arbitrary team, key, and model values with no validation, so a typo'd or non-existent team was silently persisted (LIT-4199). The create endpoint now rejects a concrete (non-wildcard) team, key, or model that does not resolve to a real entity, wiring the previously-dead PolicyValidator existence checks and reusing RouteChecks._is_wildcard_pattern so validation agrees with request-time matching, where only a trailing "*" is a wildcard. Wildcard patterns are still allowed through since they may match zero entities today and more later, and tags stay free-form. The Admin UI's Teams field validates the same rule for immediate feedback when its team list has loaded, deferring to the backend otherwise. * style(policies): use builtin list generics and | None in scope validator Keeps the new find_invalid_scope_entries signature off the UP006/UP045 strict ruff budgets instead of copying the surrounding legacy typing.List/Optional idiom. * fix(policies): separate multiple attachment scope errors with ' | ' Addresses Greptile review: joining per-entry validation messages with a bare space read as one run-on sentence; ' | ' makes the multi-error 400 detail easier to parse for users and programmatically. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_attachment_registry.py | ||
| test_condition_evaluator.py | ||
| test_pipeline_executor.py | ||
| test_policy_matcher.py | ||
| test_policy_resolver.py | ||
| test_policy_validator.py | ||
| test_policy_versioning.py | ||
| test_policy_versioning_e2e.py | ||