Skip to content

fix(security): add USER directive before ENTRYPOINT in all tenant images - #1155

Merged
molecule-ai[bot] merged 1 commit into
stagingfrom
fix/dockerfile-user-directive
Apr 20, 2026
Merged

molecule-ai[bot] merged 1 commit into
stagingfrom
fix/dockerfile-user-directive

Conversation

@molecule-ai

@molecule-ai molecule-ai Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Summary\n\nFixes CRITICAL finding #177 — all four Dockerfile images now run as a non-root user before the ENTRYPOINT/CMD fires.\n\n## Changes\n\n### workspace-server/Dockerfile (platform-only)\nNon-root platform user (UID 1000) via addgroup/adduser + USER platform.\n\n### workspace-server/Dockerfile.tenant\nNon-root canvas user + chown on canvas dir so node process can read static files.\n\n### canvas/Dockerfile\nNon-root canvas user.\n\n### workspace-server/entrypoint-tenant.sh\nUpdated header — no more root handoff needed.\n\n## Security rationale\n\nWithout USER, the container runs as root (PID 1). A container escape reaches host UID 0. With USER, any escape reaches host UID 1000 or 1001 at most.\n\nCloses: #177\n\n🤖 Generated with Claude Code

Closes: #177 (CRITICAL — Dockerfile runs as root)

Dockerfiles changed:
- workspace-server/Dockerfile (platform-only): addgroup/adduser + USER platform
- workspace-server/Dockerfile.tenant (combined Go+Canvas): addgroup/adduser + USER canvas
  + chown canvas:canvas on canvas dir so non-root node process can read it
- canvas/Dockerfile (canvas standalone): addgroup/adduser + USER canvas
- workspace-server/entrypoint-tenant.sh: update header comment (no longer starts
  as root; both processes now start non-root)

The entrypoint no longer needs a root→non-root handoff since both the Go
platform and Canvas node run as non-root by default. The 'canvas' user owns
/app and /platform, so volume mounts owned by the host's canvas user work
without needing a root init step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai
molecule-ai Bot merged commit 8b5faab into staging Apr 20, 2026
7 checks passed
molecule-ai Bot added a commit that referenced this pull request Apr 21, 2026
…ges (#1155)

Closes: #177 (CRITICAL — Dockerfile runs as root)

Dockerfiles changed:
- workspace-server/Dockerfile (platform-only): addgroup/adduser + USER platform
- workspace-server/Dockerfile.tenant (combined Go+Canvas): addgroup/adduser + USER canvas
  + chown canvas:canvas on canvas dir so non-root node process can read it
- canvas/Dockerfile (canvas standalone): addgroup/adduser + USER canvas
- workspace-server/entrypoint-tenant.sh: update header comment (no longer starts
  as root; both processes now start non-root)

The entrypoint no longer needs a root→non-root handoff since both the Go
platform and Canvas node run as non-root by default. The 'canvas' user owns
/app and /platform, so volume mounts owned by the host's canvas user work
without needing a root init step.

Co-authored-by: Molecule AI CP-BE <cp-be@agents.moleculesai.app>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@molecule-ai
molecule-ai Bot deleted the fix/dockerfile-user-directive branch May 20, 2026 06:21
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.

0 participants