Skip to content

fix(agent-bot): run as non-root bun user - #42

Merged
davidmckayv merged 1 commit into
CopilotKit:mainfrom
zopeVaibhav:fix/agent-bot-non-root-user
Aug 20, 2026
Merged

fix(agent-bot): run as non-root bun user#42
davidmckayv merged 1 commit into
CopilotKit:mainfrom
zopeVaibhav:fix/agent-bot-non-root-user

Conversation

@zopeVaibhav

Copy link
Copy Markdown
Contributor

Summary

  • Add USER bun to agent-bot/Dockerfile so the container process no longer runs as root (CWE-250).
  • Chown /app and use COPY --chown=bun:bun so bun install and runtime file access still work after the user switch.

Verification

Built the image and confirmed:

  • id inside container returns uid=1000(bun).
  • whoami returns bun; writes to /etc and /root are denied.
  • /health returns {"status":"ok",...} and POST /ag-ui returns 200.
  • Image metadata: User=bun, Cmd=[bun agent-bot/src/index.ts], port 4200 exposed.
  • Works with --read-only rootfs + tmpfs /tmp.

Closes #39

Drop root in the container so a compromised process cannot own the
whole container filesystem (CWE-250). Files copied with --chown=bun:bun
and /app is chowned before the USER switch so bun install still writes
node_modules.

Closes CopilotKit#39
@davidmckayv
davidmckayv merged commit 9864e07 into CopilotKit:main Aug 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible by not specifying a USER, a program in the container may run as 'root' in Dockerfile

2 participants