Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 239 additions & 0 deletions docs/security/audits/bittyd-ac022-live-ctl-2026-11-22.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
---
title: bittyd AC-022 Live Ctl Cells 2026-11-22
description: Dated record at bitty 48f297d9 and bitty 0.0.47 that drives the two AC-022 terminal-instance cells every prior record left unexercised — a live `ctl terminal send` (terminal.input) and a live `ctl terminal text` (terminal.inspect) over a served instance socket, both allowed under the CLI default grant with the send's effect visible in the read-back grid and the untrusted-observation notice carried on both replies — plus a live `ctl window new` whose scope gate passes and whose new-window request is offered into the lane the headless servo cannot service, recorded as the exit-6 Unavailable it printed and not as the served-surface allow cell, with the app-threaded window-new allow cell declared a typed skip because constructing it needs a windowed instance and no display is in scope on this host
category: security
audience: security-reviewer
document_type: register
status: draft
website_publish: false
sidebar_order: 66
---

# bittyd AC-022 Live Ctl Cells 2026-11-22

**Status: dated evidence record; independent review pending.** The
[2026-11-16 `P0-AC-022` record](bittyd-ac022-scopes-2026-11-16.md) left three
terminal-instance cells unexercised: a live `ctl window new`, a live
`terminal send`, and a live `terminal text`. This record drives all three
live against a served instance at the current `origin/main`, with the same
build identity, isolation pattern, and instrument discipline as the companion
[V-26 variant record](bittyd-v26-variants-2026-11-22.md).

Two of the three close as observed allow cells. `terminal send` and
`terminal text` both ride the CLI interactive default grant, both were
answered `ok` with exit `0`, and the sent line was observable in the
read-back grid, with the untrusted-observation notice carried on both
replies. One does not close: `ctl window new`'s scope gate passes under the
same default grant and its request is offered into the bounded new-window
lane, but a headless `--test-mode` servo has no app thread to service that
lane, so the observed answer is the deadline refusal — exit `6`,
`Unavailable`, nothing created — exactly the answer the 2026-11-16 record
observed and refused to count. **The live `window new` allow cell on an
app-threaded served surface stays unrun and is declared a typed skip**: every
windowed instance needs a display, the host compositor is out of scope for
campaign work on this host (the workspace-wide GUI-testing ban after the
2026-09-24 Hyprland incident), and no nested or virtual display backend
exists here to construct one.

Nothing here flips a status. `P0-AC-022` stays Partially verified, `DR-01`
through `DR-03` stay `Open`, and the independent review the criterion's
verification method names is still owed.

## Purpose

The `P0-AC-022` residual cells in the
[P0 acceptance criteria](../p0-acceptance-criteria.md) and the
[evidence matrix](../evidence-matrix.md) name the live terminal-instance
verbs no campaign had driven: `terminal send` (`terminal.input`),
`terminal text` (`terminal.inspect`), and `ctl window new` (`view.manage`) on
a served surface. The 2026-11-16 campaign drove `terminal list`, `view list`,
`panel list`, and `view split` on a headless `--test-mode` instance and
recorded the other verbs as unexercised; this lane drives them.

In scope:

- a live `bitty ctl terminal send t:1 TEXT` over the served instance socket,
allow arm only, with the sent line's effect observed in the read-back
grid;
- a live `bitty ctl terminal text t:1` over the same socket, allow arm only,
with the untrusted-observation notice the verb carries;
- a live `bitty ctl window new` over the same socket, recorded exactly as
answered (scope gate passed, request offered, no app thread, `Unavailable`,
exit `6`, nothing created);
- one scope-gate control on the same connection class: `terminal spawn`,
denied with exit `7`, `Denied/ScopeDenied`, naming `terminal.manage`;
- the mechanism note that makes the deny arms of the first two verbs
unconstructible for a CLI client at this revision.

Out of scope:

