Skip to content

ui-server: an ordinary shell command taints a governed session even when the egress proxy records real connections #3429

Closed

Description

@schlessera

Context

commandTaintSource (packages/ui-server/src/activity/command-taint.ts:2-27) taints the session on every Bash call it cannot prove is network-free. Only bare ls and brain search with static words pass. The Activity recorder applies it to every interactive turn (inputTaintSource, packages/ui-server/src/activity/ingestion-taint.ts:82-92, from packages/ui-server/src/activity/recorder.ts:336).

On a host with the turn egress proxy, this is redundant with a stronger signal. The proxy already taints the session at the first admitted non-relay connection, before its first byte (admitted, packages/ui-server/src/brain/turn-egress.ts:133-143), whatever program made it. The G6 rule text scopes the classifier to hosts without the proxy: "Before the egress proxy lands, Bash commands classified as fetching … taint the session" (docs/decisions/governed-writable-workers.md:3774). The "Implemented — 2026-10-22" note (docs/decisions/governed-writable-workers.md:3791, section "Untrusted input (G6)" at :3760) keeps it unconditional.

Observed on a hosted 0.44.0 install with the proxy active: the user's first input, !brain diagram --help, recorded taint with source: "unclassified_command". Every later brain image call was then refused (#3246). Since almost every turn runs some shell command, nearly every session is tainted without reading anything untrusted.

Citations verified at main 3d3516a02.

Decision (maintainer, 2026-11-03)

A. Proxy hosts drop shell-classifier taint. On hosts where turn egress runs on the proxy (runtime.workerHost.governed.egress.active), commandTaintSource no longer taints: neither unclassified_command nor fetching_command. The proxy's real-connection taint (egress_connection) and every other input source (WebFetch, shares, workspaces/, other MCP servers, marked files) still taint. Hosts without the proxy keep the classifier unchanged. The G6 ADR text update is part of the work.

Rejected: B (keep fetching-command taint on proxy hosts) and C (keep current behaviour).

Consequence the ruling accepts: a shell command that reads an untrusted file without a network connection (for example cat workspaces/x/README) no longer taints on proxy hosts. Path-based detection is not extended to shell arguments, since that would reintroduce a shell classifier. The G6 update records this as a known gap.

Scope

  • Gate commandTaintSource (or its call in inputTaintSource) on governed proxy egress being active for the turn, so proxy hosts skip both shell-classifier sources.
  • Update "Untrusted input (G6)" in docs/decisions/governed-writable-workers.md with a dated supersession: on proxy hosts the classifier is off and the proxy's connection taint is the shell signal; non-proxy hosts keep the classifier; the shell-read-of-untrusted-path gap is named.

Out of scope

Acceptance criteria

  • With the proxy active, a governed turn running brain diagram --help and cat notes/x.md records no taint. The test fails on current main.
  • With the proxy active, curl to a non-relay host still taints, through the proxy's egress_connection source (and not through fetching_command).
  • With the proxy active, the non-shell sources (for example WebFetch, an MCP document from another server, a workspaces/ file read through a file tool) still taint.
  • Without the proxy, the current classifier behaviour is unchanged and its tests stay green.
  • The G6 section of docs/decisions/governed-writable-workers.md records the dated supersession and the known shell-read gap; the contract docs describing taint sources match.
  • A mutation that removes the proxy gate fails the first criterion's test (receipt in the PR).

Verification

bun run test packages/ui-server/tests for the activity and turn-egress suites, with a mutation receipt for the proxy gate. Run the provider-history keyless guard if any turn-path code changes.

Contract impact

Breaking semantic change to documented governance behaviour: proxy hosts stop recording unclassified_command and fetching_command taint. Pre-1.0 it ships in a minor with the breaking label, this ruling, a CONTRACT: commit updating the contract docs, and a changeset naming the change (#3246 set the pattern).

Triage 2026-11-03: folded the maintainer ruling (A: proxy hosts drop shell-classifier taint; G6 update in scope; shell reads of untrusted paths are a documented gap).

Activity

  1. added
    type: fix
    area: ui-server
    priority: p1
    needs: decision
    contract
    breaking
    on Nov 3, 2026
  2. added this to the 0.45.0 milestone on Nov 3, 2026
  3. added
    agent-ready
    and removed
    needs: decision
    on Nov 3, 2026
  4. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): A — on hosts where turn egress runs on the proxy (runtime.workerHost.governed.egress.active), drop shell-classifier taint, both unclassified_command and fetching_command. The proxy's real-connection taint and the other input sources still taint. Non-proxy hosts keep the classifier. Updating the G6 ADR text is part of the acceptance criteria. B and C are rejected.

    How the body reads the ruling on the open shell-read case: extending path detection to shell arguments would bring back a shell classifier. So a shell read of an untrusted file with no network connection (cat workspaces/x/README) is recorded as a known gap in G6 rather than detected. This comment is the ruling the breaking label requires. Removed needs: decision; agent-ready.

  5. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-11-03): confirmed. A shell command that reads an untrusted local file without a network connection does not taint under ruling A. This is a known gap, recorded in G6 as the body says; closing it would bring the shell classifier back.

  6. self-assigned this
    on Nov 3, 2026
  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claiming for implementation (token claim-3429-e60cd81b). Branch fix/3429-shell-command-session-taint, targeting the epic integration branch epic/3428-session-taint. Collision scan: open PRs #3342 and #3404 also touch packages/ui-server/src/activity/ingestion-taint.ts; several open PRs touch docs/decisions/governed-writable-workers.md.

  8. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Implementation is in #3478 (head a00d45da3), opened against epic/3428-session-taint with Refs. The issue stays open until the epic batch lands on main. Local receipts are in the PR: a failing-first run, a mutation for the gate, and a mutation for the run-session wiring. Hosted CI still has to run the governed-runtime suites and the provider-history guard, which this worker's host could not run.

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

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-serverbreakingcontractpriority: p1type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions