dify icon indicating copy to clipboard operation
dify copied to clipboard

fix(extension): route API-based extension requests through ssrf_proxy

Open AlexMultiAgent opened this issue 4 months ago • 1 comments

APIBasedExtensionRequestor bypasses the SSRF proxy for outbound user-supplied URLs

api/core/extension/api_based_extension_requestor.py issues HTTP requests to a user-supplied api_endpoint using a raw httpx.Client. SSRF protection was conditional on the optional SSRF_PROXY_HTTP_URL /SSRF_PROXY_HTTPS_URL env vars being configured; when the proxy was not configured the request went straight to the supplied URL.

Every other internal Dify outbound HTTP call (HTTP node, custom tools, MCP, remote file fetchers, moderation, etc.) routes through core.helper.ssrf_proxy, which performs URL/DNS validation and blocks loopback, link-local, and metadata destinations. This requestor was the lone exception.

The endpoint is reachable from any logged-in tenant user through POST /console/api/api-based-extension, and the same URL is re-validated on every moderation input, moderation output, and external_data_tool query. A tenant can direct the server to internal network addresses on every call.

Fix

Route the request through core.helper.ssrf_proxy.make_request, matching every other internal Dify outbound call. The optional-mounts dance is removed entirely.

AlexMultiAgent avatar Jul 24 '26 08:07 AlexMultiAgent

Hi @AlexMultiAgent, thanks for opening this issue.

Why this is being closed

The report raises a possible outbound-request security concern, but does not identify the tested Dify version or commit, deployment and proxy configuration, or a complete proof of concept. The security team needs those details to verify the claimed impact privately. The bug report template asks for version, deployment and reproduction context. This closure does not establish whether the observation is correct.

Next steps

Please share the exact version, deployment, proxy configuration and a complete sanitized proof of concept through the private advisory process below. Do not post private addresses, credentials or sensitive payloads here.

First, if you believe this is a security-related issue, please submit it through a GitHub Advisory and please provide a complete proof of concept (PoC)

https://github.com/langgenius/dify/security/advisories/new

Once the context is available, a maintainer can reassess the report.

crazywoola avatar Nov 20 '26 04:11 crazywoola