Repository navigation
feat(sftp): SFTP v3 subsystem in a re-exec helper; exec.finished byte counts (ADR-0041, ADR-0042) - #196
Conversation
|
APIError: Insufficient Balance (request_id: d6a0ec0e-d032-4d46-8f6c-9a8cb573eb1e) |
Codex on #198: SFTP is not on main yet, so the guide must not present it as available. Sessions start in the home; ProtectSystem=strict's row names every write instead of SFTP uploads. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…de (ADR-0043) (#198) * docs(adr): ADR-0043 — systemd Type=notify service, first-party readiness protocol, reference unit (Proposed) - The binary sends READY=1 once listening and STOPPING=1 with EXTEND_TIMEOUT_USEC (drain + 5 s) at the first SIGTERM/SIGINT, as one AF_UNIX datagram over std's UnixDatagram: no libsystemd, no crate, no unsafe (as OpenSSH 9.8p1 did after CVE-2024-3094). - Reference unit contrib/systemd/quantumssh.service: Type=notify, NotifyAccess=main, User=quantumssh, KillMode=mixed (ADR-0028's drain unchanged; cgroup leftovers killed at stop), Restart=on-failure, NoNewPrivileges=yes; no capability for port 22 and no sandboxing that would also confine sessions. - docs/deployment.md is the operator guide; CI runs the unit under real systemd on the Ubuntu runner. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * feat(systemd): Type=notify readiness, reference unit and operator guide (ADR-0043) - notify.rs (binary): the sd_notify datagram protocol on std's UnixDatagram, path and Linux abstract addresses; no libsystemd, no crate, no unsafe. READY=1 after the listener is bound and the SIGTERM/SIGINT handlers are installed; STOPPING=1 with EXTEND_TIMEOUT_USEC (drain + 5 s) at the first signal. - The signal handlers are now installed before the listener task is spawned, so a stop that follows READY=1 always drains. - contrib/systemd/quantumssh.service: Type=notify, NotifyAccess=main, User=quantumssh, KillMode=mixed, Restart=on-failure, NoNewPrivileges=yes. - docs/deployment.md: service account, StrictModes file layout, config, port 22 (nftables redirect, or the capability and its cost), logs, stop/restart/reload, and what each sandboxing directive does to sessions. - tests/systemd: the reference unit under a real systemd, in a container built from the interop gate's pinned Debian image; run by a new step in build (ubuntu-latest). - Unit tests for the sender and an integration test that runs the binary with NOTIFY_SOCKET. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): accept ADR-0043 with its implementation; README and Phase-2 scoping mark systemd landed - ADR-0043 flips to Accepted with this implementing PR (#198); the date assumes a merge on 2026-10-13 (adjust if merged another day). Links name the implementing files. - README's Phase-2 roadmap and the scoping note's workstream row and ordering mark systemd integration as landed. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * fix(exec): start session children in the service account's $HOME (RFC-0002) RFC-0002's execution contract sets the child's cwd to the service account's $HOME, but spawn and spawn_pty never set a working directory: every exec and shell inherited the directory the server was started from — `/` under systemd, the crate directory in the tests. Both now call current_dir with the server's own HOME (the value the sanitised environment passes on), falling back to `/` when HOME is unset, relative or not a directory. Tests: `pwd -P` on pipes (accept.rs) and on a PTY (pty.rs) returns the canonical HOME; both fail without the fix (they print the crate directory). Found by Codex on #197. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0043 — no WorkingDirectory=; the server starts sessions in $HOME (RFC-0002, #199) Codex on #197: under the unit the working directory is `/`, and the server did not set the children's. #199 fixes that in the server, for every deployment; the unit needs no WorkingDirectory=. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * test(systemd): the reference-unit check asserts the session runs in $HOME systemd starts the server in `/`; with #199 merged in, a session's `pwd -P` is the account's home. The check fails with the pre-#199 binary and passes with it. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * fix(server): the accept loop's shutdown receiver exists before any signal Codex on #198: serve subscribed its receiver when its future first ran, and the binary dropped the channel's initial receiver. A broadcast only reaches receivers that exist when it is sent, so a SIGTERM delivered right after READY=1 — a stop job systemd queued during the start — could be broadcast before serve subscribed, and the drain deadline was lost. Server::serve now takes the loop's receiver: the one broadcast::channel returns, alive from the channel's creation. The binary and the test support pass it instead of dropping it. Test: shutdown_sent_before_serve_first_runs_is_not_lost sends the deadline before the spawned serve is first polled; with the old subscribe-on-first-run it fails (SendError: no receiver). Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(deployment): no SFTP in the guide until it lands (#196) Codex on #198: SFTP is not on main yet, so the guide must not present it as available. Sessions start in the home; ProtectSystem=strict's row names every write instead of SFTP uploads. Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0043 §4 — ProtectSystem=strict example without SFTP, which is not on main yet Codex on #198 (the same text is in the guide). Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> --------- Signed-off-by: Gonzalo Fleming <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d6659a15e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR Review: feat(sftp): SFTP v3 subsystem in a re-exec helper; exec.finished byte counts (ADR-0041, ADR-0042) (#196)Decision: 🟡 Minor changes Executive summaryThe PR implements RFC-0013 as ADR-0041 describes: a bounded, first-party SFTP v3 server in a re-exec helper, reached only through Previous issues
New findings🟡 Important (should be resolved)crates/quantumssh-core/src/channel.rs:369-371 — audit byte count (confidence: 82)
💡 Suggestions (nice to have)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d6659a15e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ks; future mtimes show the year Codex on #196: - every RENAME existence check uses symlink_metadata, so a dangling symlink at the destination is never replaced (stricter than OpenSSH's stat, in the direction of the no-overwrite invariant); - the longname uses the time form only for an mtime in the six months up to now; a future mtime gets the year (OpenSSH's sftp-common.c rule). Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
PR Review: feat(sftp): SFTP v3 subsystem in a re-exec helper; exec.finished byte counts (ADR-0041, ADR-0042) (#196)Decision: 🔴 Blocked Executive summaryThe PR implements RFC-0013 as ADR-0041 describes: a bounded, first-party SFTP v3 server in a re-exec helper, reached only through Previous issues
New findingsNo new finding reaches the ≥80 threshold. The open items above are the remaining work; #3 and #7 are withdrawn, not fixed. Blocking: #1 (accept RFC-0013 before or in the same stack as ADR-0041/0042) and #5 (support |
…ME; INIT, CLOSE, READDIR and stdin credit fixes Codex on #195 and #196, each checked against openssh-portable V_10_6_P1: - OPEN uses rustix::fs::open with flags_from_portable's flags: READ|CREAT creates a read-only handle, READ|APPEND grants no write; - REALPATH ports sftp-realpath.c: every symlink is followed, the final one included (32 links), and only a missing last component is accepted, so a dangling final symlink resolves to its target; - expand-path takes ~ from the working directory ($HOME or /) that the helper passes in, as OpenSSH's getcwd; relative REALPATHs use it too; - RENAME's existence checks use symlink_metadata (a dangling symlink at the destination is never replaced) and the link fallback covers Linux EPERM (LINK_OPNOTSUPP_ERRNO); - CLOSE syncs only written regular files (fdatasync fails with EINVAL on devices, FIFOs and sockets); - INIT must carry its version; a truncated INIT ends the session; - READDIR reads each entry's metadata through the open directory (DirEntry::metadata), not a rebuilt path; - the longname uses the year for a future mtime (sftp-common.c rule), via a pure ls_date; - pump_stdin credits each successful partial write, so a child that reads a prefix and exits is counted in bytes_received (ADR-0042). Tests: init_without_a_version_ends_the_session, open_maps_flags_independently, close_of_a_written_device_succeeds, realpath_follows_symlinks_the_final_one_included, the extended realpath_resolves_a_missing_last_component, rename_does_not_replace_a_dangling_symlink, ls_dates_follow_openssh, pump_stdin_credits_partial_writes (fails with the old write_all). macOS and Linux (rust:1.99.0-bookworm) suites pass; local interop with OpenSSH 10.3 passes openssh_sftp and openssh_scp. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…ize; READDIR errors and metadata Second review round on #196: - the handle cap is checked before the open: a refused OPEN has no side effect; - SETSTAT's size on a path uses a write-only, non-blocking open and ftruncate, so a FIFO with no reader fails at once (OpenSSH: truncate(2)); - READDIR's metadata comes through the open directory without following symlinks; unreadable entries are skipped (as OpenSSH's failed lstat); a failed directory read is the reply's status, EOF only when exhausted. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…ize; partial-write latch; READDIR errors; drain stdin credits Second review round on #196 (Codex and claude-review): - the handle cap is checked before the open, so an OPEN refused at the cap has not created or truncated the file (claude-review); - SETSTAT's size opens the path write-only and non-blocking, then ftruncate: a FIFO with no reader fails at once instead of hanging the single-threaded helper, matching OpenSSH's truncate(2) (claude-review); - WRITE sets the handle's written latch as soon as any byte reaches the file, so CLOSE syncs after a write that failed part-way (Codex); - a failed directory read is reported as the READDIR status, after any names already gathered, instead of looking like EOF (Codex); - exec.finished drains the stdin credits still queued when the channel closes, so bytes the child received are counted (Codex, ADR-0042). Tests: a_refused_open_leaves_the_file_untouched, setstat_size_on_a_fifo_does_not_block. macOS and Linux suites pass; local interop with OpenSSH 10.3 passes openssh_sftp and openssh_scp. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
|
APIError: Insufficient Balance (request_id: 92ab2bcf-9d59-442e-9903-ce0df35e7989) |
|
APIError: Insufficient Balance (request_id: 88ba74a9-a773-425a-b7db-cb7ce7b452b5) |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1040a42a01
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
… errata and threat model §5.4.5 - ADR-0041 and ADR-0042 flip to Accepted with this implementing PR, on RFC-0013's acceptance (2026-10-26; adjust if merged another day). - ADR-0038's Status records the partial supersession of §1 (subsystem now honoured) and §9 (request_type "subsystem"); an erratum corrects "SFTP brings multiplexing". - ADR-0024's Status adds ADR-0042's fields; an erratum adds `command` to the exec.finished row, which the code emitted at acceptance (a3921d5). - The threat model gains RFC-0013's §5.4.5 entry verbatim, and §5.4.4 names the byte counts as its record. - CHANGELOG, README and CLAUDE.md list SFTP as landed. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…ME; INIT, CLOSE, READDIR and stdin credit fixes Codex on #195 and #196, each checked against openssh-portable V_10_6_P1: - OPEN uses rustix::fs::open with flags_from_portable's flags: READ|CREAT creates a read-only handle, READ|APPEND grants no write; - REALPATH ports sftp-realpath.c: every symlink is followed, the final one included (32 links), and only a missing last component is accepted, so a dangling final symlink resolves to its target; - expand-path takes ~ from the working directory ($HOME or /) that the helper passes in, as OpenSSH's getcwd; relative REALPATHs use it too; - RENAME's existence checks use symlink_metadata (a dangling symlink at the destination is never replaced) and the link fallback covers Linux EPERM (LINK_OPNOTSUPP_ERRNO); - CLOSE syncs only written regular files (fdatasync fails with EINVAL on devices, FIFOs and sockets); - INIT must carry its version; a truncated INIT ends the session; - READDIR reads each entry's metadata through the open directory (DirEntry::metadata), not a rebuilt path; - the longname uses the year for a future mtime (sftp-common.c rule), via a pure ls_date; - pump_stdin credits each successful partial write, so a child that reads a prefix and exits is counted in bytes_received (ADR-0042). Tests: init_without_a_version_ends_the_session, open_maps_flags_independently, close_of_a_written_device_succeeds, realpath_follows_symlinks_the_final_one_included, the extended realpath_resolves_a_missing_last_component, rename_does_not_replace_a_dangling_symlink, ls_dates_follow_openssh, pump_stdin_credits_partial_writes (fails with the old write_all). macOS and Linux (rust:1.99.0-bookworm) suites pass; local interop with OpenSSH 10.3 passes openssh_sftp and openssh_scp. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…ize; partial-write latch; READDIR errors; drain stdin credits Second review round on #196 (Codex and claude-review): - the handle cap is checked before the open, so an OPEN refused at the cap has not created or truncated the file (claude-review); - SETSTAT's size opens the path write-only and non-blocking, then ftruncate: a FIFO with no reader fails at once instead of hanging the single-threaded helper, matching OpenSSH's truncate(2) (claude-review); - WRITE sets the handle's written latch as soon as any byte reaches the file, so CLOSE syncs after a write that failed part-way (Codex); - a failed directory read is reported as the READDIR status, after any names already gathered, instead of looking like EOF (Codex); - exec.finished drains the stdin credits still queued when the channel closes, so bytes the child received are counted (Codex, ADR-0042). Tests: a_refused_open_leaves_the_file_untouched, setstat_size_on_a_fifo_does_not_block. macOS and Linux suites pass; local interop with OpenSSH 10.3 passes openssh_sftp and openssh_scp. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…, verbatim from the RFC RFC-0013 now carries the root-relative link (Codex on #194); the entry stays a verbatim copy. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
Matches ADR-0041 Alternative 1 (claude-review on #195). Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
SFTP v3 (draft-ietf-secsh-filexfer-02 §6.2) defines an empty path as the user's default directory, but path arguments went to std::fs unchanged, so STAT, OPENDIR and the other path requests answered NO_SUCH_FILE for "". path_arg now reads it as ".". SYMLINK's target is link content and stays as sent. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
PathBuf::join drops the base when the suffix is absolute, so ~//upload resolved to /upload. The helper now concatenates the working directory, a slash and the suffix, as OpenSSH's "%s/%s" does (sftp-server.c:1569-1572), and REALPATH collapses the repeated slash. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
…2026-10-28) #194 merged on 2026-10-28, not on the 2026-10-26 the drafts assumed. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
1de7454 to
967a073
Compare
The rebuilt branch was pushed while the PR still targeted the ADR branch, so the main-only workflows did not run on 967a073. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
|
@claude review this PR (SFTP v3 subsystem, ADR-0041 and ADR-0042, now Accepted with this implementing PR). The branch was rebuilt on main with signed commits; the code matches the earlier head plus main. Focus on crates/quantumssh-core/src/sftp.rs (the attacker-reachable parser and handlers), the channel/exec wiring for |
|
Claude finished @gonzafg2's task in 1m 3s —— View job Review of #196: SFTP v3 subsystem (ADR-0041 / ADR-0042)Verdict: no blocking findings. I have two minor suggestions and two notes. I read
Parser and handlers (
|
left.drain(..=i) shifted the rest of the buffer for every component, so a 256 KiB path of ./ cost quadratic time: about 280 ms against 8 ms with the cursor on a debug build. A test pins a packet-sized path. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
….4.5 ADR-0041 §4 says that opening a FIFO with no peer blocks the helper, as it blocks OpenSSH's sftp-server, and that closing the channel kills the process group. Threat model §5.4.5 no longer calls the whole parser a pure function: the framing and field parsers are, and the handlers act on the filesystem, so the Phase-3 harness drives them in a scratch directory. RFC-0013, now accepted, keeps its original wording. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
|
Thanks. Point by point (e331792, 720d23d):
Workspace: clippy is clean on macOS and Linux, and 245 tests pass. |
|
@codex review |
|
Claude finished @gonzafg2's task in 27s —— View job Review of e331792 and 720d23dNo blocking findings. Two minor notes. I read both diffs and the full e331792: REALPATH cursor (
|
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… up to date #196 landed the SFTP stack before the freeze, so request_type subsystem and exec.finished's bytes_received and bytes_sent move from the planned additive changes into the version-1 catalogue (§3, §4), with command "sftp" for the subsystem. RFC-0012 is cited as accepted, the two audit gaps as fixed (#202, #204), and ADR-0024's command erratum as landed with #196. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
PR Review: feat(sftp): SFTP v3 subsystem in a re-exec helper; exec.finished byte counts (ADR-0041, ADR-0042) (#196)Decision: 🟢 Approved Executive summaryThe PR implements RFC-0013 as ADR-0041 describes: a bounded, first-party SFTP v3 server in a re-exec helper, reached only through Previous issues
New findingsNo finding in the new commits (
Decision: 🟢 Approved |
…sioned JSON contract (#203) * docs(adr): ADR-0044 — freeze the audit-log schema as version 1 in a project-owned JSON envelope (Proposed) The first item of the 0.1.0 freeze checklist. The JSON log becomes a project-owned, versioned contract: - envelope: one flat object per line — schema_version (1), timestamp, level, event (catalogue) or message (diagnostics), peer_addr, then the event's fields; no target, span name or span list; a FormatEvent in the binary encoding with serde_json (already in the build); - the version-1 catalogue: ADR-0024's events plus rekey.completed, connection.refused and ADR-0038's fields, all on the non-suppressible audit tier (six events move there); - server.config_error's `message` field becomes `error` (today it duplicates the JSON key that holds the event name); - compatibility: additive changes (new event, field or open-enumeration value) keep version 1; anything else bumps it with an ADR and a CHANGELOG migration note. The inventory also found audit events without peer_addr — fixed in #202. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — audit-log schema version 1 (was ADR-0044; RFC lane per review) Codex on #203: the frozen audit log is a new public compatibility contract, an RFC under CLAUDE.md; and the freeze refines two accepted RFCs (RFC-0010's error classes, RFC-0008's authenticated_identity), which an ADR cannot. ADR-0044 becomes RFC-0014 (Draft, 14-day window). Review findings folded in: - server.config_error splits into `class` (RFC-0010's four classes plus the startup ones) and `error`, keeping RFC-0010's stable classes machine-readable (Codex); - successful configuration load is recorded: server.started gains config_file, server.config_override joins the catalogue (Codex, §2.7); - connection.refused keeps `limit`, superseding ADR-0028's `reason` explicitly (Codex); - RFC-0008: authenticated_identity stays the proven key's fingerprint; certificate fields arrive additively, conditional on certificate authentication (Codex); - exec.finished's `command` listed as a change against ADR-0024 (claude-review); - every failed attempt, the budget-exhausting one included, emits auth.failed — fixed in #204 (claude-review); - failure_count is per connection; aggregate by IP (claude-review); - all enumerations are open; changing an event's level is breaking (claude-review); - the SFTP additions cite #194/#195 as proposed, not as existing ADRs (both reviewers). Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — config_file on server.config_error too Codex on #203: a startup failure after a successful config load (host key, authorized_keys, runtime, bind) returns before server.started, so the error record could not name the configuration that produced it. config_file is now on every server.config_error as well (the canonical path once resolved, the path as given if that failed, "" without --config), so each error record stands on its own. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — no edits to accepted RFCs; fingerprint and override-key formats Codex on #203: - accepted RFCs are not edited in place (docs/rfcs/README.md, "After acceptance"): only ADR-0024 and ADR-0028 gain Status pointers; RFC-0010 and RFC-0008 keep their text and this RFC states what it supersedes; - host_key_fingerprint's representation is frozen: `SHA256:` + unpadded standard base64 of SHA-256 over the public-key blob (OpenSSH's format); - server.config_override's `key` values are the TOML paths (server.listen, server.host_key, auth.authorized_keys, server.handshake_timeout, logging.format); new keys use the same form. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — a superseding ADR, not Status pointers, changes ADR-0024/0028/0029 docs/adr/README.md allows an accepted ADR to change only through a superseding ADR, so the implementing PR adds one that supersedes the listed parts of ADR-0024, ADR-0028 and ADR-0029, as ADR-0031 does for ADR-0008. ADR-0029's info-level override diagnostic and RFC-0010's "no new audit event names" clause join §6, since server.config_override changes both. RFC-0012 is cited as proposed (#172, TBD). Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — SFTP's fields are version 1; references brought up to date #196 landed the SFTP stack before the freeze, so request_type subsystem and exec.finished's bytes_received and bytes_sent move from the planned additive changes into the version-1 catalogue (§3, §4), with command "sftp" for the subsystem. RFC-0012 is cited as accepted, the two audit gaps as fixed (#202, #204), and ADR-0024's command erratum as landed with #196. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — pin kex.failed's reason tokens; summary count; SFTP wording kex.failed's reason was "no-hybrid-kex, no-strict-kex, …". §4 now lists the eleven tokens the transport emits with disconnect code 3 and keeps the enumeration open, as for the override keys. The Summary counts five documents, not three decisions, and the SFTP note moves out of the planned-change list. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): RFC-0014 — exit_status sentinels, full control-character escape, threat-model qualifiers From claude-review on 4a9b58f: - §4 pins exit_status: the exit code, 128 + n for a signal (also with exit-signal on the wire), and 127 when the child could not be started or waited on or no status was recorded. - §2 and §7: the JSON encoder escapes every char::is_control character (C0, DEL, C1) as \u00XX, the set the human formatter escapes; serde_json alone covers only C0. - Three threat-model citations (§2.7, §8.12) carry the qualifier. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> --------- Signed-off-by: Gonzalo Fleming <[email protected]>
…ates (#219) CLAUDE.md's status paragraph listed "no config file" among the missing production features, but the config file landed with #128 (ADR-0029). The remaining gap it names is per-user privilege separation, until Phase 3 (threat model §8.12). The ADR-0024 and ADR-0038 errata entries added by #196 were dated 2026-10-26, from the draft, while #196 merged on 2026-10-28. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
Summary
This PR implements RFC-0013 through ADR-0041 and ADR-0042.
sftpandscpfrom a stock OpenSSH 10.x client now work through QuantumSSH's own SFTP version 3 server. It runs in a re-exec helper mode of thequantumsshbinary, written in Rust with no first-partyunsafe.Draft and stacked on #195 (ADRs), which is stacked on #194 (the RFC's Draft). It stays Draft until RFC-0013's comment period closes on 2026-10-26. The merge order is #194, then #195, then this PR.
Refs #109
Type of change
Changes
crates/quantumssh-core/src/sftp.rs(new): the SFTP v3 server, as ADR-0041 specifies.--quantumssh-internal-sftp-servermode is dispatched inmainafter the PTY helper. It is single-threaded and synchronous over fds 0 and 1, and starts in$HOME.std::fs, plusrustix::fs::utimensatfor times on a path.pwriteignoresO_APPENDon macOS).posix-rename,fsync,limitsandexpand-path(~only).channel.rs:subsystem "sftp"is honoured inIdlewith no pending PTY and a helper configured; everything else is refused, and a malformed name disconnects.exec.*carryrequest_type = "subsystem"andcommand = "sftp".exec.finishedgainsbytes_receivedandbytes_sentfor every request type, counted at the driver (ADR-0042).exec.rs:spawn_sftpgives the SFTP helper the ordinary pipe-child treatment shared withexec(spawn_piped).server::Config::pty_helperis renamedConfig::helper: one binary hosts both helpers.Accepted. Their date assumes 2026-10-26.commandis added to ADR-0024'sexec.finishedrow, because the code emitted it at acceptance (a3921d5).Checklist
git commit -s).cargo fmt --allandcargo clippy --workspace --all-targets -- -D warningslocally.docs/, orREADME.md) where appropriate.CHANGELOG.mdentry under## [Unreleased]if this change is user-visible.cargo deny check. (No new dependency.Cargo.lockis unchanged.)Security considerations
unsafe.read_packetchecks the frame, then reads at most 256 KiB), and a malformed frame ends the session.shellsession already has (§8.12). Confinement is Phase 3.Tests
sftp.rs(14):posix-rename;expand-path,limits, the status texts, civil dates and mode strings.subsystem_without_a_helper_is_refused.tests/sftp.rs), re-executing the real binary:exit-status0 at EOF;pty-req.exec.finishedcarriesbytes_receivedandbytes_sent.openssh_sftp:sftp -bwith mkdir, put, rename, get,ls -l, rm and rmdir;openssh_scp: both directions, with 300 KB files compared byte for byte.pwdshows$HOME,ls -lshows numeric owners and UTC dates, anddfreports "Server does not support [email protected] extension". The audit record reads"request_type":"subsystem","command":"sftp",…,"bytes_received":322,"bytes_sent":1387.rust:1.99.0-bookwormin Docker: clippy is clean, and the same counts pass. As root, the spare-link cleanup test skips its assertion, because root ignores directory permissions.Automated reviews
PRs authored by
dependabot[bot](and other bots) do not trigger opencode or Claude Code Review. Codex reviews through the Codex cloud GitHub App (ADR-0037).They are covered by CI (
commit-lint,build (ubuntu-latest)andbuild (macos-latest)— fmt, clippy, tests, release build —,cargo deny,openssh-interop;cargo auditruns weekly, not per PR) and manual review when needed.https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW