litellm/litellm
Claude 236e896189
fix(scim): block virtual keys when SCIM deprovisions/deactivates a user
Previously, deleting a user via SCIM (`DELETE /scim/v2/Users/{id}`) or
marking them inactive (`PATCH active=false` / `PUT active=false`) only
touched the user row. Their virtual keys kept working because:

- `litellm_verificationtoken` was never updated.
- The auth path's combined-view query on the key never joined to the
  user's active state.
- `get_user_object()` was wrapped in a silent `except` that set
  `user_obj=None` when the owning user record was gone, so requests
  proceeded normally.

Changes:

- Add `_set_user_keys_blocked(user_id, blocked)` in scim_v2.py that
  flips only mismatched rows via `update_many` and invalidates each
  affected token in the dual cache.
- Cascade SCIM lifecycle events to keys:
  - `delete_user`: block all of the user's keys before deleting the
    user row (preserves spend/audit while orphaning safely).
  - `patch_user` / `update_user`: on `scim_active` transitions,
    block (false) or unblock (true) the user's keys.
- Defense in depth in `user_api_key_auth`: reject the request when the
  loaded `user_obj` has `metadata.scim_active == False`, even if a
  cached key snuck past the per-key block.
- `transform_litellm_user_to_scim_user` now reflects the real
  `scim_active` value instead of always returning `active=True`.

Tests:
- New `test_scim_key_deactivation.py` covering DELETE, PATCH
  active=false, PATCH active=true, no-op patches, and the helper's
  cache-invalidation contract.
- New `test_scim_deactivated_user_key_is_rejected` exercising the
  auth-path defense.
- Existing PATCH tests updated with verificationtoken mocks for the
  new code path.
2026-04-30 02:01:23 +00:00
..
a2a_protocol feat(guardrails): LLM-as-a-Judge guardrail (#26360) 2026-04-24 17:15:32 -07:00
anthropic_interface
assistants
batch_completion
batches
caching fix(caching): preserve prompt_tokens_details through embedding cache round-trip (#26653) 2026-04-28 08:25:11 -07:00
completion_extras Revert "Merge pull request #24417 from Chesars/refactor/shared-format-mapping" 2026-04-25 15:03:24 -03:00
compression Prompt Compression - add it to the proxy (#25729) 2026-04-20 15:08:00 -07:00
containers
endpoints/speech/speech_to_completion_bridge
evals
experimental_mcp_client
files
fine_tuning
google_genai feat(proxy): LiteLLM headers on Google native generateContent routes (#25500) 2026-04-29 12:34:14 -07:00
images Feat(dashscope): add image generation support for qwen-image-2.0 and qwen-image-2.0-pro (#25672) 2026-04-22 20:03:46 -07:00
integrations feat(logging): add retry settings for generic API logger (#26645) 2026-04-28 08:38:17 -07:00
interactions
litellm_core_utils chore(auth): tighten clientside api_base handling (#26518) 2026-04-29 17:27:22 -07:00
llms chore(auth): tighten clientside api_base handling (#26518) 2026-04-29 17:27:22 -07:00
ocr
passthrough style: apply black formatting 2026-04-20 16:02:21 -07:00
proxy fix(scim): block virtual keys when SCIM deprovisions/deactivates a user 2026-04-30 02:01:23 +00:00
proxy_auth
rag style: black formatting 2026-04-25 14:47:54 -07:00
realtime_api
rerank_api
responses Revert "Merge pull request #24417 from Chesars/refactor/shared-format-mapping" 2026-04-25 15:03:24 -03:00
router_strategy refactor(adaptive_router): move update_queue out of litellm.proxy 2026-04-21 18:02:44 -07:00
router_utils chore(auth): tighten clientside api_base handling (#26518) 2026-04-29 17:27:22 -07:00
search
secret_managers
skills
types feat(mcp): rehash short tool prefix on collision and cache per server 2026-04-29 03:43:34 +00:00
vector_store_files
vector_stores
videos
__init__.py Merge pull request #26303 from BerriAI/litellm_internal_staging 2026-04-23 08:30:54 +05:30
_internal_context.py
_lazy_imports_registry.py feat(bedrock): add support for bedrock-mantle endpoint (Claude Mythos Preview) (#26196) 2026-04-21 15:41:58 -07:00
_lazy_imports.py
_logging.py
_redis_credential_provider.py fix(redis): cache GCP IAM token to prevent async event loop blocking (#26441) 2026-04-25 23:13:39 -07:00
_redis.py
_service_logger.py
_uuid.py
_version.py
anthropic_beta_headers_config.json
anthropic_beta_headers_manager.py
blog_posts.json
budget_manager.py
constants.py fix: added keepalive args for aiohttp tcpconnector 2026-04-29 09:14:57 -07:00
cost_calculator.py
cost.json
exceptions.py fix(proxy): invoke post-call guardrails on pass-through endpoint responses (#20270) (#26262) 2026-04-27 08:58:22 +05:30
main.py Merge pull request #24374 from BerriAI/litellm_staging_03_22_2026 2026-04-24 12:38:47 -07:00
model_prices_and_context_window_backup.json Add gpt-image-2 support (#26644) (#26705) 2026-04-28 20:10:42 -07:00
mypy.ini
policy_templates_backup.json
provider_endpoints_support_backup.json Feature/add audio support for scaleway (#26110) 2026-04-20 14:49:41 -07:00
py.typed
router.py fix(router): propagate custom cost_per_token from db model_info in fallback path (#25888) 2026-04-27 08:58:41 +05:30
scheduler.py
setup_wizard.py
timeout.py
utils.py Add gpt-image-2 support (#26644) (#26705) 2026-04-28 20:10:42 -07:00