Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: external knowledge url check ssrf (#26789)

屈定44d36f246087
diff --git a/api/services/external_knowledge_service.py b/api/services/external_knowledge_service.py
index b6ba3bafea1..5cd3b471f97 100644
--- a/api/services/external_knowledge_service.py
+++ b/api/services/external_knowledge_service.py
@@ -88,9 +88,9 @@ class ExternalDatasetService:
else:
raise ValueError(f"invalid endpoint: {endpoint}")
try:
- response = httpx.post(endpoint, headers={"Authorization": f"Bearer {api_key}"})
- except Exception:
- raise ValueError(f"failed to connect to the endpoint: {endpoint}")
+ response = ssrf_proxy.post(endpoint, headers={"Authorization": f"Bearer {api_key}"})
+ except Exception as e:
+ raise ValueError(f"failed to connect to the endpoint: {endpoint}") from e
if response.status_code == 502:
raise ValueError(f"Bad Gateway: failed to connect to the endpoint: {endpoint}")
if response.status_code == 404: