Skip to content
Open
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
2 changes: 2 additions & 0 deletions backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ U+2060–2064, U+FEFF; update the Kani harness and proptest with it) Β· #85 boun
each `Steps:` line like `Command:` Β· #88 `--pkexec` multi-leaf plans (item 6
above) Β· #87 wrapper-aware `runs_shell` (item 5 above).

Done: #85.

**Phase 1 β€” state the invariant, make it literally true** (release 1.3.0):
1. Docs first: G4.6 *"syntax is daemon-owned"* (no wire field printed verbatim
in the command slot); split Sn4.5 into a syntactic half (render β‡’ shell
Expand Down
21 changes: 21 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
Most recent at top. See [docs/formalisation-roadmap.md](docs/formalisation-roadmap.md)
for the assurance-ladder context behind the security-formalisation entries.

## Unreleased β€” Bound every approval-prompt line, not only Command: (#85)

**The gap.** Only the `Command:` line was length-bounded (G4.3 / F3). The
`Steps:` block capped its number of lines but wrote each line whole, so a
privileged `exec ["echo", <900 KB>]` printed the whole argument on `Steps:`
line 0 and pushed the `[y/N]` question off-screen. The `Resolves:` block and
line (a long absolute `argv[0]`, and up to 256 entries) and the metadata lines
(`From:`, `Requester:`, `Client:`, `Time:`, `ID:`, `Reason:`, `Env:`, the
session name of the `a` line) had no length bound either. **The fix**
(`src/tui.rs`, display only): each `Steps:` line is clipped to 160 visible
chars (`clip_styled`, which skips the daemon's own colour escapes and resets
the colour before the marker), each `Resolves:` name and path to 160, each
metadata field to 256, the `Env:` line to 1024, and the `Resolves:` block to 32
entries, each with an explicit `… [N more chars hidden]` marker. The full texts
the bash-oracle properties check (`steps_shell_text`, `command_summary`) are
unchanged. **Tests:** unit tests for each clip, the property
`prop_prompt_lines_are_bounded_and_prefix_faithful` (every line bounded, line
count bounded, each `Steps:` line a prefix of its unclipped text), the pty test
`huge_argument_prompt_is_bounded`, and a `long-argument` golden; the existing
goldens are byte-identical.

## Unreleased β€” Audit log for every request outcome (#65)

The daemon logged prompted requests and unattended runs, and only with `-v`. It
Expand Down
2 changes: 1 addition & 1 deletion docs/assurance-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ a sanitized environment.*
| **G4.2** | The resolved absolute path of argv[0] is shown, with `-> target` when it is a symlink, so redirection cannot be hidden. | β€” | |
| **Sn4.2** | `src/tui.rs` path canonicalisation + explicit failure message. | 1 | [discharged] |
| **G4.3** | A large command cannot push the real command or the `[y/N]` line off-screen. | β€” | |
| **Sn4.3** | After **F3** fix: displayed command length is bounded with an explicit hidden-bytes marker. | 1 | [discharged] |
| **Sn4.3** | After **F3** fix and #85: every line written to the approval prompt is length-bounded (`Command:` 1024 chars; `Steps:` lines, `Resolves:` names and paths 160; metadata fields 256; `Env:` 1024), each with an explicit hidden-chars marker, and the `Steps:` and `Resolves:` blocks are capped at 32 entries. Evidence: `prop_prompt_lines_are_bounded_and_prefix_faithful`, `huge_argument_prompt_is_bounded` (pty), the `long-argument` golden. Residual: the bound limits the prompt's size to a constant but does not guarantee it fits a small terminal (worst case about 70 lines, plus wrapping at 80 columns); and characters are counted as chars, not terminal columns: wide CJK glyphs take two columns, and tabs (allowed by `has_dangerous_chars`) can each expand to up to 8 columns, so a 160-char `Steps:` line of tabs can render about 1 280 columns (16 rows at 80 columns) (#98). The clip is applied to the whole rendered text, so a long argument can push a chain operator, a group's `(` or `)`, or a redirection (`> path`, `2>&1`, `< path`) into the hidden tail of its `Steps:` line, and of `Command:` past 1024 chars; the marker shows that text is hidden, but not which (#97). | 2 | [discharged] |
| **G4.4** | Residual: printable-range Unicode look-alikes / NBSP in `reason` (passive, cannot hide the real command). | β€” | |
| **Sn4.4** | Documented residual in [security-audit.md](security-audit.md) (F1). | 0 | [accepted-risk] |
| **G4.5** | The grouping shown at the gate is the grouping that runs: the `Steps:` block (what the operator reviews) and the `Command:` line (what they may paste) parse, as shell, to the same tree, and that tree means what the executor runs. | β€” | |
Expand Down
2 changes: 2 additions & 0 deletions docs/security-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ off-screen. Same display-integrity theme as F1. The codebase already truncates c
Recommendation: cap the displayed command length (with an explicit `… (N bytes
hidden)` marker) and/or reject individual arguments above a sane size for display.

Re-opened on the plan render path (`Steps:`/`Resolves:` lines) and closed in #85.

---

### F4 β€” `hosts.json` world-readable (Low, info disclosure)
Expand Down
1 change: 1 addition & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ compare the prompt with the expected column:
| `escalation-b-boundary.json` | `--no-privilege` | Only `whoami` is bright red; `echo hi` / `echo bye` uncoloured. |
| `escalation-c-ambient-plus-boundary.json` | (privileged) | Everything light red, `whoami` bright red, operators tinted. |
| `escalation-d-named-user.json` | `--no-privilege` | `id -un` bright yellow (`run-as` a named non-root user). |
| `long-argument.json` | (privileged) | `Command:` shows the whole 600-char argument (under 1024); `Steps:` line 0 is cut at 160 chars and ends with `… [450 more chars hidden]` (#85). |

Run once more with `NO_COLOR=1` set in the daemon's environment: the structure
must stay readable with no escape codes, and every escalated step still shows
Expand Down
4 changes: 2 additions & 2 deletions docs/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ invariant at a given boundary are omitted.
| STRIDE | Threat | Control | Ref |
|--------|--------|---------|-----|
| Spoofing | ANSI / control / bidi sequences forge a benign-looking command in the prompt. | `has_dangerous_chars()` rejects control/zero-width/bidi on every displayed field; resolved absolute path of argv[0] shown with `-> target` on symlinks. | G4.1, G4.2 / F1 |
| Tampering | A huge argument pushes the real command and `[y/N]` off-screen. | Displayed command length bounded with a hidden-bytes marker. | G4.3 / F3 |
| Tampering | A huge argument pushes the real command and `[y/N]` off-screen. | Every prompt line and block length-bounded (`Command:`, `Steps:`, `Resolves:`, metadata) with a hidden-chars marker. | G4.3 / F3 |
| DoS | Operator never answers, leaving the gate open. | 60 s timeout, default **deny**. | G5.2 |
| Elevation | Social-engineer the human into approving. | Covered by G4; residual printable-range look-alikes accepted. | G4.4 (residual) |
| Spoofing | A same-UID process **types the answer itself**: synthetic keystrokes into the approval terminal (`tmux send-keys`, `screen -X stuff`, kitty/wezterm remote control, Konsole D-Bus, X11 XTEST, `TIOCSTI`). The typical requester (an agent) has a same-UID shell, so A1 reaches this as A2. | The daemon refuses to start in a terminal that accepts such input (`ttyguard`: multiplexer `TERM`/`$TMUX`/`$STY`/`$ZELLIJ`, remote-control emulators, VS Code, Emacs, X11 without Wayland) unless started with `--allow-injectable-tty`, which puts a warning line in every prompt. There is deliberately no `hosts.json` equivalent, since an agent can write that file and restart the daemon through MCP. Unprivileged children run in their own session, with no controlling terminal, so they cannot `TIOCSTI` into the prompt. Legacy `TIOCSTI` is reported at startup. `sudo-proxy-mcp` scrubs the launcher's terminal variables from the window it spawns. | A1 (assumption, now checked) / GHSA-cpmp-67wf-gwmx |
Expand Down Expand Up @@ -136,7 +136,7 @@ A A root command runs that the human did NOT approve
β”‚ β”œβ”€ 3.2 Symlink redirection of argv[0] (/usr/local/bin/foo -> /tmp/evil)
β”‚ β”‚ [resolved path + "-> target" shown β†’ G4.2 Β· blocked]
β”‚ β”œβ”€ 3.3 Push the real command / [y/N] off-screen with a huge arg
β”‚ β”‚ [length bound + hidden-bytes marker β†’ G4.3 / F3 Β· blocked]
β”‚ β”‚ [every prompt line and block length-bounded (`Command:`, `Steps:`, `Resolves:`, metadata) β†’ G4.3 / F3 Β· blocked]
β”‚ β”œβ”€ 3.4 Printable-range Unicode look-alike / NBSP in reason
β”‚ β”‚ [cannot hide the real command β†’ G4.4 Β· residual (accepted)]
β”‚ └─ 3.5 Answer the prompt without the human: inject `y` into the TTY
Expand Down
Loading
Loading