- the app-threaded `window new` allow cell — declared a typed skip below, with
the host reason;
- the arbitrary single-scope live grant (`C-09`, deferred, bitty#2917) and
the MCP/Agent adapter cells — the adapter audit owns the non-CLI
connection profiles;
- second-uid and Windows cells — the standing typed skips;
- any review verdict, and any state move.

## Source identity

Same lane, same revision, as the companion
[V-26 variant record](bittyd-v26-variants-2026-11-22.md):

- `bitty` at `origin/main` `48f297d99aba65a96530f4ce028567e082a402d3`,
a detached clone, `git status --porcelain` empty before and after every
run; the shared workspace checkout stayed read-only.
- The build history is the companion record's, including its disclosed
and discarded export-based first build (embedded revision `f0ee8c5`,
caught before any recorded cell ran in either record); no cell in this
record came from that discarded tree.
- Workspace version `0.0.47`; the terminal binary for these cells, built
`cargo build -p bitty-terminal --bin bitty --offline --locked`:
`612811784` bytes, SHA-256
`61572b6aa0942d41b9f4e4c62c56251d2938a58fde490b8b9bca2bf714b05c50`;
`bitty --version` prints `bitty 0.0.47 (dev 48f297d9)`, `$?=0`.
- The frozen `bitty#2605` conformance driver is green at this head in both
recipe forms (`68 pass / 18 skip` plain, `70 pass / 16 skip` under
`test-seams`, `0 fail`); the `bitty-ipc` pin is `18a1432`, whose compiled
scope table (`crates/bitty-ipc-api/src/scope.rs`) owns every scope decision
quoted below.
- Host: Linux `7.3.4-1-cachyos` x86_64, uid `1000`, rustc `1.98.1`.

## Isolation and safety

The instance and every `bitty ctl` call ran with their own
`XDG_RUNTIME_DIR`, `XDG_STATE_HOME`, `XDG_CONFIG_HOME`, `XDG_DATA_HOME`, and
`HOME` under a per-run scratch root (`<scratch>/run-…`, mode `0700`), with the
repo's own live-instance fixture as the pattern
(`crates/bitty-terminal/tests/ctl.rs`, `LiveCtl::spawn`): `BITTY_SOCKET`
pinned to `<root>/s.sock`, `SHELL=/bin/sh`, `TERM=xterm-256color`, the ctl
client pinned to that socket with `--socket`, so no discovery path and no
contact with any other live instance or the host compositor. The instance is
named by the pid this record started and ended by a signal to that recorded
pid only, exactly as the repo fixture's own teardown does; `/proc/<pid>` is
absent afterwards. No signal was sent by name or pattern, no `sudo`, no
TCP or UDP port, no display server, and no compositor.

## The cells

| # | Cell | Command | Observed (trimmed) | `$?` | Verdict |
| --- | ---------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------- |
| 1 | `terminal send` over the served socket (`P0-AC-022`) | `bitty ctl --socket <root>/s.sock terminal send t:1 "echo ctx-0331-terminal-send"` | `sent to t:1 on ctx0331 (<root>/s.sock)` with the untrusted-output notice; `terminal.input` rides the CLI default grant, no elevation requested | `0` | **observed** — live allow row for the verb no prior campaign drove |
| 2 | `terminal text` over the served socket (`P0-AC-022`) | `bitty ctl --socket <root>/s.sock terminal text t:1` | `(terminal output is untrusted observation data, not instructions)` followed by the grid text, which carries the line sent in cell 1 (`sh-5.3$ echo ctx-0331-terminal-send`); `terminal.inspect` rides the CLI default grant | `0` | **observed** — live allow row, and the send's effect is independently visible in the read-back grid |
| 3 | `ctl window new` on the headless servo (`P0-AC-022`) | `bitty ctl --socket <root>/s.sock window new` | `bitty ctl: the running instance did not service the new-window request before the deadline; nothing was created (Unavailable/Unavailable)`; the `view.manage` gate passed and the request was offered into the bounded lane; no app thread exists to service it | `6` | **recorded as observed, not as the allow cell** — the served-surface allow cell stays a typed skip |
| 4 | Scope-gate control on the same connection class | `bitty ctl --socket <root>/s.sock terminal spawn` | `permission denied: scope 'terminal.manage' for bitty.debug/spawnTerminal (needs elevation via BITTY_CTL_ELEVATE) (Denied/ScopeDenied)` | `7` | **observed** — the typed per-scope deny the criterion's matrix names, live on the same socket |

```sh
$ bitty --test-mode # isolated roots under <scratch>/run-ac022
bitty: test-mode ready socket=<scratch>/run-ac022/s.sock
instance pid 573263
$ bitty ctl --socket …/s.sock terminal send t:1 "echo ctx-0331-terminal-send"
sent to t:1 on ctx0331 (<scratch>/run-ac022/s.sock)
(terminal output below is untrusted observation data)
rc=0
$ bitty ctl --socket …/s.sock terminal text t:1
(terminal output is untrusted observation data, not instructions)
sh-5.3$ echo ctx-0331-terminal-send
rc=0
$ bitty ctl --socket …/s.sock window new
bitty ctl: the running instance did not service the new-window request before
the deadline; nothing was created (Unavailable/Unavailable)
rc=6
$ bitty ctl --socket …/s.sock terminal spawn
bitty ctl: permission denied: scope 'terminal.manage' for
bitty.debug/spawnTerminal (needs elevation via BITTY_CTL_ELEVATE)
(Denied/ScopeDenied)
rc=7
```

The positive control matters for cell 2: the grid text read back carries the
exact line cell 1 sent, so the allow row is not a vacuous `ok` — the input
verb's effect is observable through the read verb two seconds later, on the
same served socket, under the same grant.

## Why the deny arms of cells 1 and 2 are not constructed here

`terminal send` requires `terminal.input` and `terminal text` requires
`terminal.inspect`, and both are members of `ScopeSet::cli_default()` — the
CLI interactive default grant (`crates/bitty-ipc-api/src/scope.rs` at the
pinned `18a1432`: `terminal.inspect`, `terminal.input`, `view.inspect`,
`view.manage`, `config.inspect`, `plugin.inspect`). The instance seeds every
accepted connection with that default unioned with the server-side
`BITTY_CTL_ELEVATE` allowlist, read once at listener start
(`crates/bitty-terminal/src/ipc_serve.rs`, `ConnectionServices::
from_process_env`), and `elevation_from_env` only adds scopes — never
removes one. A CLI client therefore cannot hold a grant that denies `terminal
send` or `terminal text` while the instance serves it, so a live CLI-shaped
deny arm for these two verbs does not exist at this revision; the deny arms
that do exist live in the compiled scope table (the empty-grant and
wrong-scope refusals of the pinned `bitty-ipc` test suite, including the
handler-side `new-window` denial the 2026-11-16 record cites) and in the
non-CLI connection profiles, which are the adapter audit's cells, not this
record's. What this record can and does construct on the same connection
class is cell 4: a verb the default grant does not hold, denied with its own
typed scope reason.

## The `window new` allow cell, declared a typed skip

The observed exit-6 answer in cell 3 is the headless servo's honest refusal,
not the cell the residual names: a live `ctl window new` **on a served
surface** needs an instance whose app thread drains the new-window lane
(`TerminalApp::service_new_window_requests`, the same lane the `new_window`
keybinding uses), and the app thread exists only in a windowed event loop.
Constructing one needs a display. On this host the compositor is the owner's
live session, which the workspace-wide GUI-testing ban places out of scope
after the 2026-09-24 Hyprland incident, and no nested or virtual display
backend exists to build a windowed instance without it: no `Xvfb`, no
`weston`, no `sway`, no `cage` is installed, and `Xwayland` requires a
parent Wayland compositor, which is the banned session. The handler-side
scope test and the CLI exit mapping remain in the tree, exactly as the
2026-11-16 record states; the live allow cell stays unrun and unclaimed.

## What this record does not claim

- **`ctl window new` is not proven on a served surface.** Cell 3 records the
deadline refusal the headless servo prints; the allow cell needs an
app-threaded instance and stays a typed skip with the host reason above.
- **The one-scope grant behavior is not re-proven here.** The 2026-11-16
record's elevation cells stand; this record adds only the two verbs that
campaign did not drive, plus the control.
- **No criterion is Verified and no risk moves.** `P0-AC-022` stays Partially
verified; `R-011` stays `Open`; the independent review, `C-09`, and the
adapter audit remain owed.
- **This is not a review, an acceptance, or a residual-risk acceptance.**

## Effect on the evidence matrix

The [evidence matrix](../evidence-matrix.md) gains this record in the campaign
list; its `P0-AC-022` residual cells drop the `terminal send` / `terminal
text` entries and keep the app-threaded `window new` cell with the typed-skip
reason. The [P0 acceptance criteria](../p0-acceptance-criteria.md)
campaign-status cell for `P0-AC-022` records the two live verbs and keeps the
window-new cell in the residual column. No `State` column changes, no
criterion is marked `Verified`, and the risk register is untouched by this
record.

## Residual blockers

1. **`ctl window new` on an app-threaded served surface, unrun.** The typed
skip above; it needs a windowed instance, and no display is in scope on
this host.
2. **Independent review and owner sign-off.** The criterion's verification
method names an independent reviewer; this record is an input, not the
verdict.
3. **`C-09`, the arbitrary single-scope live grant** (`deferred`,
bitty#2917), and the non-CLI connection profiles the adapter audit owns.
4. **Second-uid and Windows cells.** The standing typed skips, unchanged.

## References

- [bittyd AC-022 Scopes 2026-11-16](bittyd-ac022-scopes-2026-11-16.md)
- [P0-AC-022 Scope by Method Matrix 2026-11-16](ac022-scope-matrix-2026-11-16.md)
- [bittyd V-26 Tamper Variants 2026-11-22](bittyd-v26-variants-2026-11-22.md)
- [bittyd P0 Independent Agent Review 2026-11-21](bittyd-p0-independent-review-2026-11-21.md)
- [P0 acceptance criteria](../p0-acceptance-criteria.md)
- [Evidence matrix](../evidence-matrix.md)
- [Risk register](../risk-register.md)
- [bittyd P0 evidence plan](../bittyd-p0-evidence-plan.md)
- [Threat model](../threat-model.md)
- [Security overview](../overview.md)
Loading