Repository navigation
docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper - #194
Conversation
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving the New findingsNo finding scored ≥80. The three candidates I examined and rejected:
💡 Suggestions (nice to have)
LimitationsThe RFC's OpenSSH citations ( Decision: 🟢 Approved |
… erratum The implementing PR records the corrected "SFTP brings multiplexing" statement as a post-acceptance erratum on ADR-0038 (ADR-0015), the corpus's discoverability path. From opencode's review of #194. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The candidates examined and rejected this iteration:
💡 Suggestions (nice to have)
Limitations
Decision: 🟢 Approved |
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The new commit
The candidates examined and rejected this iteration:
💡 Suggestions (nice to have)
Limitations
Decision: 🟢 Approved |
…ane 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]>
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. |
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The candidates examined and rejected this iteration:
Limitations
Decision: 🟢 Approved |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c636898919
ℹ️ 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: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The candidates examined and rejected this iteration:
💡 Suggestions (nice to have)
Limitations
Decision: 🟢 Approved |
…-relative link in the §5.4.5 block Codex on #194: - the helper exits 0 only at EOF on a packet boundary; EOF inside a packet is truncated input and takes the framing rule's fail-closed path; - the §5.4.5 block links RFC-0013 by a repository-root path, which resolves both here and once copied into docs/threat-model.md. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
Follows RFC-0013's clarification from Codex on #194; the implementation already returns 2 for EOF inside a packet (read_packet). 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]>
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The candidates examined and rejected this iteration:
Limitations
Decision: 🟢 Approved |
|
APIError: Insufficient Balance (request_id: 3f8f0594-c54d-4e53-9d84-8e77507277a3) |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. 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". |
|
APIError: Insufficient Balance (request_id: 571d23a6-3410-4897-b400-abb15dfb6138) |
|
APIError: Insufficient Balance (request_id: d8537335-e53b-4389-9637-7e2b8cdb1878) |
… erratum The implementing PR records the corrected "SFTP brings multiplexing" statement as a post-acceptance erratum on ADR-0038 (ADR-0015), the corpus's discoverability path. From opencode's review of #194. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
1d70b67 to
67f61d9
Compare
…-relative link in the §5.4.5 block Codex on #194: - the helper exits 0 only at EOF on a packet boundary; EOF inside a packet is truncated input and takes the framing rule's fail-closed path; - the §5.4.5 block links RFC-0013 by a repository-root path, which resolves both here and once copied into docs/threat-model.md. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
|
APIError: Insufficient Balance (request_id: 3d0dacb3-f943-464f-85cb-20d2883ef304) |
… helper Proposes serving `subsystem "sftp"` with QuantumSSH's own SFTP v3 server, a single-threaded helper mode of the quantumssh binary started as an ordinary pipe child, so it inherits ADR-0038's process supervision and is the place Phase 3 drops privileges. It sets the protocol profile (version 3, OpenSSH's 256 KiB bound, limits/posix-rename/fsync/ expand-path), the filesystem semantics as the service account, and the audit record (request_type "subsystem", bytes per direction). It also notes that SFTP needs no channel multiplexing: sftp and scp use one session channel. Alternatives weighed: OpenSSH's sftp-server (C, host-dependent), russh-sftp (trust base, russh ecosystem), an in-process async server (Phase-3 incompatible), and waiting for Phase 3. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
… erratum The implementing PR records the corrected "SFTP brings multiplexing" statement as a post-acceptance erratum on ADR-0038 (ADR-0015), the corpus's discoverability path. From opencode's review of #194. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
A new in-scope attack vector goes through the RFC process (threat model, Maintenance), so the §5.4.5 "SFTP request handling" entry is part of this RFC and the implementation PR adds it verbatim. From opencode's review of #195. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
…-relative link in the §5.4.5 block Codex on #194: - the helper exits 0 only at EOF on a packet boundary; EOF inside a packet is truncated input and takes the framing rule's fail-closed path; - the §5.4.5 block links RFC-0013 by a repository-root path, which resolves both here and once copied into docs/threat-model.md. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
… working directory The OpenSSH 10.6 client enables each extension only when its version string is exactly "1" (sftp-client.c:499-536), so the table now says so. SFTP v3 §6.2 makes an empty path the user's default directory; the helper reads it as ".", except SYMLINK's target, which is link content. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
67f61d9 to
dde1532
Compare
|
Claude finished @gonzafg2's task in 33s —— View job Review of RFC-0013 (head
|
…R-0038 pointer From Claude's review of the final head: - Once authorized_keys options are enforced, a restriction that limits shell and exec limits subsystem too. - An unknown request type's id is the uint32 after the type byte, and a packet too short for one takes the framing rule's fail-closed path. - The §5.4.5 assets line says QuantumSSH does not protect the service account's files from that account in Phase 2 (§8.12). - §1 points at ADR-0041 (#195, TBD) for superseding ADR-0038 §1's subsystem refusal. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
|
Thanks. Applied in 7358c0f, point by point:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
…hed byte counts (Proposed) Implementing ADRs for RFC-0013 (Draft, #194): - ADR-0041 locks the SFTP server: the subsystem request rules, the helper dispatch and the Config::helper rename, OpenSSH's 256 KiB and read bounds, a 256-handle cap, exactly one response per request, the operation mapping on std::fs/rustix, OpenSSH's RENAME and SYMLINK semantics, the four advertised extensions, fixed status messages, and a numeric, UTC longname. It answers the RFC's open questions 1, 2 and 4. - ADR-0042 adds bytes_received and bytes_sent to exec.finished for every request type, counted at the channel driver, realising threat model §5.4.4's record (the RFC's question 3). Both stay Proposed until RFC-0013 is accepted and the implementation lands. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
Follows RFC-0013's clarification from Codex on #194; the implementation already returns 2 for EOF inside a packet (read_packet). Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]>
#194 merged on 2026-10-28 (f2ce221). Per docs/rfcs/README.md step 6, the merge is the acceptance, and the Status flips in a follow-up, as #214 did for RFC-0012. ADR-0041's and ADR-0042's Related lines no longer call it a Draft. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]>
PR Review: docs(rfc): RFC-0013 — SFTP subsystem in a first-party SFTP v3 re-exec helper (#194)Decision: 🟢 Approved Executive summaryRFC-0013 proposes serving Previous issues
New findingsNo finding scored ≥80. The single candidate examined and rejected this iteration:
Limitations
Decision: 🟢 Approved |
…hed byte counts (Proposed) (#195) * docs(adr): ADR-0041 and ADR-0042 — SFTP v3 server details; exec.finished byte counts (Proposed) Implementing ADRs for RFC-0013 (Draft, #194): - ADR-0041 locks the SFTP server: the subsystem request rules, the helper dispatch and the Config::helper rename, OpenSSH's 256 KiB and read bounds, a 256-handle cap, exactly one response per request, the operation mapping on std::fs/rustix, OpenSSH's RENAME and SYMLINK semantics, the four advertised extensions, fixed status messages, and a numeric, UTC longname. It answers the RFC's open questions 1, 2 and 4. - ADR-0042 adds bytes_received and bytes_sent to exec.finished for every request type, counted at the channel driver, realising threat model §5.4.4's record (the RFC's question 3). Both stay Proposed until RFC-0013 is accepted and the implementation lands. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 applies RFC-0013's §5.4.5 entry; ADR-0038 Status pointer for request_type - The threat model's new §5.4.5 entry now comes from RFC-0013 (RFC lane), and the implementation PR adds it verbatim; §5.4.4 gets only a factual pointer to ADR-0042. - The implementation PR also records on ADR-0038's Status that this ADR extends §9's request_type values with "subsystem". From opencode's review of #195. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 — APPEND writes, CLOSE errors, OpenSSH's full RENAME, ADR-0038 §1 pointer From the reviews of #195 (Codex, claude-review, opencode), checked against openssh-portable V_10_6_P1 and rustix 1.1.5: - WRITE on an APPEND handle uses write_all, as OpenSSH skips lseek for O_APPEND; positional writes never carry APPEND, since pwrite ignores O_APPEND on macOS (POSIX). - CLOSE syncs a written file with sync_data before dropping it and maps a failure, the only safe way to see a deferred write error: File's Drop ignores close errors and rustix's close is unsafe and returns nothing. The fdatasync per written file is a recorded cost. - RENAME follows OpenSSH fully: the EOPNOTSUPP/ENOSYS/EXDEV fallback to check-then-rename, and removing the spare link when unlink fails. - The planned ADR-0038 Status pointer names §1 (subsystem now honoured) as well as §9. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 — OpenSSH's OPEN flags, realpath and expand-path; EPERM link fallback; no sync on special files Codex on #195, each checked against openssh-portable V_10_6_P1: - OPEN builds OpenSSH's flags_from_portable flags with rustix::fs::open: READ|APPEND stays read-only and READ|CREAT is valid, which OpenOptions cannot express; - REALPATH follows OpenSSH's sftp-realpath.c, the final symlink included (32 links), so a dangling final symlink resolves to its target; - expand-path takes ~ from the working directory ($HOME or /), as process_extended_expand uses getcwd; - RENAME's link fallback also covers Linux EPERM (LINK_OPNOTSUPP_ERRNO); - CLOSE syncs written regular files only: fdatasync fails with EINVAL on FIFOs, sockets and devices. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 — RENAME's existence check does not follow symlinks; 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]> * docs(adr): ADR-0041 — cap checked before OPEN; non-blocking SETSTAT size; 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]> * docs(adr): ADR-0041 — exit 0 only at EOF on a packet boundary (RFC-0013) Follows RFC-0013's clarification from Codex on #194; the implementation already returns 2 for EOF inside a packet (read_packet). Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 — Alternative 1 lists every rustix use claude-review on #195: the rationale said rustix is used only for utimensat, but §4 now also uses it for OPEN's flag mapping and for SETSTAT's non-blocking size change on a path. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 — an empty path is read as "." (RFC-0013 §4) OpenSSH's sftp-server normalizes the empty path only in REALPATH and expand-path; the helper does it for every path argument, as SFTP v3 §6.2 defines, except SYMLINK's target. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> * docs(rfc): mark RFC-0013 as Accepted #194 merged on 2026-10-28 (f2ce221). Per docs/rfcs/README.md step 6, the merge is the acceptance, and the Status flips in a follow-up, as #214 did for RFC-0012. ADR-0041's and ADR-0042's Related lines no longer call it a Draft. Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> --------- 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]>
…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]>
… counts (ADR-0041, ADR-0042) (#196) * feat(sftp): SFTP v3 subsystem in a re-exec helper; exec.finished byte counts (ADR-0041, ADR-0042) Implements RFC-0013 through ADR-0041 and ADR-0042: - sftp.rs: a first-party SFTP version 3 server, run by the binary's --quantumssh-internal-sftp-server helper mode (dispatched in main after the PTY helper). Single-threaded and synchronous over fds 0/1, starting in $HOME. OpenSSH's 256 KiB packet bound and read clamp, a 256-handle cap, exactly one response per request, fail-closed on malformed input (exit 2), fixed STATUS messages. Operations on std::fs plus rustix::fs::utimensat; APPEND writes are sequential, CLOSE syncs written files to surface deferred errors, RENAME and SYMLINK follow OpenSSH. Extensions: posix-rename, fsync, limits, expand-path (~ only). Longnames carry numeric owners and UTC dates. - channel.rs: `subsystem "sftp"` is honoured in Idle with no pending PTY and a helper configured; the child is the ordinary pipe child (exec::spawn_sftp). exec.* carry request_type "subsystem" and command "sftp". exec.finished gains bytes_received and bytes_sent for every request type, counted at the driver. - server::Config::pty_helper is renamed Config::helper: one binary hosts both helpers. - Tests: sftp.rs unit tests; a core test for the no-helper refusal; binary-crate tests that re-exec the real binary for a 100 KB round trip and the refusals; sftp -b and scp both ways in the OpenSSH interop gate. Refs #109 Claude-Session: https://claude.ai/code/session_01HxXXh6HEpJBs7tbuz3NmtW Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): accept ADR-0041 and ADR-0042 with the SFTP implementation; 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]> * fix(sftp): OpenSSH's OPEN flags, realpath and expand-path; safer RENAME; 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]> * fix(sftp): no side effect from a refused OPEN; non-blocking SETSTAT size; 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]> * docs(threat-model): §5.4.5 links RFC-0013 by its repository-root path, 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]> * docs(sftp): the module doc names every rustix use 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]> * fix(sftp): an empty path names the working directory 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]> * fix(sftp): ~//x in expand-path stays under the working directory 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]> * docs(threat-model): §5.4.5 assets line, verbatim from RFC-0013 7358c0f Claude-Session: https://claude.ai/code/session_01QpBZ4qUr3ypV22CvmVwwHp Signed-off-by: Gonzalo Fleming <[email protected]> * docs(adr): ADR-0041 and ADR-0042 dates follow RFC-0013's acceptance (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]> * ci: re-run the required checks against the main base 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]> * fix(sftp): REALPATH reads components through a cursor, not drain 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]> * docs(sftp): FIFO OPEN blocks as in OpenSSH; parsers vs handlers in §5.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]> --------- Signed-off-by: Gonzalo Fleming <[email protected]>
…ane 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]>
…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]>
Summary
RFC-0013 proposes that QuantumSSH serve the
sftpsubsystem with its own SFTP version 3 server, written in Rust with no first-partyunsafe. It runs as a single-threaded helper mode of thequantumsshbinary, which the channel layer starts as an ordinary pipe child. The helper inherits ADR-0038's process supervision and audit, keeps file access out of the server process, and is where Phase 3 will drop privileges.This PR stays a Draft for the 14-day comment period, until 2026-10-26. Implementing ADRs and code follow acceptance.
Motivation
Refs #109
0.1.0MVP (README.md:57).scpuses SFTP by default (scp.c:458,:1004), so today bothscpandsftpfail against QuantumSSH.What the RFC decides
subsystem "sftp"once inIdle, exclusive withexecandshell. It is refused after apty-req, and any other subsystem name is refused.$HOME, and serves until EOF.limits@,posix-rename@,fsync@andexpand-path@.shellalready has. Create modes are masked to0777. RENAME andposix-renamefollow OpenSSH's semantics.exec.*withrequest_type = "subsystem"andcommand = "sftp".exec.finishedgainsbytes_receivedandbytes_sent. No paths and no content are logged.sftpandscpuse onesessionchannel. This corrects ADR-0038's Consequences ("SFTP brings multiplexing") and the scoping note.Sources
All protocol claims cite openssh-portable
V_10_6_P1(sftp-server.c,sftp-client.c,scp.c,session.c,PROTOCOL) anddraft-ietf-secsh-filexfer-02by line number.Alternatives weighed
sftp-server: C code, and the feature would depend on what the host has installed.russh-sftp: it expands the trust base and belongs to the russh ecosystem that RFC-0003 declined.Open questions for reviewers
statvfs@andhardlink@join the initial set?[sftp]switch, or none?exec.finished, or only on subsystems?Checklist
git commit -s).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