Skip to content

Refuse host shell on Docker agents by default, and always for fork pull requests - #168

Merged
blakebauman merged 2 commits into
mainfrom
fix/agent-refuse-host-shell
Nov 12, 2026
Merged

blakebauman merged 2 commits into
mainfrom
fix/agent-refuse-host-shell

Conversation

@blakebauman

@blakebauman blakebauman commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Audit finding SEC-1 (11 Nov). Breaking for imageless steps on a Docker-enabled agent.

The bug

A step with no image: ran on the agent's host shell even when the agent had FIBER_AGENT_USE_DOCKER=true, and nothing could refuse it. On the agent-docker Compose profile that shell is root with the host Docker socket mounted, so any project writer — or a fork PR author, through any imageless step that runs repo scripts — reached the Docker host and, from there, FIBER_SECRETS_KEY.

The fix

  • FIBER_AGENT_ALLOW_HOST_SHELL on the agent. Default: on for a shell agent, off for a Docker agent. Parsed strictly at startup. A refused step fails before any checkout or restore, with the remedy in its error.
  • untrusted on ServerMessage::Offer (serde(default)), set from the run row. The agent refuses host shell for a fork PR's step regardless of the flag — including on a pure shell agent, where the step now fails rather than running on the host.
  • Server-side gate: a fork PR's steps are only offered to a project agent whose Hello declared protocol revision 3 (this release); older agents ignore untrusted. The steps stay queued until one is online. Filtered in SQL ahead of the scan limit so they cannot hide trusted steps.
  • PROTOCOL_VERSION 2 → 3. Nothing compares for equality; old agents and old servers interoperate.
  • Compose: agent-docker pins the flag to false and adds docker=true; the plain agent gains executor=shell so an imageless step can ask for it. The pin only takes effect with an agent image from this release — the docs say how to confirm from the startup log.
  • Installer keeps an existing FIBER_AGENT_ALLOW_HOST_SHELL line across re-runs.
  • Docs (agents.md, triggers.md, pipeline-yaml.md, configuration.md, SECURITY.md) and CHANGELOG.

Decision table

image use_docker allow_host_shell untrusted outcome
set true any any container
none true true false host shell
none true false false refused
none true any true refused
any false true false host shell (image ignored, as before)
any false any true refused

Verified

  • make check green; cargo test --workspace green (458 tests), including a 16-row table test over the decision, the serde(default) forward-compat test, and the eligibility test. Each was broken, seen red, and restored.
  • Independent security review of the first commit: nothing blocking; its four follow-ups are the second commit.
  • docker compose config renders the expected labels and flags.

Not verified locally

  • No smoke was run locally. The fork-PR section of scripts/smoke_runs.py was rewritten (shell agent must refuse; Docker agent must run the step without the secret) and has only been syntax-checked — smoke-host on this PR is its first real run.
  • Nothing exercises the agent-docker Compose profile end to end.
  • The examples, the seeded showcase and the UI templates are shell-agent pipelines; on a default Docker agent they are now refused. Left for a follow-up.

🤖 Generated with Claude Code

blakebauman and others added 2 commits November 11, 2026 15:36
…'s pull request

A Docker agent ran a step in a container only when the step named an image and
dropped every other step to its own shell, with no way to refuse. On the
agent-docker Compose profile that shell is root beside the engine's socket, so a
project writer, or a fork's author through an imageless step, had root on the host.

FIBER_AGENT_ALLOW_HOST_SHELL now decides it: unset, it is false on a Docker agent
and true on a shell agent, and anything but true/false/1/0 stops the agent at
startup. The offer carries `untrusted` (serde default), and the agent never runs
such a step on its host shell whatever the flag says, so a fork's pull request
fails on a shell agent. The decision is one pure function, execution_mode, taken
before any workspace prep. PROTOCOL_VERSION is 3.

The agent-docker profile pins the flag to false and adds the docker=true label.
smoke-runs expects the refusal and runs the fork's pull request in a container
where an engine is available.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ell for it

An agent below protocol revision 3 ignores `untrusted` on the offer and would run
the fork's step on its host. The scheduler now keeps the agent's Hello revision
and leaves untrusted steps out of the candidates for a project agent below
UNTRUSTED_OFFER_PROTOCOL: filtered in the query, before the scan limit and before
any lease, so the steps stay queued for an agent that qualifies and the trusted
steps behind them are still offered. The session warns once when such an agent
connects.

The plain Compose agent gains the executor=shell label, because docker=true on
the Docker agent only lets an image step opt in: a step matches any agent holding
every label it asks for. The docs say that, that the agent-docker pin needs an
agent image of this release, and that a refused step with retries may land on a
different agent.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@blakebauman
blakebauman merged commit 85348d6 into main Nov 12, 2026
6 checks passed
@blakebauman
blakebauman deleted the fix/agent-refuse-host-shell branch November 12, 2026 00:57
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