mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(search): keep signed auth headers out of logging callbacks
Log the pre-signing headers in the search pre_call hook so SigV4 and bearer Authorization values are never handed to user-configured logger callbacks, and tighten sign_request's annotations. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
b1d77bb5db
commit
15a6664171
3 changed files with 10 additions and 10 deletions
|
|
@ -180,12 +180,12 @@ class BaseSearchConfig:
|
|||
|
||||
def sign_request(
|
||||
self,
|
||||
headers: dict, # mutable-ok: matches the request header dict every other hook on this base takes
|
||||
optional_params: dict, # mutable-ok: matches the optional params dict every other hook on this base takes
|
||||
request_data: dict | list[dict], # mutable-ok: matches transform_search_request's JSON body return type
|
||||
headers: dict[str, str], # mutable-ok: matches the request header dict every other hook on this base takes
|
||||
optional_params: dict[str, object], # mutable-ok: matches every other hook on this base
|
||||
request_data: dict[str, object] | list[dict[str, object]], # mutable-ok: transform_search_request's body
|
||||
api_base: str,
|
||||
api_key: str | None = None,
|
||||
) -> tuple[dict, bytes | None]: # mutable-ok: the handler passes these headers straight to httpx
|
||||
) -> tuple[dict[str, str], bytes | None]: # mutable-ok: the handler passes these headers straight to httpx
|
||||
"""
|
||||
OPTIONAL
|
||||
|
||||
|
|
|
|||
|
|
@ -221,12 +221,12 @@ class AgentCoreSearchConfig(BaseSearchConfig, BaseAWSLLM):
|
|||
|
||||
def sign_request(
|
||||
self,
|
||||
headers: dict, # mutable-ok: BaseSearchConfig hands providers the mutable request header dict
|
||||
optional_params: dict, # mutable-ok: BaseSearchConfig passes optional params as a dict
|
||||
request_data: dict | list[dict], # mutable-ok: BaseSearchConfig request bodies are JSON dicts
|
||||
headers: dict[str, str], # mutable-ok: BaseSearchConfig hands providers the mutable request header dict
|
||||
optional_params: dict[str, object], # mutable-ok: BaseSearchConfig passes optional params as a dict
|
||||
request_data: dict[str, object] | list[dict[str, object]], # mutable-ok: request bodies are JSON dicts
|
||||
api_base: str,
|
||||
api_key: str | None = None,
|
||||
) -> tuple[dict, bytes | None]: # mutable-ok: BaseSearchConfig.sign_request returns httpx headers
|
||||
) -> tuple[dict[str, str], bytes | None]: # mutable-ok: BaseSearchConfig.sign_request returns httpx headers
|
||||
"""
|
||||
Authenticate the MCP request.
|
||||
|
||||
|
|
|
|||
|
|
@ -1755,7 +1755,7 @@ class BaseLLMHTTPHandler:
|
|||
additional_args={
|
||||
"complete_input_dict": data,
|
||||
"api_base": complete_url,
|
||||
"headers": signed_headers,
|
||||
"headers": headers,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -1848,7 +1848,7 @@ class BaseLLMHTTPHandler:
|
|||
additional_args={
|
||||
"complete_input_dict": data,
|
||||
"api_base": complete_url,
|
||||
"headers": signed_headers,
|
||||
"headers": headers,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue