fix(deploy): strip internal trust headers at proxy layer; run containers as non-root - #4985
Draft
simpleqt wants to merge 1 commit into
Draft
fix(deploy): strip internal trust headers at proxy layer; run containers as non-root#4985simpleqt wants to merge 1 commit into
simpleqt wants to merge 1 commit into
Conversation
…ers as non-root Proxy headers: the Gateway treats X-DeerFlow-Internal-Token and X-DeerFlow-Owner-User-Id as internal credentials that bypass session auth and impersonate arbitrary users. Browser clients can set arbitrary custom headers, so the public hops (Next.js /api/memory proxy and every nginx proxying location) now strip both headers before forwarding. nginx does not inherit proxy_set_header into locations that define their own, hence the explicit clearing in all 16 locations. Containers: the frontend, backend and provisioner images all ran as root. The agent runtime can execute tool/shell commands, so a container compromise (or a prompt-injected run in host-bash mode) meant instant root. The frontend now runs as the image's uid-1000 node user, the backend and provisioner create a dedicated uid-1000 deerflow user, and HOME is set so ~/.deer-flow runtime state stays writable. The DooD overlay opts the gateway back into root explicitly because the host Docker socket requires it; this matches the Helm chart, which already sets runAsNonRoot/runAsUser 1000.
simpleqt
marked this pull request as draft
August 24, 2026 03:55
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.
Proxy headers: the Gateway treats X-DeerFlow-Internal-Token and
X-DeerFlow-Owner-User-Id as internal credentials that bypass session
auth and impersonate arbitrary users. Browser clients can set arbitrary
custom headers, so the public hops (Next.js /api/memory proxy and every
nginx proxying location) now strip both headers before forwarding.
nginx does not inherit proxy_set_header into locations that define their
own, hence the explicit clearing in all 16 locations.
Containers: the frontend, backend and provisioner images all ran as
root. The agent runtime can execute tool/shell commands, so a container
compromise (or a prompt-injected run in host-bash mode) meant instant
root. The frontend now runs as the image's uid-1000 node user, the
backend and provisioner create a dedicated uid-1000 deerflow user, and
HOME is set so ~/.deer-flow runtime state stays writable. The DooD
overlay opts the gateway back into root explicitly because the host
Docker socket requires it; this matches the Helm chart, which already
sets runAsNonRoot/runAsUser 1000.