Security

Known issues

Deferred work, with why and the path forward.

Tracked gaps that are deliberately deferred. Each entry says what is missing, why, the impact, the path forward, and where the code lives.

1. Remote run: stack deploys; stack builds are open

Pillar: Deploy · Status: routing, zero-downtime, and destroy implemented

What works now. A run: container project with a machine: builds on the machine: the client packages the build context (build.run, a gzipped tar with the context's .dockerignore applied), the worker unpacks it into a temporary directory, runs the same builder as the local path, and starts the container with volumes, resources, restart policy, and log rotation. A run: compose project with a machine: deploys unresolved when nothing needs building: the compose layers and every file they reference (include/extends targets, env_file files, .env, and secrets/configs sources) are shipped at their project-relative paths, and the worker resolves (docker compose config, with deploy.profiles), guards, and applies them. A project that declares build: resolves on the client (deploy.files layers, deploy.profiles), builds every service that declares build: on the machine (each service's context is uploaded and built individually, then rewritten to the produced image:), and ships the resolved document to the worker, which runs docker compose up -d. Image-only services pull as before. deploy.build_services: false is refused for a file that still declares build:, the machine has no source tree to run it from.

A run: stack project with a machine: sends the stack file (single file; deploy.files layering is refused) to the worker, which refuses any service that declares build: (push the image first, for example with deploy.registry), stores the file under the machine's project directory, and runs docker stack deploy --with-registry-auth. Domains are routed through the machine's Caddy at each stack service's published host port (the domain names the service with service: and its container port with port:). Every service gets ant's managed/app labels, so tasks show up in ant nest containers list and ant trail status, and ant trail logs <deployment> [service] reads a task's logs (name the service when the stack has several). The machine must be a Swarm manager, ant nest swarm init --machine M sets up a single-node one; ant nest swarm status and ant nest swarm leave --force manage it. Swarm is a server feature: ant never initializes a swarm on this host. zero_downtime patches a Swarm rolling-update policy (start-first, rollback on failure, convergence wait); services that publish ports in host mode fall back to stop-first with a warning, since two tasks cannot bind the same host port on a single node.

What's missing.

  • Stack builds: services that declare build: are refused; prebuild and push, or use run: container/run: compose.
  • Stack rollback: re-applies the stored release record (issue 10). For a record that does not exist (an older deploy), pin the previous image in the stack file and redeploy (Swarm rolls it out).
  • Cluster and service operations: the common ones are available (nest swarm nodes, node promote|demote|drain|activate|pause|rm, join-token, services, service ps|logs|scale|restart|update|rm). Anything beyond them (overlay/network administration, swarm configs and secrets, and the rest of docker service update) stays docker commands on the machine.

ant trail destroy --machine M stops and removes the deployment's workload on the machine (container, compose project, or stack) and clears its Caddy routes. The machine's images are left in place, so a redeploy reuses the build cache; the local command deletes ant-built images instead.

  • Compose build features: build.target, build.secrets, build.ssh, and build.additional_contexts are refused (not silently ignored); prebuild and reference the image instead.

Note. A shipped compose bundle travels inside one RPC request frame, capped at 2 MiB (response frames are capped at 8 MiB); a bundle larger than the client's own cap resolves locally instead, and a resolved document that itself exceeds the frame cap fails. Build logs from build.run are capped at 1 MiB (the tail is returned), and the worker bounds context extraction to 8 GiB and rejects unsafe archive entries.

2. Registry credentials travel with the deploy

Pillar: Deploy · Status: implemented

What works now. With deploy.registry set, a source-built remote deploy builds on this machine, tags the image <host>/<repository>/<app>:<release>, and pushes it (docker login --password-stdin when ANT_REGISTRY_PASSWORD is set); the machine then pulls the qualified reference on deploy.run. The same password travels with the deploy over the encrypted transport and is materialized on the machine as a short-lived DOCKER_CONFIG (0700 directory, 0600 file) for every command that can pull: deploy.run, compose.apply, and stack.apply (where --with-registry-auth forwards it to the nodes). The directory is removed when the operation ends; ant never stores the credential in a config or on disk. For an explicit --image ghcr.io/... pull without deploy.registry, the host is parsed from the reference and the username comes from ANT_REGISTRY_USERNAME (both with ANT_REGISTRY_PASSWORD).

Limits. The credential crosses the wire on each deploy, the transport encrypts the frame, and the value is handled like any other runtime secret. Anyone who may deploy can therefore pull the configured registry's private images; deployer/ci are already root-equivalent by design. The local image built for the push is not pruned by the local pruner yet.

