Skip to content

fix(deploy): strip internal trust headers at proxy layer; run containers as non-root - #4985

Draft
simpleqt wants to merge 1 commit into
bytedance:mainfrom
simpleqt:fix-deploy-hardening
Draft

fix(deploy): strip internal trust headers at proxy layer; run containers as non-root#4985
simpleqt wants to merge 1 commit into
bytedance:mainfrom
simpleqt:fix-deploy-hardening

Conversation

@simpleqt

Copy link
Copy Markdown
Contributor

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.

…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.
Copilot AI lite review requested due to automatic review settings August 24, 2026 03:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added area:frontend Next.js frontend under frontend/ area:sandbox Sandboxed execution and docker/ risk:high High risk: backend API, agents, sandbox, auth, deps, CI size/S PR changes 20-100 lines labels Aug 24, 2026
@simpleqt
simpleqt marked this pull request as draft August 24, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Next.js frontend under frontend/ area:sandbox Sandboxed execution and docker/ risk:high High risk: backend API, agents, sandbox, auth, deps, CI size/S PR changes 20-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants