mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-09 02:24:40 +00:00
docs(proxy): refresh stale comments referencing removed tag strip
The tag-strip block was removed in the parent commit but two surrounding comments still referenced "tags without opt-in" and "runs AFTER the strip". Update them to describe the remaining user_api_key_* and _pipeline_managed_guardrails strip that the snapshot/merge ordering actually protects against.
This commit is contained in:
@@ -1448,19 +1448,21 @@ async def add_litellm_data_to_request( # noqa: PLR0915
|
||||
_body_snapshot = {k: v for k, v in data.items() if k != "secret_fields"}
|
||||
data["proxy_server_request"]["body"] = _body_snapshot
|
||||
|
||||
# Snapshot the (now-cleaned) requester-supplied metadata for downstream
|
||||
# consumers. Taking the deepcopy AFTER the strip prevents attacker-
|
||||
# injected admin slots (user_api_key_*, tags without opt-in,
|
||||
# _pipeline_managed_guardrails) from surviving in requester_metadata
|
||||
# where guardrails and audit paths may read from it.
|
||||
# Snapshot the requester-supplied metadata for downstream consumers.
|
||||
# Taking the deepcopy after the user_api_key_* / _pipeline_managed_guardrails
|
||||
# strip above prevents those proxy-internal slots — if a caller forged
|
||||
# them — from leaking into requester_metadata where guardrails and audit
|
||||
# paths may read from it.
|
||||
if "metadata" in data and isinstance(data["metadata"], dict):
|
||||
data[_metadata_variable_name]["requester_metadata"] = copy.deepcopy(
|
||||
data["metadata"]
|
||||
)
|
||||
|
||||
# Now merge litellm_metadata into the metadata variable (preserving existing
|
||||
# values) — runs AFTER the strip so attacker injections in litellm_metadata
|
||||
# cannot cross-contaminate the admin-authoritative metadata dict.
|
||||
# Merge litellm_metadata into the metadata variable (preserving existing
|
||||
# values). Runs after the user_api_key_* / _pipeline_managed_guardrails
|
||||
# strip above so those proxy-internal slots — if a caller forged them
|
||||
# into litellm_metadata — cannot cross-contaminate the admin-authoritative
|
||||
# metadata dict.
|
||||
if "litellm_metadata" in data and isinstance(data["litellm_metadata"], dict):
|
||||
for key, value in data["litellm_metadata"].items():
|
||||
if key not in data[_metadata_variable_name]:
|
||||
|
||||
Reference in New Issue
Block a user