Repository navigation
docs(audit): SEC-1 path-syscall coverage audit -- post-chain GAPs survey - #4710
Merged
Merged
Conversation
This was referenced May 22, 2026
Catalogue daemon-reachable path-syscall sites after the SEC-1 *at* chain shipped helpers for unlinkat/mkdirat/symlinkat/linkat/fchmodat/fchownat/ utimensat/renameat/lstat. Splits the surface into COVERED (11 routed through fast_io helpers), DEFERRED (15 documented in mknodat / receiver- wiring closure docs), and GAP (27 not previously catalogued). GAPs cluster into three follow-up tracks: delete emitter trait refactor (6 sites), temp-file sandbox plumbing (5 sites), and basis/inplace open helper plus readlinkat helper (16 sites). One residual (multi-component create_dir_all fallback) is documented as accepted under SEC-1.h. Two new helpers plus the DeleteFs trait shape change close 22 of 27 GAPs. Complements docs/audits/sec-1-a-path-syscall-surface-2026-05-20.md (discovery audit, pre-mitigation) by providing the post-chain coverage view.
oferchen
force-pushed
the
docs/audits/sec-1-path-syscall-coverage
branch
from
May 22, 2026 05:14
7e8cf6b to
264cf7a
Compare
oferchen
added a commit
that referenced
this pull request
May 22, 2026
Opens SEC-1.q to track the DeleteFs trait-shape refactor that closes the six daemon-reachable path-based unlink/rmdir GAPs in RealDeleteFs identified by PR #4710's post-chain coverage audit. Documents the deferral rationale from SEC-1.g, sketches the parent-dirfd-bearing trait extension and recursive peel helper, and records the re-open triggers so the cleanup is tracked alongside SEC-1.r and SEC-1.s.
oferchen
added a commit
that referenced
this pull request
May 22, 2026
Opens SEC-1.q to track the DeleteFs trait-shape refactor that closes the six daemon-reachable path-based unlink/rmdir GAPs in RealDeleteFs identified by PR #4710's post-chain coverage audit. Documents the deferral rationale from SEC-1.g, sketches the parent-dirfd-bearing trait extension and recursive peel helper, and records the re-open triggers so the cleanup is tracked alongside SEC-1.r and SEC-1.s.
3 tasks
oferchen
added a commit
that referenced
this pull request
May 22, 2026
#4716) Adds four new SEC-1 helpers in `fast_io::dir_sandbox::at_syscalls`: - `openat(dirfd, name, flags, mode) -> File` raw libc wrapper. - `openat_via_sandbox_or_fallback(...)` adaptor that takes the sandbox fast path on a single-component leaf beneath `dest_dir` and falls back to `std::fs::OpenOptions` against `link_path` with best-effort `O_*` bit translation otherwise. - `readlinkat(dirfd, name) -> PathBuf` raw libc wrapper with a growing buffer (256B -> PATH_MAX, doubling each round trip). - `readlinkat_via_sandbox_or_fallback(...)` adaptor mirroring the openat shape but falling back to `std::fs::read_link`. The helpers follow the established SEC-1 pattern: pinning the parent via the sandbox dirfd closes the TOCTOU window between path walk and the kernel reaching the inode. The `*_via_sandbox_or_fallback` adaptors keep behaviour byte-identical for callers that have not yet plumbed a `DirSandbox`, so individual call sites can be cut over one at a time. This PR adds the helpers and re-exports them through `dir_sandbox::mod` and `fast_io::lib`. It deliberately does NOT wire any caller; per-site wiring lands in follow-up PRs so each cutover gets its own diff and review. Extends the existing tests module with 10 new tests covering: - raw `openat` success and ENOENT, - `openat_via_sandbox_or_fallback` fast path, multi-component fallback, and absent-sandbox fallback, - raw `readlinkat` success and EINVAL on a non-symlink, - `readlinkat_via_sandbox_or_fallback` fast path, EINVAL, and multi-component fallback. All helpers are `#[cfg(unix)]` (the `dir_sandbox` module is itself Unix-only); Windows continues to use path-based stdlib opens per the SEC-1.l NTFS handle audit. Closes (post-wire) 16+ GAPs from the SEC-1 path-syscall coverage audit in PR #4710: #4 (readlinkat) plus the 9 direct openat sites (#9-#17) and lays foundations for #5, #20 (open + readdir-loop) and #6, #27 (recursive *at peel). Refs PR #4710.
oferchen
added a commit
that referenced
this pull request
May 22, 2026
…C-1.q (#4724) Opens SEC-1.s to track the recursive_unlinkat_via_sandbox_or_fallback helper called out by SEC-1.q (PR #4711) as the prerequisite for DeleteFs::remove_dir_all_at and by PR #4710's GAP row #27 as the missing Carrier piece for the --delete recursive fallback. Documents the proposed signature mirroring the existing *_via_sandbox_or_fallback family, the openat/fdopendir/readdir + fstatat-classify + unlinkat peel algorithm, cycle detection via (dev, ino) tracking, TOCTOU race handling for file-vs-dir swaps, fallback to std::fs::remove_dir_all when the sandbox is absent, upstream-equivalent error semantics from delete.c:48-176, the cross-platform plan, an 8-case test plan, an ~480 LoC effort estimate, and a three-step dispatch sequence keeping each PR self-contained. Docs-only: no implementation in this PR.
4 tasks
oferchen
added a commit
that referenced
this pull request
May 22, 2026
…EC-1.q) Extend DeleteFs with unix-only `*_at` siblings (unlink_file_at, rmdir_at, unlink_symlink_at, unlink_device_at, unlink_special_at, remove_dir_all_at) that take a parent dirfd + single-component leaf and route through fast_io::unlinkat / fast_io::recursive_unlinkat (SEC-1.s). Path-based methods stay as the no-sandbox / Windows fallback so existing callers keep working unchanged. Closes the six GAP sites in crates/engine/src/delete/emitter/fs.rs from PR #4710 audit section 4 (#22-#27) by giving RealDeleteFs a dirfd- anchored dispatch shape. Adds DeleteEmitter::with_sandbox carrier slot that opens a per-plan dirfd via DirSandbox::root_dirfd just before dispatch so a mid-syscall symlink swap on the parent walk cannot redirect the call. Plan-directory open failure transparently falls back to the path-based methods so the drain stays compatible. RecordingDeleteFs and ScriptedDeleteFs implement `*_at` by discarding parent_fd and recording the leaf name so every emitter unit test keeps working without sandbox plumbing. New sandbox.rs test module exercises each `*_at` variant against a live tempdir, the recursive peel's symlink-swap resistance, and the sandbox-off / missing-plan-directory fallback paths. Promotes recursive_unlinkat(parent_dirfd, leaf) from a SEC-1.s internal helper to a pub entry point so engine can use it directly without synthesising absolute-path arguments. Receiver-deletion integration in crates/transfer/ deferred to a follow-up per design doc; the receiver loop does not yet route through DeleteEmitter.
oferchen
added a commit
that referenced
this pull request
May 22, 2026
…EC-1.q) (#4728) Extend DeleteFs with unix-only `*_at` siblings (unlink_file_at, rmdir_at, unlink_symlink_at, unlink_device_at, unlink_special_at, remove_dir_all_at) that take a parent dirfd + single-component leaf and route through fast_io::unlinkat / fast_io::recursive_unlinkat (SEC-1.s). Path-based methods stay as the no-sandbox / Windows fallback so existing callers keep working unchanged. Closes the six GAP sites in crates/engine/src/delete/emitter/fs.rs from PR #4710 audit section 4 (#22-#27) by giving RealDeleteFs a dirfd- anchored dispatch shape. Adds DeleteEmitter::with_sandbox carrier slot that opens a per-plan dirfd via DirSandbox::root_dirfd just before dispatch so a mid-syscall symlink swap on the parent walk cannot redirect the call. Plan-directory open failure transparently falls back to the path-based methods so the drain stays compatible. RecordingDeleteFs and ScriptedDeleteFs implement `*_at` by discarding parent_fd and recording the leaf name so every emitter unit test keeps working without sandbox plumbing. New sandbox.rs test module exercises each `*_at` variant against a live tempdir, the recursive peel's symlink-swap resistance, and the sandbox-off / missing-plan-directory fallback paths. Promotes recursive_unlinkat(parent_dirfd, leaf) from a SEC-1.s internal helper to a pub entry point so engine can use it directly without synthesising absolute-path arguments. Receiver-deletion integration in crates/transfer/ deferred to a follow-up per design doc; the receiver loop does not yet route through DeleteEmitter.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…vey (#4710) Catalogue daemon-reachable path-syscall sites after the SEC-1 *at* chain shipped helpers for unlinkat/mkdirat/symlinkat/linkat/fchmodat/fchownat/ utimensat/renameat/lstat. Splits the surface into COVERED (11 routed through fast_io helpers), DEFERRED (15 documented in mknodat / receiver- wiring closure docs), and GAP (27 not previously catalogued). GAPs cluster into three follow-up tracks: delete emitter trait refactor (6 sites), temp-file sandbox plumbing (5 sites), and basis/inplace open helper plus readlinkat helper (16 sites). One residual (multi-component create_dir_all fallback) is documented as accepted under SEC-1.h. Two new helpers plus the DeleteFs trait shape change close 22 of 27 GAPs. Complements docs/audits/sec-1-a-path-syscall-surface-2026-05-20.md (discovery audit, pre-mitigation) by providing the post-chain coverage view.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Opens SEC-1.q to track the DeleteFs trait-shape refactor that closes the six daemon-reachable path-based unlink/rmdir GAPs in RealDeleteFs identified by PR #4710's post-chain coverage audit. Documents the deferral rationale from SEC-1.g, sketches the parent-dirfd-bearing trait extension and recursive peel helper, and records the re-open triggers so the cleanup is tracked alongside SEC-1.r and SEC-1.s.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
#4716) Adds four new SEC-1 helpers in `fast_io::dir_sandbox::at_syscalls`: - `openat(dirfd, name, flags, mode) -> File` raw libc wrapper. - `openat_via_sandbox_or_fallback(...)` adaptor that takes the sandbox fast path on a single-component leaf beneath `dest_dir` and falls back to `std::fs::OpenOptions` against `link_path` with best-effort `O_*` bit translation otherwise. - `readlinkat(dirfd, name) -> PathBuf` raw libc wrapper with a growing buffer (256B -> PATH_MAX, doubling each round trip). - `readlinkat_via_sandbox_or_fallback(...)` adaptor mirroring the openat shape but falling back to `std::fs::read_link`. The helpers follow the established SEC-1 pattern: pinning the parent via the sandbox dirfd closes the TOCTOU window between path walk and the kernel reaching the inode. The `*_via_sandbox_or_fallback` adaptors keep behaviour byte-identical for callers that have not yet plumbed a `DirSandbox`, so individual call sites can be cut over one at a time. This PR adds the helpers and re-exports them through `dir_sandbox::mod` and `fast_io::lib`. It deliberately does NOT wire any caller; per-site wiring lands in follow-up PRs so each cutover gets its own diff and review. Extends the existing tests module with 10 new tests covering: - raw `openat` success and ENOENT, - `openat_via_sandbox_or_fallback` fast path, multi-component fallback, and absent-sandbox fallback, - raw `readlinkat` success and EINVAL on a non-symlink, - `readlinkat_via_sandbox_or_fallback` fast path, EINVAL, and multi-component fallback. All helpers are `#[cfg(unix)]` (the `dir_sandbox` module is itself Unix-only); Windows continues to use path-based stdlib opens per the SEC-1.l NTFS handle audit. Closes (post-wire) 16+ GAPs from the SEC-1 path-syscall coverage audit in PR #4710: #4 (readlinkat) plus the 9 direct openat sites (#9-#17) and lays foundations for #5, #20 (open + readdir-loop) and #6, #27 (recursive *at peel). Refs PR #4710.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…C-1.q (#4724) Opens SEC-1.s to track the recursive_unlinkat_via_sandbox_or_fallback helper called out by SEC-1.q (PR #4711) as the prerequisite for DeleteFs::remove_dir_all_at and by PR #4710's GAP row #27 as the missing Carrier piece for the --delete recursive fallback. Documents the proposed signature mirroring the existing *_via_sandbox_or_fallback family, the openat/fdopendir/readdir + fstatat-classify + unlinkat peel algorithm, cycle detection via (dev, ino) tracking, TOCTOU race handling for file-vs-dir swaps, fallback to std::fs::remove_dir_all when the sandbox is absent, upstream-equivalent error semantics from delete.c:48-176, the cross-platform plan, an 8-case test plan, an ~480 LoC effort estimate, and a three-step dispatch sequence keeping each PR self-contained. Docs-only: no implementation in this PR.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…EC-1.q) (#4728) Extend DeleteFs with unix-only `*_at` siblings (unlink_file_at, rmdir_at, unlink_symlink_at, unlink_device_at, unlink_special_at, remove_dir_all_at) that take a parent dirfd + single-component leaf and route through fast_io::unlinkat / fast_io::recursive_unlinkat (SEC-1.s). Path-based methods stay as the no-sandbox / Windows fallback so existing callers keep working unchanged. Closes the six GAP sites in crates/engine/src/delete/emitter/fs.rs from PR #4710 audit section 4 (#22-#27) by giving RealDeleteFs a dirfd- anchored dispatch shape. Adds DeleteEmitter::with_sandbox carrier slot that opens a per-plan dirfd via DirSandbox::root_dirfd just before dispatch so a mid-syscall symlink swap on the parent walk cannot redirect the call. Plan-directory open failure transparently falls back to the path-based methods so the drain stays compatible. RecordingDeleteFs and ScriptedDeleteFs implement `*_at` by discarding parent_fd and recording the leaf name so every emitter unit test keeps working without sandbox plumbing. New sandbox.rs test module exercises each `*_at` variant against a live tempdir, the recursive peel's symlink-swap resistance, and the sandbox-off / missing-plan-directory fallback paths. Promotes recursive_unlinkat(parent_dirfd, leaf) from a SEC-1.s internal helper to a pub entry point so engine can use it directly without synthesising absolute-path arguments. Receiver-deletion integration in crates/transfer/ deferred to a follow-up per design doc; the receiver loop does not yet route through DeleteEmitter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fast_io::*_via_sandbox_or_fallback), 15 DEFERRED sites (documented in existing SEC-1.h/.i/.j closure docs), and 27 previously-uncatalogued GAPs.create_dir_allfallback whenmkdiratreturns ENOENT).openat_via_sandbox_or_fallback,readlinkat_via_sandbox_or_fallback) plus theDeleteFstrait shape change close 22 of 27 GAPs.Test plan
git statusshows the new audit file only.