Skip to content

Docker hardening#278

Open
andri-coral wants to merge 8 commits into
masterfrom
feat/docker_hardening
Open

Docker hardening#278
andri-coral wants to merge 8 commits into
masterfrom
feat/docker_hardening

Conversation

@andri-coral

@andri-coral andri-coral commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Why this matters

Marketplace and linked-source agents now run with hardened defaults out of the box: read-only rootfs, dropped capabilities, bounded CPU/memory/PIDs, non-root UID, denied executable runtime. So a buggy or hostile third-party agent can't trash the host, exhaust resources, or escape the container.

Operators don't need to write bespoke per-agent Docker policy: the hardening is uniform across all marketplace and linked agents, overridable per-tier in config.toml when an agent legitimately needs more headroom.

Locally-authored agents keep running under the looser trusted_local profile so day-to-day development iteration is unaffected.

Hardening

ExecutionTrustPolicy resolved from AgentRegistrySourceIdentifier → applied to docker-java HostConfig. Marketplace defaults:

  • readOnlyRootFilesystem = true, user = "65532:65532" (distroless nonroot)
  • nanoCpus = 1e9 (1 vCPU), memoryLimitBytes = 512 MiB, pidsLimit = 256
  • dropCapabilities = {"ALL"}, noNewPrivileges = true
  • tmpfs /tmp rw,noexec,nosuid,nodev,size=64m

Trusted defaults keep caps/privs/pids posture + tmpfs (defense-in-depth) and skip rootfs/UID/resource caps so local iteration stays smooth. "Trusted" is not "permissive" — it's "less constrained".

ExecutableRuntime denied for marketplace/linked unless security.allow_untrusted_executable_runtime = true.

File-transport temp payloads tightened to read-only POSIX perms.

Agent-side surface

  • HOME/TMPDIR/XDG_* redirected to tmpfs when requiresWritableTmpHome — necessary plumbing under RO rootfs + non-root UID for distroless images, not extra hardening.

Scope and known gaps

  • Out of scope egress mediation; manifest [execution] schema; runtime × tier compatibility (resolver doesn't see RuntimeId yet, so the marketplace UID will conflict with the OpenShell supervisor when Stage 2 lands
  • requireImageDigest plumbing in place, off by default. Operators can opt in via config.toml.

Operator overrides

[security]
allow_untrusted_executable_runtime = false   # default

[docker.marketplace]
memory_limit_bytes = 1073741824              # 1 GiB
require_image_digest = true                  # strict pinning today

Marketplace images must ship with the 65532:65532 UID/GID present. Agents requiring root fail at container start under the default profile, the operator can relax [docker.marketplace] user or the author must repackage.

@andri-coral andri-coral force-pushed the feat/docker_hardening branch 2 times, most recently from 88e59f0 to b92e2b1 Compare May 11, 2026 10:18
@andri-coral andri-coral force-pushed the feat/docker_hardening branch from e42ff39 to af5e43b Compare May 11, 2026 12:20
@andri-coral andri-coral changed the title docker hardening Docker hardening May 11, 2026
@andri-coral andri-coral requested review from CaelumF and seafraf May 11, 2026 12:44
@andri-coral andri-coral marked this pull request as ready for review May 11, 2026 12:44
@andri-coral andri-coral requested a review from a team May 11, 2026 12:44
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.

1 participant