litellm/litellm
ryan-crabbe-berri 4493c826e7
fix(logging): close three secret-leak paths in verbose logging (#37391)
* fix(logging): close three secret-leak paths in verbose logging

The AWS credential pattern was the only key-name matcher in secret_redaction
that skipped optional quotes, so quoted dict-repr values leaked. Fold the three
AWS key names into the shared key-name alternation instead.

SecretRedactionFilter only scrubs str record attributes, so a dict/list/set
passed through extra={...} reached the formatter unredacted. Redact at the
formatter boundary so no value shape can bypass it.

log_raw_request_response wrote the request curl command to metadata["raw_request"]
unredacted, returned an unmasked raw_request_api_base, and fell back to dumping
model_call_details whenever api_base was empty.

* Update litellm/_logging.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix(logging): redact JSON log values without breaking the document

JsonFormatter redacted the serialized JSON, so a secret-named member
collapsed from '"api_key": "sk-..."' to a bare REDACTED token and the
line stopped parsing as JSON.

Redact before serialization instead: safe_dumps takes an optional
value_transform hook (default None, so all other callers are unchanged)
and redact_structured_value collapses only the value, leaving the key
and surrounding structure intact.

JsonFormatter now emits "api_key": "REDACTED" where the formatter unit
test expected the already-masked "sk**********". That test bypasses
SecretRedactionFilter, which in production collapses the pair before any
formatter runs, so the assertion is updated to match real behavior.

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-08-19 01:03:34 +00:00
..
a2a_protocol refactor: replace Any with precise types across responses, proxy, and llms modules 2026-08-13 03:59:26 -07:00
anthropic_interface chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
assistants chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
batch_completion feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
batches fix(batches): accept litellm_proxy in files and batches provider type literals 2026-08-18 13:28:06 -07:00
caching Merge pull request #37367 from BerriAI/litellm_lit_5527_semantic_cache_embedding_truncation 2026-08-18 15:45:30 -07:00
completion_extras Merge remote-tracking branch 'origin/litellm_internal_staging' into pr36032_drive 2026-08-17 12:52:12 -07:00
compression chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
containers chore(typing): drop 1.3k basedpyright errors across 30 Any hotspot files 2026-08-16 03:56:02 +00:00
endpoints/speech/speech_to_completion_bridge feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
evals chore(typing): remove 914 basedpyright Any errors across 16 hotspot files 2026-08-10 01:24:40 -07:00
experimental_mcp_client fix(mcp): bound MCP client requests with a session read timeout (#36675) 2026-08-12 12:36:24 -07:00
files fix(batches): accept litellm_proxy in files and batches provider type literals 2026-08-18 13:28:06 -07:00
fine_tuning Merge branch 'litellm_internal_staging' into litellm_remove_types_ruff_exclusion 2026-08-05 11:05:33 -07:00
google_genai refactor: replace Any with precise types across responses, proxy, and llms modules 2026-08-13 03:59:26 -07:00
images chore(typing): clear 1.6k basedpyright Any errors across 56 files 2026-08-11 06:47:39 -07:00
integrations fix(otel): bound and shut down credential-scoped tracer providers (#36591) 2026-08-18 16:21:58 -07:00
interactions Merge pull request #36763 from BerriAI/litellm_decrease_anys_fable7 2026-08-13 13:24:47 -07:00
litellm_core_utils fix(logging): close three secret-leak paths in verbose logging (#37391) 2026-08-19 01:03:34 +00:00
llms fix(vector_stores): stop leaking stored credentials in direct search debug logs (#37373) 2026-08-18 17:46:59 -07:00
models fix(proxy): add config_updated_at audit timestamp for virtual keys (#36488) 2026-08-11 11:02:57 -07:00
ocr fix(ocr): reject invalid req_format values as 400 on the SDK path 2026-08-17 15:49:18 -07:00
passthrough fix(passthrough): protect accept-encoding from x-pass- forwarding 2026-08-15 15:34:28 -07:00
proxy fix(mcp): attach per-user BYOK credential when listing tools for non-oauth2 auth types (#34787) 2026-08-18 17:10:00 -07:00
proxy_auth feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
rag chore(typing): remove 914 basedpyright Any errors across 16 hotspot files 2026-08-10 01:24:40 -07:00
realtime_api chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
repositories chore(guardrails): sync lazy OpenAPI snapshot and dashboard types for usage units 2026-08-17 16:43:58 -07:00
rerank_api chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
responses Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_pr35110_itpm_otpm 2026-08-18 16:11:12 -07:00
router_strategy feat(complexity_router): custom classifier plugins via classifier_type 'custom' (#37249) 2026-08-18 14:09:19 -07:00
router_utils feat(router): make routing groups callable as virtual models and list them in /v1/models (#36519) 2026-08-11 18:41:19 -07:00
rust_bridge feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
sandbox feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
search chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
secret_managers chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
skills chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
types Merge pull request #37362 from BerriAI/litellm_lit_5651_bedrock_guardrail_cost 2026-08-18 15:27:43 -07:00
vector_store_files chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
vector_stores chore(typing): drop 1.3k basedpyright errors across 30 Any hotspot files 2026-08-16 03:56:02 +00:00
videos chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
__init__.py feat(guardrails): count bedrock guardrail cost against spend and budgets 2026-08-18 14:16:07 -07:00
_internal_context.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
_lazy_imports.py fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00
_lazy_imports_registry.py chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
_logging.py fix(logging): close three secret-leak paths in verbose logging (#37391) 2026-08-19 01:03:34 +00:00
_redis.py fix(redis): unwrap decorated __init__s when deriving the from_url kwargs allowlist (#36654) 2026-08-15 11:52:08 -07:00
_redis_credential_provider.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
_service_logger.py chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
_uuid.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
_version.py
anthropic_beta_headers_config.json fix(bedrock-invoke): retain clear_tool_uses_20250919 context_management edits and emit context-management-2025-06-27 beta (LIT-3393) (#32658) 2026-07-09 14:31:27 -07:00
anthropic_beta_headers_manager.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
blog_posts.json
budget_manager.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
constants.py feat(complexity_router): custom classifier plugins via classifier_type 'custom' (#37249) 2026-08-18 14:09:19 -07:00
cost.json
cost_calculator.py fix(cost): treat a batch rate configured as zero as free, not unset 2026-08-17 14:28:38 -07:00
exceptions.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
main.py fix(main): forward store and prompt_cache_key on the MCP gateway early-return 2026-08-18 13:57:07 -07:00
model_prices_and_context_window_backup.json feat(guardrails): count bedrock guardrail cost against spend and budgets 2026-08-18 14:16:07 -07:00
policy_templates_backup.json
provider_endpoints_support_backup.json fix: address OCR greptile feedback 2026-06-24 17:05:05 -07:00
py.typed
router.py Merge pull request #36240 from BerriAI/litellm_fix_chained_proxy_file_upload 2026-08-18 14:15:44 -07:00
scheduler.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
setup_wizard.py chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
timeout.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
utils.py Merge pull request #37367 from BerriAI/litellm_lit_5527_semantic_cache_embedding_truncation 2026-08-18 15:45:30 -07:00