mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-03 06:08:15 +00:00
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -159,6 +159,15 @@ def safe_get(url: str, **kwargs: Any) -> requests.Response:
|
||||
ValueError: If the URL, a redirect target, or the connected peer is
|
||||
not allowed.
|
||||
"""
|
||||
# Prevent callers from forcing a proxy path (which would validate the proxy
|
||||
# peer IP rather than the destination), unless the escape hatch is enabled.
|
||||
proxies = kwargs.pop("proxies", None)
|
||||
if proxies and proxies != {} and not _is_escape_hatch_enabled():
|
||||
raise ValueError(
|
||||
"Proxies are not allowed for safe_get. Set CREWAI_TOOLS_ALLOW_UNSAFE_PATHS=true to bypass."
|
||||
)
|
||||
kwargs["proxies"] = {}
|
||||
|
||||
validate_url(url)
|
||||
with create_safe_session() as session:
|
||||
return session.get(url, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user