fix: allow configured file endpoints through agent proxy - #39839
Open
zyssyz123 wants to merge 1 commit into
Open
fix: allow configured file endpoints through agent proxy#39839zyssyz123 wants to merge 1 commit into
zyssyz123 wants to merge 1 commit into
Conversation
zyssyz123
requested review from
QuantumGhost,
crazywoola and
laipz8200
as code owners
July 31, 2026 04:15
Contributor
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #39839 +/- ##
=======================================
Coverage 86.18% 86.18%
=======================================
Files 5086 5086
Lines 287691 287697 +6
Branches 57356 57357 +1
=======================================
+ Hits 247950 247958 +8
+ Misses 34938 34936 -2
Partials 4803 4803
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6 tasks
laipz8200
reviewed
Aug 3, 2026
|
|
||
| AGENT_FILE_TARGETS_CONF=/etc/squid/dify_agent_file_targets.conf | ||
|
|
||
| extract_url_host() { |
Member
There was a problem hiding this comment.
This function discards the scheme and port. For example, a user-configured https://files.internal:8443 would be parsed as files.internal, resulting in https://files.internal:443 being forwarded. Is this expected?
laipz8200
requested changes
Aug 3, 2026
| acl dst_dify_api dstdomain api | ||
| acl dst_agent_backend dstdomain -n agent_backend | ||
| acl dst_dify_api dstdomain -n api | ||
| acl path_files urlpath_regex -i ^/files/ |
Member
There was a problem hiding this comment.
Please confirm if the attacker could exploit URL normalization in Nginx to bypass this pattern matching, such as using /files/../console/api/...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
INTERNAL_FILES_URLwith explicit precedence overSERVER_CONSOLE_API_URLandFILES_URL, including the common Docker case where the variable is present but emptyagent_ssrf_proxyand generate a narrow allow rule for the configured host while preserving private-network denial for other destinationsFixes #39733
Screenshots
Not applicable; this is a backend and Docker proxy fix.
Validation
c52c2da0ee3df64f35f86ea23fd7986cfb442369to the dev environmentagent-upload.dify.devChecklist
make lint && make type-check; focused backend lint and type checks passed.From Codex