3. The dashboard is strictly local (no multi-user auth)

Pillar: Collab · Status: enforced

Each operator runs their own dashboard, on their own laptop, against their own ~/.ant, and it is never hosted on a server: the bind is loopback-only and a non-loopback --host is refused. There is no password and no remote-access mode. Machine access is governed by each machine's colony roster and roles, so a dashboard can only act on the machines its account can reach. The local machine has exactly one user (the signed-in account, managed in Settings), so roster and invite surfaces exist only on remote machines.

4. The audit log is local to the machine

Pillar: Security · Status: implemented; off-host collector deferred

Privileged actions (deploy, route, roster, volume, tunnel) are appended to a hash-chained log, and ant nest audit reports whether the chain verifies, so an edited or removed line is detected. The log rotates at 8 MiB (the prior segment is kept as audit.log.1 and is independently verifiable); reading the log requires the admin role. Clients anchor the chain: after a privileged call the CLI stores the head it saw, and the next gated call is refused if that entry is gone from the retained log without having simply aged out by rotation (ant nest audit --reset-anchor clears it after inspection). A worker can mirror each entry to an operator HTTP endpoint with --audit-webhook (best-effort, bounded queue, one JSON entry per request). An operator with root can still delete the whole file, and there is no built-in collector, syslog forwarder, or retention policy beyond rotation.

5. Machine NodeID pinning on first contact

Pillar: Security · Status: implemented

The iroh transport authenticates that a machine holds the key for the NodeID it presents, so a registered NodeID is proven by every call. Direct registration now also records the first contact: a machine added by hostname learns its NodeID on the first successful dial, ant nest machines verify <id> performs the check explicitly, and ant nest machines list shows whether each entry has been verified. A machine that answers as a NodeID other than the registered one is refused. Invite tokens still pin the machine NodeID out of band (the token is signed by the machine), which remains the strongest way to join a machine you have never contacted.

6. No secret store

Pillar: Security · Status: accepted

Ant has no vault of its own: build-time secrets are read from the operator's environment and passed to the builder for one build, and runtime secrets are injected as container environment variables. Nothing is encrypted at rest by ant, and no secret is ever written to ant.yaml, the lockfile, or the machine state. A secret may name a provider (from: op://… for 1Password, a generic cmd:… for Vault/AWS/pass, or env:…), resolved through the operator's CLI at deploy time so the value still never lands in ant. deploy.secrets entries with no environment value are reported as warnings, not errors, so a typo is visible but not fatal.

If you need rotation, audit, or per-environment access control for secrets, keep them in your existing secret manager and export them into the deploy environment. The team-level guidance is in Secrets.

7. Worker upgrades: self-update, with a one-time re-provision for old installs

Pillar: Ops · Status: implemented

A worker installed from this version owns its binary under /home/ant/.ant/worker/bin/ant-worker, so ant nest worker update --machine prod uploads a replacement over iroh and the daemon swaps the file and re-execs in place — no SSH and no root. The machine identity and state.json (roster, invites) are untouched, and the command waits for the new image to answer and reports the version change. The RPC is owner-only.

A machine provisioned before self-update support runs from /usr/local/bin/ant-worker (root-owned) and cannot replace itself; the update returns an actionable error. Re-provision it once over SSH (or with --cloud-init), which moves the binary into the worker's own directory and preserves identity and state:

ant nest bootstrap --machine prod --host 192.0.2.10 --ssh-key ~/.ssh/id_ed25519

The client and worker carry an RPC protocol version and refuse to operate against a mismatched peer, so upgrade both sides together (CLI first is fine: an old worker answers the new client with a version error until it is updated or re-provisioned).

8. Remote zero_downtime: containers, stacks, and compose

Pillar: Deploy · Status: implemented

A remote run: container deploy with zero_downtime and at least one domain stages the new container beside the running one on an ephemeral host port, health-gates it, moves the app's Caddy routes to that port, and only then parks-and-removes the old container and renames the new one into service. The published port survives the rename, so the routes keep serving throughout. The swap is one deploy.run call (routes travel in the payload), so a failure before the route move leaves the old container and its routes untouched. A local container deploy replaces in place and reports that zero_downtime is not applied.

A run: stack deploy with zero_downtime patches a Swarm rolling-update policy: order: start-first, failure_action: rollback, and a convergence wait, so Swarm starts new tasks before stopping old ones while the published port (held by the routing mesh) keeps serving. Services that publish ports in mode: host cannot overlap two tasks on a single node, so those get stop-first with a warning; services without a healthcheck warn that rollback relies on task state. Routing warns too when a routed service publishes in mode: host on a multi-node swarm: that port exists only on the node running the task, while Caddy runs on the manager.

