Skip to content

[SECURITY] Run the production container as a non-root user #833

Closed

Description

@jeffreyaven

Constituent of #769. Reviewed current main at 1de4135 on 2026-10-08; this issue proposes work, no implementation is included.

CWEs: CWE-250.

Source: GitHub Security Lab finding 21530, originally tested at adc0956, plus current-code review and the validation below. Credit: GitHub Security Lab Taskflow Agent, GitHub Secure Open Source Fund, reported by @JarLob.

Finding and evidence

The final app stage starts from ubuntu:22.04 and contains no USER instruction (Dockerfile). Thus a build from this Dockerfile runs the default server as root unless the caller overrides it. This source state is unchanged from the distribution concern in lab finding 21530.

Root magnifies filesystem/credential impact of server defects. It is not, by itself, a container escape. This review inspected the current Dockerfile and did not rebuild/pull a production image; the lab inspected a published image at its earlier tested version.

Required outcome

  • Create a dedicated runtime user/group, give it only the required writable application/cache locations, and set USER in the production stage.
  • Keep secrets/config read-only where practical and document volume ownership/user overrides.
  • Preserve CLI and authenticated server use; do not change build/test utility stages unnecessarily.

Validation and acceptance

Build the production image, inspect Config.User, and run CLI plus pgwire/MCP smoke tests as non-root with fresh and mounted cache volumes. Verify registry installation, audit output and credential-file access with intended permissions. Include supported-platform image checks.

Scope and related work

The default unauthenticated server command and published-port behavior are covered by the listener issue. This separate issue is privilege reduction and can be delivered independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions