Skip to content

Commit 9f3d4d3

Browse files
Potential fix for code scanning alert no. 1: Incomplete URL substring sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 5cdaad5 commit 9f3d4d3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/hackingBuddyGPT/utils/openai/openai_llm.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import requests
66
import tiktoken
7+
from urllib.parse import urlparse
78

89
from hackingBuddyGPT.utils.configurable import configurable, parameter
910
from hackingBuddyGPT.utils.llm_util import LLM, LLMResult
@@ -38,7 +39,7 @@ def get_response(self, prompt, *, retry: int = 0,azure_retry: int = 0, **kwargs)
3839
if hasattr(prompt, "render"):
3940
prompt = prompt.render(**kwargs)
4041

41-
if "azure.com" in self.api_url:
42+
if urlparse(self.api_url).hostname and urlparse(self.api_url).hostname.endswith(".azure.com"):
4243
# azure ai header
4344
headers = {"api-key": f"{self.api_key}"}
4445
else:

0 commit comments

Comments
 (0)