Daemon policy: require every host command to be fenced (image:, sandbox:), with a two-key opt-out

Open
#263 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
docker, go
Domain
cli, security

Research direction

Start with accept() in internal/cli/daemon.go and visitContainerSettings in internal/config/container.go, then trace how daemon configuration is loaded and how set and restore report acceptance failures. The proposal spans policy checks, several command types, validation, and UI reporting; first agree on the staged scope. Done means the selected stages enforce the documented fence rules and opt-outs, with warn and enforce behavior verified for set, restore, and validate.

Written by the indexing model from the issue text.

Description

Problem

Whether a command runs fenced (image:, sandbox: true, a docker+ worker) is entirely the pipeline author's choice. A daemon operator has no way to say "nothing runs bare on this machine". A pipeline someone else sets, or an old one nobody updated, runs model-chosen or third-party commands as the daemon's own user.

Proposal

A steps web option, so it can live in the web: key of --config:

web:
  fence: off | warn | enforce
  allow-unfenced:
    some-pipeline: [task post, resource_type archive]
  • off: today's behavior.
  • warn: accept, but list unfenced entities in set's answer and in the UI.
  • enforce: refuse at set, and at boot restore. A stored pipeline that no longer complies is shown broken, the same path a --worker change takes.
Where it plugs in
  • accept() in internal/cli/daemon.go already runs on both set and restore, and already refuses with reasons the terminal prints. CheckSecretSources is the precedent for a daemon-config fact deciding acceptance.
  • visitContainerSettings (internal/config/container.go) already visits every command-running entity with its resolved image: and sandbox:. The check is one more visitor.
  • The config file is already the privilege boundary: owner-only permissions, never discovered from a repo. A pipeline cannot loosen the policy that judges it.
What counts as fenced
Fenced No command, nothing to fence Unfenced
image: without privileged: true expr: types, Go built-ins, approval:, load_var: everything else
sandbox: true, only when the daemon is darwin agent file tools on the host (path-confined by steps)
placed on docker+ssh://, aws://, gcp://, do://

These are machine facts, so they belong in accept(), not the file validator:

  • sandbox: true on a Linux daemon is refused at set; today it fails at the step.
  • A step placed on a bare ssh:// worker counts as unfenced.
  • privileged: true counts as unfenced.
Opt-out: two keys

An entity is exempt under enforce only when both hold:

  1. The pipeline declares it, e.g. unfenced: "<reason>" on the entity. The reason shows in diffs and the UI.
  2. The daemon config allowlists it (allow-unfenced:, keyed by pipeline and entity).

Why both:

  • A pipeline-only opt-out is self-certification, worthless against a pipeline you didn't write.
  • A config-only opt-out hides the reason from whoever reads the pipeline.
  • A renamed entity drops off the allowlist and is refused. That's the safe direction.

Alternatives considered:

  • Approval pinned to content. An admin approves an entity's merkle digest, and any edit needs re-approval (Jenkins script approval). Strongest; a candidate later for multi-tenant daemons.
  • Role-gated opt-outs. Only an admin's set may carry them. Depends on auth being on.

Gaps to close before enforce is usable

Today these have no fence option at all, so enforce would refuse them with no way to comply:

  1. Inline run: steps, including every job hook. sandbox: exists only on tasks:/agents:/resource_types: entries. Proposal: accept sandbox: true on the step itself. A true-only setting cannot weaken an entry's fence.
  2. The built-in git type runs host git, and a custom type cannot reuse the name to add an image:.
    • Plain gets could be sandboxed automatically.
    • fetch: true on a local uri: writes into the source clone, outside the workspace, so it needs an opt-out or a "built-ins are engine code" rule.
  3. Stdio MCP servers are documented as not fenced under either setting. Needs image:/sandbox: on the server definition. A server whose command: is docker run … is fenced in practice, but steps cannot tell.
  4. The CLI agent process is always a host subprocess, and with settings: project it executes the target repo's .claude/ hooks on the host. Suggested rule: fenced enough without settings:; settings: project needs an opt-out.
  5. mcp_exports custom commands have no sandbox:; image: covers them.

Edges

  • steps run and steps test never consult the daemon (--config is ignored). That's fine, since the operator is the one running them. But steps validate --config <file> should report against the policy, so a pipeline can be checked before set.
  • sandbox: fences writes, not reads. Reads stay open except credential paths, and the network stays open unless network: none. A stricter mode requiring network: none should be a separate knob, not folded into this one.
  • expr: file()/env() read the host in-process. They are out of scope, since no command runs.
  • Rollout: warn first. enforce turns every non-compliant stored pipeline into broken on the next restart.

Suggested order

  1. Step-level sandbox: true (gap 1). It unblocks the most and is useful on its own.
  2. fence: warn, plus the steps validate --config report.
  3. The two-key opt-out and fence: enforce.
  4. MCP server fencing and the built-in git decision (gaps 2–3).
Dominant language
Go
Stars
14
Forks
2
Avg merge
2h 28m
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jtarchie/steps

All issues in jtarchie/steps

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.