Skip to content

Should the host terminal be a trust boundary with its own filter?

Decided 2026-10-04: A. Boundary plus allowlist filter, for now. Decided 2026-10-06: 1A, reset on exit, and 2C, the full filter on every stream. The decisions and their reasons are in the I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli). comments that start Decision (2026-10-04): and Decision (2026-10-06):, and the filter’s contents in the I30I30 (closed): X19-terminal-filter: Terminal stream filteringX19-terminal-filter (added to S11-verification-and-spikes in #14) decision (B30-terminal-filterB30-terminal-filter: Can wb filter Claude Code's terminal output without breaking it?Yes, with conditions, for Ghostty and Terminal.app pending a check by eye.). The spec change from PR81PR81 (merged): docs(spec): treat the host terminal stream as a boundary- Decides: guest output reaching the user's terminal is boundary 6 of T00-index, and wb filters it with the allowlist measured in X19-terminal-filter (S05-cli, "Terminal stream"). is confirmed: T00-indexT00-indexboundary 6 is the host terminal stream., S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command. (“Terminal stream”) and S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq….

guest, untrustedClaude Code, toolswrite any byteswb-guestdPTYhost: trustedwb-hostdrelayswbraw-mode relayterminal emulatorparses escape sequencesclipboardDownloadsOSC 52, OSC 1337 File=no Wraith Box check on the way

Figure 1. The terminal of a wb claude session shows bytes the guest chose. Today nothing between the guest and the emulator looks at them. The red paths are escape sequences that make the emulator act on the host: OSC 52 writes the clipboard, and iTerm2’s OSC 1337 saves a file to Downloads.

What the decisions on I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli). and I30I30 (closed): X19-terminal-filter: Terminal stream filteringX19-terminal-filter (added to S11-verification-and-spikes in #14) and the security review of PR66PR66 (merged): docs(spikes): X19-terminal-filter result, yes with conditionsAnswer: yes, with conditions, for Ghostty and Terminal.app, as far as a headless emulator can show. became, and where:

Decision 1: how wb cleans up the terminal on exit. Decided 2026-10-06: 1A.

Decision 2: output to a pipe or a file. Decided 2026-10-06: 2C. The I37I37 (closed): S03-requirements, S05-cli: treat the host terminal stream as a boundarywb claude relays the guest's PTY output in raw mode to the user's terminal emulator (S05-cli). decision doesn’t make an exception for pipes, so this had no recommendation. The filter passes only output that is safe in a terminal, so a later cat of the file is as safe as the live session, and one filter keeps one code path and one fuzz target.

The filter runs only on a stream that goes to a terminal. wb claude -p … > out.txt writes Claude Code’s bytes exactly.

On a stream that isn’t a terminal, wb drops ESC and every sequence it starts (CSI, OSC, DCS, APC, PM, SOS) and passes every other byte. Valid JSON can’t hold a raw ESC, so --output-format json stays byte-exact, and plain -p text held none in the probe below.

The allowlist runs whatever the output goes to. This is the decided option.

The issue proposes A and doesn’t list alternatives. B, C and D are the alternatives as this brief sees them.

The same boundary, but wb drops only the sequences known to act on the host: OSC 52, OSC 1337, DCS, and replies to queries.

wb runs a terminal emulator of its own (as tmux or mosh do), keeps a screen model, and sends the user’s terminal only redraws it generates itself.

RequirementA. AllowlistB. DenylistC. Re-renderD. As is
SEC03-no-host-execSEC03-no-host-exec: No host code execution via returned workNothing the agent produces executes on the host without an explicit user action; returned changes to files the host may later execute are flagged. nothing the agent produces runs on the host without the userfail closedknown sequenceskeptemulator bugs
SEC14-no-fake-approvalsSEC14-no-fake-approvals: Approvals cannot be spoofed by the guestApproval prompts are never rendered in the agent's terminal stream. approvals never in the agent’s terminalkeptholdskeptholds
FR12-clipboardFR12-clipboard: Opt-in clipboardText clipboard sharing is opt-in, per direction, with approval. clipboard opt-in, per direction, with approvalOSC 52 droppedOSC 52 droppedOSC 52 droppedbypassed
FR01-drop-inFR01-drop-in: Drop-in for claudewb is the single entry point for everything, structured as wb [wb flags] <command> [command args]. wb claude behaves as claudeper X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS…keptrendering changeskept
Spec workT00-indexT00-indexboundary 6 is the host terminal stream., S05-cliS05-cli: Command Line InterfaceSpecify wb, the single user-facing command., S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…samesame, plus a new componentT00-indexT00-indexboundary 6 is the host terminal stream.
Details and glossary

Why an allowlist. The filter is a security control on a parser of guest bytes, and the rest of the design fails closed (SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable. for the network). A denylist depends on knowing every sequence every emulator acts on, across releases. An allowlist depends only on what Claude Code needs, which X19-terminal-filterX19-terminal-filter: Terminal stream filteringWhich terminal escape sequences does Claude Code emit, and can wb drop the ones that act on the host (clipboard writes, file transfer, terminal multiplexer control sequences) without visible damage in the common macOS… measures once.

Dropped sequences. The filter removes a sequence that isn’t on the list rather than escaping it into visible text, which would shift the screen layout. The session summary reports how many it removed, which explains a broken render (NFR06-explained-refusalsNFR06-explained-refusals: OperabilityEvery refusal names the rule that caused it and how to change it.).

Input in the other direction. Keystrokes and replies from the emulator go into the guest. Those are host data in the guest. Replies to queries (cursor position, device attributes) are harmless, but a sequence that asks the emulator to report the clipboard (OSC 52 with ?) would send host clipboard content into the guest. Dropping OSC 52 in the output direction removes that too.

Glossary

  • Escape sequence: bytes starting with ESC that a terminal emulator treats as a command (move the cursor, change color) rather than text.
  • OSC: Operating System Command, a family of escape sequences. OSC 52 sets or reads the clipboard. OSC 1337 holds iTerm2’s own commands.
  • DCS: Device Control String, another family, used by multiplexers such as tmux and for graphics.
  • PTY: the pseudo-terminal in the guest that Claude Code writes to, as if it were a real terminal.
  • Raw mode: the host terminal passes keystrokes straight through, and wb passes output straight back.
  • Fuzz target: a test that feeds random input to a parser to find crashes.