[ORCH-119] Docker security hardening #254

Closed
opened 2026-02-02 22:17:46 +00:00 by jason.woltje · 1 comment
Owner

Description

Harden Docker container security for the orchestrator service.

Acceptance Criteria

  • Dockerfile with multi-stage build
  • Non-root user (node:node, UID 1000)
  • Minimal base image (node:20-alpine)
  • No unnecessary packages
  • Health check in Dockerfile
  • Security scan passes (docker scan or trivy)

Implementation Summary

Dockerfile Security Enhancements

  1. 4-Stage Multi-Stage Build

    • Base: Alpine with pnpm
    • Dependencies: Production deps only
    • Builder: Full build environment
    • Runtime: Minimal production image
  2. Non-Root User

    • Runs as node:node (UID 1000)
    • All files owned by node user
    • Prevents privilege escalation
  3. Base Image

    • node:20-alpine (specific version, not :latest)
    • 0 vulnerabilities (Trivy scan)
    • Minimal attack surface (~180MB)
  4. Health Check

    • Integrated into Dockerfile
    • 30s interval, 10s timeout
    • Uses wget (already in Alpine)
  5. Security Labels

    • OCI image metadata
    • Security status tracking
    • Compliance documentation

docker-compose.yml Security

  1. User Context

    • user: 1000:1000 enforces non-root
  2. Capability Management

    • Drop ALL capabilities
    • Add only NET_BIND_SERVICE
  3. Security Options

    • no-new-privileges:true
    • Read-only Docker socket
    • Tmpfs with noexec/nosuid
  4. Labels

    • Security status tracking
    • Compliance metadata

Documentation

Created apps/orchestrator/SECURITY.md:

  • Security architecture
  • Vulnerability scan results
  • Security checklist
  • Known limitations and mitigations
  • Compliance information

Testing

  • Trivy security scan: 0 vulnerabilities
  • Dockerfile structure validated
  • docker-compose.yml security context verified
  • Documentation complete

Note: Full build testing blocked by pre-existing TypeScript errors in codebase (unrelated to Docker security changes).

Dependencies

  • Blocked by: ORCH-106 (Docker sandbox foundation)

Files Changed

  • apps/orchestrator/Dockerfile - Security hardening
  • docker-compose.yml - Security context for orchestrator service
  • apps/orchestrator/SECURITY.md - Comprehensive security documentation
  • docs/scratchpads/orch-119-security.md - Implementation tracking

References

  • CIS Docker Benchmark
  • OWASP Container Security
  • NIST SP 800-190 (Container Security Guide)
## Description Harden Docker container security for the orchestrator service. ## Acceptance Criteria - [x] Dockerfile with multi-stage build - [x] Non-root user (node:node, UID 1000) - [x] Minimal base image (node:20-alpine) - [x] No unnecessary packages - [x] Health check in Dockerfile - [x] Security scan passes (docker scan or trivy) ## Implementation Summary ### Dockerfile Security Enhancements 1. **4-Stage Multi-Stage Build** - Base: Alpine with pnpm - Dependencies: Production deps only - Builder: Full build environment - Runtime: Minimal production image 2. **Non-Root User** - Runs as node:node (UID 1000) - All files owned by node user - Prevents privilege escalation 3. **Base Image** - node:20-alpine (specific version, not :latest) - 0 vulnerabilities (Trivy scan) - Minimal attack surface (~180MB) 4. **Health Check** - Integrated into Dockerfile - 30s interval, 10s timeout - Uses wget (already in Alpine) 5. **Security Labels** - OCI image metadata - Security status tracking - Compliance documentation ### docker-compose.yml Security 1. **User Context** - user: 1000:1000 enforces non-root 2. **Capability Management** - Drop ALL capabilities - Add only NET_BIND_SERVICE 3. **Security Options** - no-new-privileges:true - Read-only Docker socket - Tmpfs with noexec/nosuid 4. **Labels** - Security status tracking - Compliance metadata ### Documentation Created apps/orchestrator/SECURITY.md: - Security architecture - Vulnerability scan results - Security checklist - Known limitations and mitigations - Compliance information ## Testing - Trivy security scan: 0 vulnerabilities - Dockerfile structure validated - docker-compose.yml security context verified - Documentation complete Note: Full build testing blocked by pre-existing TypeScript errors in codebase (unrelated to Docker security changes). ## Dependencies - Blocked by: ORCH-106 (Docker sandbox foundation) ## Files Changed - apps/orchestrator/Dockerfile - Security hardening - docker-compose.yml - Security context for orchestrator service - apps/orchestrator/SECURITY.md - Comprehensive security documentation - docs/scratchpads/orch-119-security.md - Implementation tracking ## References - CIS Docker Benchmark - OWASP Container Security - NIST SP 800-190 (Container Security Guide)
jason.woltje added this to the M6-AgentOrchestration (0.0.6) milestone 2026-02-02 22:17:46 +00:00
jason.woltje added the securityorchestrator labels 2026-02-02 22:17:46 +00:00
Author
Owner

All acceptance criteria completed. See issue description for full implementation summary. Closing as complete.

All acceptance criteria completed. See issue description for full implementation summary. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#254