A run: compose deploy with zero_downtime and at least one domain stages the project under a unique name (<project>-zd-<suffix>) with every published port rewritten to an ephemeral one, waits for it (up -d --wait), moves the routes to the staged services' discovered ports, and only then stops the previous projects. The staged project's file stays in the project directory so compose.down and later deploys can find and remove it. The same blockers as the container rollout are refused with a fallback to the recreate strategy: container_name and named read-write volumes (two parallel writers would corrupt the volume); a route that names no compose service is refused too. Anonymous volumes are not shared between the copies, so a service that keeps state in one should declare a named read-only volume or deploy with zero_downtime: false.

The container path falls back to the staged swap (with a warning) when there is no domain to move, no running predecessor, or a writable mount that must not be attached to a second container. Compose falls back to the recreate strategy for the blockers above.

9. CI credentials: expiring grants and workload identity

Pillar: Collab · Status: implemented (expiry + OIDC); rotation still manual

A pipeline no longer needs a long-lived account key:

  • Expiring memberships. users.add --expires-in and invite --grant-ttl give a ci member a deadline; the daemon stops authorizing it at that time. This is the smallest change for an existing bundle-based pipeline.
  • Workload identity (OIDC). ant colony oidc set stores a per-machine rule (issuer, JWKS, audience, repository/ref patterns); ant colony join --oidc --github lets each job create a throwaway account and receive an expiring ci membership verified against the provider's signed token. Nothing long-lived is stored in the CI system.

Remaining gaps: OIDC verification supports RS256 providers (GitHub Actions, GitLab) and the repository/project_path + ref claims; a bundle-based pipeline still rotates by removing and re-inviting, and there is no per-job audit beyond the oidc.redeem entries. See CI.

10. Compose and stack rollback

Pillar: Deploy · Status: implemented for remote projects; local stays manual

A remote compose/stack deploy now stores a release record on the machine: the exact file that was applied (with ${KEY} references), its routes, and the flags. ant trail rollback on such a project re-applies that record — --steps picks how far back, --to names a release — and switches the project back. ant trail releases <deployment> lists the records and --show RELEASE prints the stored file, so any operator with machine access can inspect what was applied without the project source. Secret values are supplied again from the operator's environment and are never stored. Records are kept per project, newest 20.

Remaining gaps: local compose/stack projects have no record (pin the previous images and redeploy, as in Remote deploy), and records for projects deployed with an older client do not exist until the next deploy. A record does not pin image digests, so a tag that was overwritten in a registry can still resolve to different bits.

11. macOS and Windows remote clients

Pillar: Transport · Status: deferred (Linux + CGO only)

The iroh transport compiles only for linux/amd64 and linux/arm64 with CGO, so the macOS and Windows release CLIs are local-first: they cannot dial machines, run tunnels, or update workers. Use a Linux client (a VM, a container, CI, or WSL on Windows) for remote work. A pure-Go transport or a cross-compiled binding would lift this. See Platform support.

12. Owner election requires a signed countersignature

Pillar: Security · Status: implemented

With zero owners and at least two admins, an admin can promote a member (including itself) to owner only by presenting a second admin's signed consent token: ant colony election-consent <nodeid> is bound to the machine and the candidate, expires, and is single-use; the daemon verifies the signature and the consenter's current admin role before promoting, and fails closed without it. An admin is still a sensitive role — it can produce a consent for a candidate of its choosing — so grant it only to co-operators. The daemon fails closed with no owners, and ant colony recover --add-owner is the break-glass path with operator access.

13. The transport binding is vendored

Pillar: Transport · Status: accepted

The iroh transport is linked through a vendored Go binding over iroh v1.0.3 / iroh-ffi v1.1.0, built as a committed static library. Updating iroh means editing the binding and regenerating the libs (task libs:build), and the module is pinned through a local replace with no published version, so a remote go install …@latest does not work yet. Release binaries are checksum-verified but not code-signed. See Supply chain.

Tracked on other branches

  • SSH over iroh: the TCP-forwarding primitive now exists (ant nest tunnel, a raw iroh stream), so forwarding a machine's sshd is the next step; provisioning still uses the host's standard SSH (with --cloud-init as the no-SSH fallback).
  • Container-to-container across machines: ant nest tunnel lets an operator reach a peer machine's published ports over iroh. A worker dialing another worker would need the caller's machine NodeID on the peer's roster, a machine-to-machine trust model that does not exist yet (the roster holds account NodeIDs).
Copyright © 2026