mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
Fix URL substring sanitization and remove unused imports
- Replace raw 'services.ai.azure.com in api_base' substring check with _should_use_api_key_header() which uses urlparse + host.endswith() to prevent URL spoofing (CodeQL alert) - Remove unused imports: litellm, get_secret_str
This commit is contained in:
parent
297c7a0bc6
commit
c6bc4b1bc2
1 changed files with 1 additions and 3 deletions
|
|
@ -12,11 +12,9 @@ from urllib.parse import urlparse
|
|||
|
||||
import httpx
|
||||
|
||||
import litellm
|
||||
from litellm.llms.azure.common_utils import BaseAzureLLM
|
||||
from litellm.llms.azure_ai.common_utils import AzureFoundryModelInfo
|
||||
from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig
|
||||
from litellm.secret_managers.main import get_secret_str
|
||||
from litellm.types.router import GenericLiteLLMParams
|
||||
from litellm.types.utils import LlmProviders
|
||||
from litellm.utils import _add_path_to_api_base
|
||||
|
|
@ -120,7 +118,7 @@ class AzureAIResponsesAPIConfig(OpenAIResponsesAPIConfig):
|
|||
new_url = _add_path_to_api_base(
|
||||
api_base=api_base, ending_path="/openai/v1/responses"
|
||||
)
|
||||
elif "services.ai.azure.com" in api_base:
|
||||
elif self._should_use_api_key_header(api_base):
|
||||
new_url = _add_path_to_api_base(
|
||||
api_base=api_base, ending_path="/models/responses"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue