Skip to content

Commit 2e8f301

Browse files
committed
chore(security): fix security issue can be exploited
1 parent 893df22 commit 2e8f301

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

AgentCrew/modules/custom_llm/service.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async def process_message(self, prompt: str, temperature: float = 0) -> str:
8080
# Check if using GitHub Copilot
8181
if self.base_url:
8282
from urllib.parse import urlparse
83+
8384
parsed_url = urlparse(self.base_url)
8485
host = parsed_url.hostname
8586
if host and host.endswith(".githubcopilot.com"):
@@ -134,9 +135,14 @@ async def process_message(self, prompt: str, temperature: float = 0) -> str:
134135
async def stream_assistant_response(self, messages):
135136
"""Stream the assistant's response with tool support."""
136137
# Check if using GitHub Copilot
137-
if self.base_url and self.base_url.rstrip("/").endswith("githubcopilot.com"):
138-
# Update client with new key
139-
self.github_copilot_token_to_open_ai_key(self.api_key)
138+
if self.base_url:
139+
from urllib.parse import urlparse
140+
141+
parsed_url = urlparse(self.base_url)
142+
host = parsed_url.hostname
143+
if host and host.endswith(".githubcopilot.com"):
144+
self.base_url = self.base_url.rstrip("/")
145+
self.github_copilot_token_to_open_ai_key(self.api_key)
140146

141147
stream_params = {
142148
"model": self.model,

0 commit comments

Comments
 (0)