Skip to content

feat(transfer): wire renameat sandbox into deferred SEC-1.j receiver callers#4697

Open
oferchen wants to merge 1 commit into
masterfrom
feat/transfer-sec-1-j-receiver-wiring-followup
Open

feat(transfer): wire renameat sandbox into deferred SEC-1.j receiver callers#4697
oferchen wants to merge 1 commit into
masterfrom
feat/transfer-sec-1-j-receiver-wiring-followup

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

Follow-up to SEC-1.j (#4693). Wires fast_io::renameat_via_sandbox_or_fallback into the synchronous transfer_ops::process_file_response temp -> final rename, matching the pattern already shipped in receiver/transfer/sync.rs. The io_uring fast path is preserved; only the path-based fallback gains the sandbox routing. Adds a dest_dir anchor to ResponseContext so the SEC-1.j single-component leaf detector has the anchor it needs.

Deferred site status

  • transfer_ops/response.rs - WIRED (response.rs:284-330). ResponseContext now carries dest_dir alongside the existing sandbox carrier; sole builder at pipeline.rs:297-303 populates it from setup.dest_dir.
  • disk_commit/process.rs - DEFERRED. DiskCommitConfig and BackupConfig are owned (Clone + Debug) configs sent across the network -> disk thread boundary. Threading a DirSandbox reference requires wrapping it in Arc<DirSandbox> (or similar shareable form) and plumbing it through the message types. TODO markers added near rename_with_io_uring_fallback and make_backup.
  • engine/.../guard.rs - DEFERRED. DestinationWriteGuard lives in the engine crate. Threading sandbox to commit_named_temp_file requires a cross-crate API change on DestinationWriteGuard::new and its local-copy callers. TODO marker added on the commit fn.

Cross-platform

All sandbox plumbing is #[cfg(unix)]. Windows continues to use the path-based std::fs::rename via #[cfg(not(unix))], matching the SEC-1.l audit guidance.

Test plan

  • CI fmt + clippy
  • CI nextest (stable) - linux, macOS, Windows
  • CI musl
  • Interop validation (sandbox routing is a defense-in-depth wrapper; rename semantics unchanged when sandbox is None or paths are multi-component)

…callers

Wires `renameat_via_sandbox_or_fallback` into the synchronous
`process_file_response` temp -> final commit by adding a `dest_dir`
anchor to `ResponseContext` so the SEC-1.j leaf detector can resolve
single-component renames through the sandbox dirfd, matching the
pattern already shipped in `receiver/transfer/sync.rs`. The io_uring
fast path is preserved; only the path-based fallback gains the
sandbox routing.

The remaining deferred sites (`disk_commit/process.rs` temp-rename and
backup-rename, `engine/.../guard.rs` local-copy commit) require
carrier plumbing across the cross-thread message boundary or a
cross-crate API change; left as `TODO` comments at the rename call
sites with the specific blocker noted.

Windows falls through to the path-based stdlib via `#[cfg(not(unix))]`,
matching the existing SEC-1.l audit guidance.
@github-actions github-actions Bot added the enhancement New feature or request label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant