Repository navigation
feat(core): M5 — channel layer + single-command exec - #84
Conversation
Implements the final tranche of the Phase 1 walking skeleton (ADR-0023): one session channel carrying one exec, streaming output, clean close. `ssh host 'echo hello'` now works end-to-end against a real OpenSSH 10.x. - transport.rs: new `Session` type-state stage with a cancel-safe `read_packet` (resumable inbuf) sharing the decrypt path with `read_sealed`; `AuthAccepted -> Session` threads the key fingerprint. - channel.rs: the RFC 4254 connection layer scoped to ADR-0023 — eleven channel messages, one honoured exec, real bidirectional flow control (2 MiB window / 32 KiB packet), total fail-closed dispatch. - exec.rs: /bin/sh -c child on spawn_blocking (ADR-0022) with stdin/ stdout/stderr pumps; rustix for getuid + kill-on-early-close; sanitised env (ADR-0016); exec.started/exec.finished audit events (ADR-0024). - server.rs: handshake budget bounds auth only; channel phase un-timed. - Cargo.toml: add rustix (process feature), justified. ADR-0016 amended (rustix over nix); ADR-0023 erratum (/bin/sh -c + sanitised env). - tests: 8 channel unit tests + 8 exec integration tests incl. cancel-safety-under-load (3 MiB); tests/interop OpenSSH gate (ADR-0020). Verified locally against OpenSSH 10.2p1: smoke, verbose-kex (hybrid KEX), negative-no-hybrid, and exit-status propagation all pass. Claude-Session: https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o Signed-off-by: Gonzalo Fleming <[email protected]>
|
Now I have a complete picture. Here's my review. PR Review: feat(core): M5 — channel layer + single-command execClassification: APPROVE with 1 non-blocking finding Verification results
High-signal findings1. The workflow's Recommendation: Replace Audit event compliance: PASSBoth events fire on
MANIFIESTO commitment compliance: PASS on all five
Security rules: PASS
CI/workflow: 1 finding (non-blocking)The container tag |
trixie's openssh-client package 1:10.0p1-7 now ships binary OpenSSH_10.0p2 via security update deb13u4; the exact-p1 assertion rejected it. Assert the 10.0p line and the mlkem768x25519-sha256 KEX (the real requirement). Claude-Session: https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o Signed-off-by: Gonzalo Fleming <[email protected]>
|
Now I have a complete picture. Here's my review. PR Review:
|
| Check | Result |
|---|---|
unsafe in first-party code |
zero — grep confirmed only doc-comment mention |
authenticated_identity / executing_uid on exec.* events |
both fields present on exec.started (channel.rs:547-553) and exec.finished (channel.rs:401-413) |
command is a structured field, never interpolated |
command = %command (structured tracing field, channel.rs:551) |
exec.finished emitted on all paths that produce exec.started |
spawn-success (normal close + early close), spawn-failure (exit 127), emit_finished() on Closed state — exactly once per command_started |
| Legacy crypto compiled in | none |
KEX: mlkem768x25519-sha256 only |
unchanged from M4 |
| MAC path exercised | no — AEAD-only maintained |
| Type-state machine | Session is a proper stage, implements SealedRead/SealedWrite, transitions via AuthAccepted::serve |
| ADR amendment rules | ADR-0016/0023 still Proposed — in-place edits are permitted by ADR-0015 before acceptance |
High-signal findings
1. dtolnay/rust-toolchain@stable is a mutable action ref (.github/workflows/interop.yml:57)
The stable tag follows the latest stable Rust, sidestepping the pinned rust-toolchain.toml (MSRV 1.92). This is threat-model §5.5.2 (supply-chain compromise of dependencies) territory: the action ref that decides the compiler for the interop-gate binary is mutable. The PR's own TODO on the container tag (line 29-32) acknowledges the same class of problem for the OS layer; this action ref is the same category on the toolchain layer. Not blocking for a pre-alpha walking skeleton, but should be fixed before the interop gate has downstream consumers that trust it.
Recommendation: Pin to a specific Rust version matching rust-toolchain.toml (e.g. dtolnay/[email protected]) or use rust-toolchain: stable with a file reference.
2. debian:trixie-slim is a mutable container tag (.github/workflows/interop.yml:34)
Already acknowledged by the PR's own TODO(ADR-0020) comment on lines 29-32. The tag resolves to a floating Debian snapshot; an upstream OpenSSH update in trixie could break or silently change the interop gate without a reviewed code change. The ADR-0020 requirement is to pin to an image digest.
MANIFIESTO commitment compliance: PASS on all five
- Memory-safe by construction — zero
unsafein all new/changed first-party files.rustixwraps raw syscalls in audited safe abstractions. - Post-quantum by default — no new KEX introduced;
mlkem768x25519-sha256remains the sole KEX. The interop gate asserts it at lines 64-66 and is verified in testing. - Zero legacy — no RSA, DSA, ECDSA-NIST, CBC, password auth, or compression compiled in.
pty-req,shell,subsystem,envare all explicitly refused inon_channel_request(channel.rs:499-535). - Small surface, sharp edges —
rustix(processfeature only) chosen overnixper MANIFIESTO chore(security): mark quantumssh.org aliases as live #4. One new dep, justified in PR body, ADR-0016 erratum, and plan §7.2. License (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) is indeny.tomlallowlist. - Permanently open — no relicensing.
rustixlicense posture is Apache-2.0-compatible.
Security rules: PASS
- Pre-auth surface — unchanged; M5 operates post-auth only.
- Fail closed —
handle_inbound(channel.rs:419-451) is a total, 12-arm match: 11 honoured/refused channel messages +DISCONNECT. Unknown messages →protocol_disconnect. InboundEXTENDED_DATA(95) → disconnect.DATA-after-EOF → disconnect. Window overflow → disconnect. Unknown channel → disconnect. - AEAD-only maintained — no MAC path exercised.
- Key material —
SharedSecretandExchangeHashremainZeroizing.Sessioncarries no key material, only the cipher pair and authenticated identity fingerprint. - Type-state machine —
Sessionis stage 8, implementsSealedRead/SealedWrite, transitions cleanly fromAuthAccepted::serve()(transport.rs:838-851). Internal channel states are a private enum (ChannelState), not a type-state regression. - Cancel-safe read —
read_packet(transport.rs:870-889) stores partial progress ininbuf;fill_inbuf(transport.rs:896-910) extends atomically (no.awaitbetweenreadandextend_from_slice). Sharesframe_body_len/open_framehelpers withread_sealed— one framing path. - Flow control is real — inbound window enforced (channel.rs:603-604:
data_len > in_window→ disconnect), outbound window tracked inu64to detectu32overflow (channel.rs:634-637), credit returned only as child consumes stdin (channel.rs:269-275, 359-363).
ADR amendments: SOUND
- ADR-0016 (line 35): replaces
nix::unistd::Uid::current()withrustix::process::getuid(). Rationale (smaller surface, sameprocessfeature coverskilltoo) is stated in the erratum. ADR isProposed— amendments are permitted per ADR-0015. - ADR-0023 (line 38): adds
/bin/sh -cerratum. Rationale is sound: SSHexecdelivers an opaque string; interpreting it requires a shell; the service account's login shell is/usr/sbin/nologin. Bounded by service-account UID + sanitised env + one-channel/one-exec scope.
CI/workflow: 2 findings (non-blocking)
Both are the mutable-ref class — acknowledged by the PR's own design:
dtolnay/rust-toolchain@stable— mutable action ref, sidestepsrust-toolchain.toml(see finding ci(deps): Bump actions/checkout from 4 to 6 #1 above).debian:trixie-slim— mutable container tag (already markedTODO(ADR-0020), line 29-32).
The interop script itself (tests/interop/run_openssh_client.sh) is shellcheck-clean, uses set -euo pipefail, generates ephemeral keys, and properly cleans up. The four assertions (smoke, verbose_kex, negative_no_hybrid, exit_status_propagation) map exactly to ADR-0020/ADR-0023 requirements.
Addresses claude-review findings on PR #84: - channel.rs: reject `maximum_packet_size == 0` at channel open. A zero max-packet makes flush_output compute a send size of 0 forever — output never drains, the close sequence never fires, and the un-timed channel phase hangs while the child's stdout pump pins a blocking-pool thread. An authenticated user could exhaust the pool. Fail closed (RFC 4254 §5.1 sets no minimum, so the server enforces one). - exec.rs: add `Drop for ChildIo` that kills the child unless the reap task has already waited on it. A `reaped` flag, set before the exit is reported, ensures a Drop-time kill never targets a pid the OS may have reused. Guarantees no child outlives its channel on abrupt transport failure (TCP reset, decrypt error), not only on a cooperative CHANNEL_CLOSE — closing the other blocking-pool-exhaustion vector. - interop.yml: pin the Debian trixie container by image digest (ADR-0020), replacing the mutable tag; no placeholder left in a merged path. Adds the zero_max_packet_is_rejected integration test (21 integration tests now). fmt/clippy/test/interop all green locally. Claude-Session: https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o Signed-off-by: Gonzalo Fleming <[email protected]>
PR Review:
|
| Finding | Status | Location |
|---|---|---|
debian:trixie-slim mutable container tag |
Fixed — pinned to debian@sha256:28de0877... |
.github/workflows/interop.yml:36 |
max_pkt == 0 stalls channel permanently |
Fixed — max_pkt == 0 triggers fail-closed disconnect |
channel.rs:488-495 |
ChildIo lacks Drop, orphans child on abrupt disconnect |
Fixed — Drop impl kills child unless already reaped |
exec.rs:77-88 |
Remaining finding (non-blocking)
dtolnay/rust-toolchain@stable is a mutable action ref (.github/workflows/interop.yml:59). The stable branch tag floats to whatever is current at runtime, sidestepping the pinned rust-toolchain.toml that the rest of CI honours. This is the same class of mutable-ref concern as the container tag that was already fixed — the action that decides the compiler for the interop-gate binary should be pinned. Not blocking for a pre-alpha walking skeleton, but should be resolved before the interop gate has downstream consumers.
Verification
| Check | Result |
|---|---|
unsafe in first-party code |
zero |
authenticated_identity / executing_uid on exec.* events |
present on both exec.started (channel.rs:555-561) and exec.finished (channel.rs:401-413) |
command structured, never interpolated |
command = %command (channel.rs:559) |
exec.finished emitted on all paths |
spawn-success, spawn-failure, early-close, normal exit — exactly once |
max_pkt == 0 → fail closed |
channel.rs:493-494 |
ChildIo::Drop → kill unless reaped |
exec.rs:83-87 |
| Legacy crypto compiled in | none |
KEX: mlkem768x25519-sha256 only |
unchanged |
| AEAD-only, no MAC path | maintained |
Type-state: Session is stage 8 |
transitions via AuthAccepted::serve() (transport.rs:838-851) |
| One-channel-per-connection | BeforeOpen guard (channel.rs:469), second open → SSH_OPEN_ADMINISTRATIVELY_PROHIBITED |
Non-session channel type refused |
SSH_OPEN_UNKNOWN_CHANNEL_TYPE (channel.rs:479-487) |
pty-req/shell/subsystem/env all refused |
total else branch (channel.rs:532-541) |
rustix license in allowlist |
deny.toml has Apache-2.0 WITH LLVM-exception (line 23) |
Interop script shellcheck-clean, set -euo pipefail |
tests/interop/run_openssh_client.sh |
MANIFIESTO commitments: PASS all five
- Memory-safe — zero first-party
unsafe;rustixwraps syscalls in safe abstractions - PQ by default —
mlkem768x25519-sha256sole KEX; interop gate asserts it - Zero legacy — no RSA/DSA/ECDSA-NIST/CBC/password/compression compiled in; all non-
execrequests refused - Small surface —
rustix(processfeature only) chosen overnixper MANIFIESTO chore(security): mark quantumssh.org aliases as live #4; one new dep, justified - Permanently open —
rustixlicense compat confirmed; no relicensing
ADR amendments: SOUND
- ADR-0016 (line 35): replaces
nix::unistd::Uid::current()withrustix::process::getuid()— rationale documented, stillProposed, permitted per ADR-0015 - ADR-0023 (line 38): adds
/bin/sh -cerratum — bounded by service-account UID + sanitised env + one-channel/one-exec; stillProposed
Addresses claude-review's second-pass findings on PR #84: - exec.rs: the reap now polls `try_wait` and kills through the owned `Child` handle (`Child::kill()`), never by raw pid. This removes the pid-reuse TOCTOU the previous `reaped`-flag fix still carried (a pid freed by `wait()` could be reused before the flag was set). Drops the `kill_process` use of rustix (getuid only now). ≤20 ms exit-detection latency, imperceptible since output already streamed. - channel.rs: `exec.finished` now carries the structured `command` field (CLAUDE.md / ADR-0023 mandate the fields on *every* exec.* event); the driver stores the command string instead of a bare started latch. - channel.rs: pre-exec stdin is no longer dropped beyond the pump's queue bound. `handoff_stdin` drains `pre_exec_stdin` under flow control and closes the child's stdin only once it (and any pending chunk) is delivered — so buffered stdin is never lost and its window credit is never leaked. EOF handling moved out of `on_channel_eof` accordingly. Verified against OpenSSH 10.2p1: interop still green; exec.finished log now includes `command`. 80 unit + 21 integration tests pass. Claude-Session: https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o Signed-off-by: Gonzalo Fleming <[email protected]>
|
I've now traced the root cause of the failing test. Here is my review. PR Review:
|
| Check | Result |
|---|---|
cargo fmt --check |
clean |
cargo clippy -D warnings |
clean |
unsafe in first-party code |
zero |
| Legacy crypto compiled in | none |
KEX: mlkem768x25519-sha256 only |
unchanged |
Type-state: Session is stage 8 |
implements SealedRead/SealedWrite |
| Audit event fields | PASS on exec.started and exec.finished |
cargo test --workspace |
1 FAILURE: client_early_close_kills_child |
Blocking: orphaned grandchild blocks stdout/stderr pumps indefinitely, prevents close handshake
Test: client_early_close_kills_child (tests/accept.rs:889) — fails consistently with a 5-second timeout waiting for the server's CHANNEL_CLOSE.
Root cause: When the server spawns /bin/sh -c "sleep 30", dash forks a child to run sleep and waits. child.kill() sends SIGKILL to dash, which exits — but sleep is orphaned and continues running for 30 seconds holding the write ends of the stdout/stderr pipes open. The stdout/stderr pumps on the blocking thread pool remain blocked on read(), never drop their out_tx senders, so out_rx never closes (never returns None), child_out_closed never becomes true, ready_to_close() never returns true, and the server's CHANNEL_CLOSE is never sent. The un-timed channel phase hangs.
The Drop impl on ChildIo (exec.rs:80-88) sets the kill flag correctly, but reap_child calls child.kill() — which kills only the immediate child (dash), not its grandchildren. This is a general property of /bin/sh -c on any shell that forks for external commands (which is most shells by default).
Recommended fix: Use std::os::unix::process::CommandExt::process_group(0) to place the child in its own process group, and in reap_child kill the process group via rustix::process::kill_process_group instead of child.kill(). This is the approach the plan (docs/plans/m5-channels.md:130) originally described and the one that correctly bounds the kill to all descendants.
Steps:
exec.rs: addcmd.process_group(0)viastd::os::unix::process::CommandExtexec.rs: inreap_child, replacechild.kill()withrustix::process::kill_process_group(Pid::from_raw(child.id() as i32).unwrap(), Signal::Kill)when the kill flag is setdocs/adr/0016-*.md: update the erratum —rustix::processfeature is needed for process-group kill, not optional
Pinned to: threat model §5.4 (session-layer vectors — resource exhaustion via orphaned processes), CLAUDE.md "No 'not implemented yet' left in a merged path" (the test fails, so the impl is incomplete), ADR-0023 §"Child-process lifecycle" ("No orphaned child survives its channel").
Non-blocking: dtolnay/rust-toolchain@stable mutable action ref
.github/workflows/interop.yml:59 — the stable branch tag floats, sidestepping the pinned rust-toolchain.toml. Same class as the now-fixed container tag. Not blocking for pre-alpha.
Previously-fixed findings confirmed resolved
| Finding | Status |
|---|---|
debian:trixie-slim mutable tag → digest pin |
Fixed (interop.yml:36) |
max_pkt == 0 stall |
Fixed (channel.rs:516-518) |
ChildIo lacks Drop |
Fixed (exec.rs:80-88) |
exec.finished missing command |
Fixed (channel.rs:430) |
| TOCTOU race on PID reuse | Fixed (kill via owned Child handle, not raw PID) |
| Pre-exec stdin silently dropped | Fixed (drained chunk-by-chunk under flow control, channel.rs:590-605) |
Remaining MANIFIESTO/security checks: ALL PASS
- ci(deps): Bump actions/checkout from 4 to 6 #1 Memory-safe: zero first-party
unsafe - chore(security): publish project PGP key #2 Post-quantum:
mlkem768x25519-sha256sole KEX - Generate and publish project PGP key for SECURITY.md #3 Zero legacy: no RSA/DSA/ECDSA-NIST/CBC/password/compression; all non-
execrequests refused - chore(security): mark quantumssh.org aliases as live #4 Small surface:
rustix(processonly) justified; one new dep - docs: add operations and verification guide #5 Permanently open:
rustixlicense indeny.tomlallowlist - Fail closed: total 12-arm match in
handle_inbound; unknown → disconnect; data-after-EOF → disconnect; window overflow → disconnect - AEAD-only: no MAC path exercised
- Cancel-safe read: shared framing helpers, resumable
inbuf,fill_inbufatomic
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
CI on ubuntu caught client_early_close_kills_child hanging 30s: dash (Linux /bin/sh) fork+execs its command, so SIGKILL to the shell leaves the grandchild (e.g. `sleep`) running and holding the stdio pipes open — the pumps never see EOF and the channel never closes. macOS /bin/sh exec-replaces, so it passed there; the multi-OS matrix surfaced it. Spawn the child in its own process group (`CommandExt::process_group(0)`, making it the leader) and signal the whole group on kill via `rustix::process::kill_process_group`. The kill is issued from the reap task, which holds the un-waited Child, so the leader's pid (= pgid) cannot have been reused — no pid-reuse race. Restores rustix's kill use (getuid + kill_process_group); doc/comments updated. Local: clippy clean, 21 integration tests pass, OpenSSH interop green. Claude-Session: https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o Signed-off-by: Gonzalo Fleming <[email protected]>
|
All previous findings are verified against the current code. Here is my consolidated review. PR Review:
|
| Finding | Disposition | Evidence |
|---|---|---|
debian:trixie-slim mutable tag |
Fixed | Pinned to debian@sha256:28de0877... (interop.yml:36) |
max_pkt == 0 permanent stall |
Fixed | Fail-closed disconnect at channel.rs:516-518 |
ChildIo lacks Drop |
Fixed | Drop impl at exec.rs:80-88 sets kill flag |
exec.finished missing command |
Fixed | command = %command at channel.rs:432 |
| TOCTOU race on PID reuse | Fixed | Kill via owned Child handle + process-group, never raw PID (exec.rs:232-250) |
| Pre-exec stdin silently dropped | Fixed | handoff_stdin drains deque under flow control, re-stashes on pump-full (channel.rs:344-367) |
| Orphaned grandchild blocks close | Fixed | process_group(0) + kill_process_group kills whole tree (exec.rs:144,238-242); client_early_close_kills_child passes |
Remaining finding (non-blocking)
dtolnay/rust-toolchain@stable is a mutable action ref (.github/workflows/interop.yml:59). The stable tag floats to the latest Rust at runtime, sidestepping the pinned rust-toolchain.toml (MSRV 1.92). This is the same class of mutable-ref concern as the now-fixed container tag — the action that decides the compiler for the interop-gate binary should be pinned. Not blocking for a pre-alpha walking skeleton.
Verification
| Check | Result |
|---|---|
cargo fmt --check |
clean |
cargo clippy -D warnings |
clean |
cargo test --workspace |
21/21 passed (including client_early_close_kills_child, cancel_safety_under_load) |
unsafe in first-party code |
zero (only doc-comment mention, lib.rs:8) |
rustix licence in deny.toml |
Apache-2.0 WITH LLVM-exception allowed (line 23) |
| Legacy crypto compiled in | none |
| KEX | mlkem768x25519-sha256 only, unchanged |
MANIFIESTO commitments: PASS all five
- Memory-safe — zero first-party
unsafe;rustixwraps syscalls in safe abstractions - Post-quantum — sole KEX unchanged; interop gate asserts it (
run_openssh_client.sh:64-66) - Zero legacy — no RSA/DSA/ECDSA-NIST/CBC/password/compression; all non-
execrequests refused atchannel.rs:557-565 - Small surface —
rustix(processfeature only) chosen overnix; one new dep, justified in PR body + ADR-0016 erratum - Permanently open —
rustixlicences indeny.tomlallowlist; no relicensing
Security rules: PASS
- Pre-auth surface unchanged — M5 operates post-auth only
- Fail closed — 12-arm total match in
handle_inbound(channel.rs:454-473);EXTENDED_DATAinbound, data-after-EOF, window overflow, zeromax_pkt, unknown channel → all disconnect - AEAD-only — no MAC path exercised
- Type-state machine —
Sessionis stage 8, implementsSealedRead/SealedWrite, transitions viaAuthAccepted::serve()(transport.rs:838-851); internal channel states are private enum - Cancel-safe read —
read_packetstores partial progress ininbuf;fill_inbufextends atomically; sharesframe_body_len/open_framehelpers withread_sealed— one framing path (transport.rs:870-910) - Flow control is real — inbound window enforced (
channel.rs:632-634), outboundu64overflow detection (channel.rs:664), credit returned only as child consumes stdin - Child lifecycle —
Dropguarantee + process-group kill (exec.rs:80-88, 238-242);exec.finishedemitted exactly once on all paths (channel.rs:422-437) - Audit events —
authenticated_identity,executing_uid,command(structured) on bothexec.started(channel.rs:578-584) andexec.finished(channel.rs:428-435)
ADR amendments: SOUND
- ADR-0016 (line 35):
nix::Uid::current()→rustix::process::getuid()+kill_process_group; rationale documented; stillProposed, permitted per ADR-0015 - ADR-0023 (line 38):
/bin/sh -cerratum; bounded by service-account UID + sanitised env + one-channel/one-exec; stillProposed
|
All review findings addressed across commits 7ad0ca9, aea00b0, c4d4493 — resolving the threads:
Bonus: the ubuntu CI matrix caught a process-group leak (dash fork+execs |
…events; ADR-0020 and 0017 drafting-time sentences ADR-0024's Related line and banner still grouped the subscriber initialisation under M4/M5 after the Links line moved it to M0; all three now agree (subscriber M0, events M4/M5, formatter #101). ADR-0020's Consequences said the gate is wired up in the first-crate PR; it was wired up in M5 (#84), once a connectable binary existed, and the banner records the edit. ADR-0017's Context no longer calls the workspace currently empty. Raised by Codex and opencode on #159. Claude-Session: https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa Signed-off-by: Gonzalo Fleming <[email protected]>
…rom (ADR-0034) Implements the package-version pin ADR-0020 decided and #84 left out. The digest-pinned image (debian:trixie-20260623-slim) records in its own debian.sources the snapshot.debian.org timestamp it was built from; apt now reads from that timestamp, installs openssh-client=1:10.0p1-7+deb13u4 with the build prerequisites, and the job asserts the exact `ssh -V` string, OpenSSL build included. The step checks that SNAPSHOT matches the image before apt runs. #98 failed by pointing apt at a snapshot older than the image (its libc6 was already newer than the archive). Reproduced locally in the same image on 2026-09-22: the build timestamp installs with no libc6 change; later timestamps install the same package but move libc6 and OpenSSL under it; earlier ones cannot resolve libc6-dev. Timestamp and version pin together, and the timestamp is read from the image. http rather than https because the slim image has no CA bundle and apt verifies the Release signatures anyway; Check-Valid-Until off because the archived trixie-updates/-security Release files are past their validity window. ADR-0034 records the mechanism and the bump procedure; ADR-0020's Status line points at it. Claude-Session: https://claude.ai/code/session_018UmL9wcgKBGFjdjGSSLafa Signed-off-by: Gonzalo Fleming <[email protected]>
…atum Two corrections from review. - The row on password authentication cited `README.md`, which §1 does not list as a document a case may rest on. Threat model §5.3.1 states the behaviour, with RFC-0011. The row cites them. - The ADR said ADR-0023 does not say which failure a forwarding channel gets while a session is open. It does: a non-`session` type gets "unknown channel type". The server checks for an open channel first and answers "administratively prohibited", and has since M5 (#84), which merged before ADR-0023 was accepted. That is a text that was wrong at acceptance, so §2 and §9 now send it to an erratum under ADR-0015 instead of to a sentence in another document. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]>
…client (#289) * docs(adr): ADR-0062, a conformance suite driven by the stock OpenSSH client Phase 3 lists conformance tests against the OpenSSH client, and #248 gives the work an ADR that extends ADR-0020. This is it, as Proposed. The interop gate makes 15 checks, each added by the ADR of a feature. No rule says which behaviours get one, and nothing lists what is not checked. The ADR decides how the gate grows into the suite: - a behaviour belongs when a document states it and a stock client tool reaches it, refusals included; - one case per behaviour, citing its document, and the document gets its sentence first when none states the behaviour; - a catalogue file that the run enforces, so a dropped case fails; - a refusal case asserts the refusal, and a case about which side acted reads it from the audit log; - the same bash script, on the pinned client, with nothing added to the gate image, on every PR and on every release artifact. A probe of 22 behaviours with OpenSSH 10.6p2 backs it. Nineteen behaved as documented. Three are stated in no document, or not in full: the server refuses ssh-keyscan, which negotiates no strict-kex; the size of the authentication budget; and which failure a forwarding channel gets while a session is open. The re-key after 1 GiB turned out to be started by the client under ChaCha20, and by the server only under AES-GCM. Nothing is implemented here. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0062 cites the threat model, and ADR-0023 takes an erratum Two corrections from review. - The row on password authentication cited `README.md`, which §1 does not list as a document a case may rest on. Threat model §5.3.1 states the behaviour, with RFC-0011. The row cites them. - The ADR said ADR-0023 does not say which failure a forwarding channel gets while a session is open. It does: a non-`session` type gets "unknown channel type". The server checks for an open channel first and answers "administratively prohibited", and has since M5 (#84), which merged before ADR-0023 was accepted. That is a text that was wrong at acceptance, so §2 and §9 now send it to an erratum under ADR-0015 instead of to a sentence in another document. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> --------- Signed-off-by: Gonzalo Fleming <[email protected]>
* test(interop): the OpenSSH conformance suite, with a catalogue the run enforces ADR-0062: the interop gate grows from 15 checks into 43 cases, one for every behaviour that a document states and a stock OpenSSH client can reach, refusals included. - tests/interop/CASES.md is the catalogue: one line per case, the document it checks, and what a client may lack for it to skip. - tests/interop/cases.sh holds the cases, one function each. - run_openssh_client.sh is the driver. Before the first case it fails if a case has no line, a line has no case, or a line is repeated. After the last it fails unless every case reported ok, or a skip that both its line and INTEROP_ALLOW_SKIP allow. A run that stops early with status 0 fails too. - negative_no_hybrid now asserts the client's "no matching key exchange method found", not only a non-zero exit. - The server-initiated re-key runs under AES-GCM and reads `initiator` from the audit log: under ChaCha20 the client's own 1 GiB limit fires first. - The client reads no ssh_config and no agent of the account that runs it. A developer's AddKeysToAgent otherwise left every run's throwaway keys in their agent, and the agent reordered the keys a client offers. - The macOS release leg allows four skips: its client has no OpenSSL and no zlib, so no AES-GCM, no RSA or ECDSA, and no compression. Its no-fallback check now covers ssh-keyscan and ssh-agent, which the suite uses. The PR gate and the Linux release legs allow none. Run locally: 43 of 43 in the gate image with OpenSSH_10.6p1 Debian-1 on aarch64, five times, 11 to 14 s; 43 of 43 on macOS with 10.6p2, under bash 5.3 and bash 3.2; 39 and 4 skipped with 10.6p1 built as the macOS leg builds it. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> * docs: what the conformance suite found, put right in the documents The probe behind ADR-0062 found three behaviours that no document stated, or stated differently from the server. ADR-0062 §2 puts the document right before the case rests on it. - docs/deployment.md §3: ssh-keyscan cannot fetch the host key. It does not negotiate strict-kex, so the server disconnects it with code 3 before it sends one. The section says how to trust the key from its .pub line instead, and the case known_hosts_from_pub checks that way. - Threat model §5.3.1: a connection has a budget of 12 authentication requests, and the twelfth ends it with code 11. It was in the code only. - ADR-0023 takes an erratum (ADR-0015). Its table gave every non-session channel type code 3. Since M5 (#84), before the ADR was accepted, the server checks for an open channel first, so a forwarding channel opened during a session gets code 1. Both refuse it, and the decision does not change. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0062 is Accepted with its implementation - ADR-0062 is Accepted, dated with this PR. Its text records what the implementation found: the catalogue's place and form, the client run with no ssh_config and no agent, four skips on the macOS leg where the draft named two, the times measured, and that the pinned clients gave the probe's results. The interactive shell on a PTY, which the draft left open, has its case. - The rule of §8 goes into CLAUDE.md, next to ADR-0060 §9's rule for fuzz targets, and into AGENTS.md's Code Review Rules. - CLAUDE.md, AGENTS.md and docs/infrastructure.md describe the suite where they described the gate. - The README's Phase 3 item on conformance tests is done. - The changelog has the suite and the three documents it corrected. Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0062 records the suite's time on the PR runner §6 said the implementing PR reports the step's time on the PR runner. On x86_64 it took 17 seconds, up from 3, and passed all 43 cases with none skipped (run 44864009111). Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> * test(interop): the certificate refusals assert their reason openssh_cert_refusals passed whenever ssh exited non-zero, so a server that was down, or any other failure, satisfied it. ADR-0062 §4 says a refusal case asserts the refusal, and every other refusal case already did. Each of the three runs now shows that the client offered that certificate (its ED25519-CERT offer in `ssh -v`) and was denied with "Permission denied (publickey).". Refs #248 Signed-off-by: Gonzalo Fleming <[email protected]> --------- Signed-off-by: Gonzalo Fleming <[email protected]>
What
Implements M5, the final tranche of the Phase 1 walking skeleton (ADR-0023): one
sessionchannel carrying oneexec, streaming output, then a clean close.ssh host 'echo hello'now works end-to-end against a real OpenSSH 10.x client.This is the work tracked under issue #9 (closed) — the channel/exec layer the M4 terminal
reject_channel_openwas a placeholder for.How it's built
transport.rs— newSessiontype-state stage with a cancel-saferead_packet(resumableinbuf) that shares the decrypt path withread_sealedvia factored helpers — no second framing path.AuthAccepted → Sessionthreads the authenticated key fingerprint for the audit events.channel.rs— the RFC 4254 connection layer scoped to ADR-0023: eleven channel messages, one honouredexec, real bidirectional flow control (2 MiB window / 32 KiB packet; inbound credit returned only as the child drains stdin), and a total, fail-closed dispatch. The driver multiplexes inbound packets against blocking-thread child output with onetokio::select!, never holding two&mutborrows of the wire.exec.rs—/bin/sh -cchild onspawn_blocking(ADR-0022) with dedicated stdin/stdout/stderr pumps + reap;rustixforgetuidand kill-on-early-close; sanitised env (ADR-0016);exec.started/exec.finishedaudit events (ADR-0024).server.rs— the handshake budget now bounds only up to authentication; the channel phase runs un-timed.Decisions (see plan
docs/plans/m5-channels.md)/bin/sh -cforexec(ADR-0023 erratum): interop requires shell interpretation, and the service account's login shell isnologin. Bounded by the service-account UID + sanitised env + one-channel/one-exec scope.rustixovernixforgetuid/kill(ADR-0016 amended): smaller surface (MANIFIESTO chore(security): mark quantumssh.org aliases as live #4); one dep,processfeature only. All subtree licences (Apache-2.0/MIT) are in thedeny.tomlallowlist.Proposed); status flip toAccepteddeferred — all Phase-1 ADRs (0016–0024) share that lag, so a separate governance sweep is the right place, not a one-off flip here.Verification
Local, against OpenSSH 10.2p1:
Plus
cargo fmt --check,clippy -D warnings, 80 unit + 20 integration tests (incl.cancel_safety_under_load, 3 MiB), shellcheck clean.Interop CI gate (ADR-0020)
Adds
tests/interop/run_openssh_client.shand.github/workflows/interop.yml(Debian trixie container → OpenSSH 10.0p1). One follow-up before merge: the container is referenced by tag; ADR-0020 wants it pinned to an image digest (debian@sha256:…) — markedTODOin the workflow, to be resolved with adocker pull.https://claude.ai/code/session_01BRMdwxsqYQPbjrWB1Cek6o