Skip to content

feat(metadata): wire --acls to Windows DACL (#2310) - #4388

Merged
oferchen merged 1 commit into
masterfrom
feat/windows-acls-cli-wiring
May 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/windows-acls-cli-wiring

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Routes the Windows --acls apply path through acl_windows::read_dacl_sddl / write_dacl_sddl (WAS-2/3, feat(metadata): Windows DACL/SACL SDDL round-trip (#2307, #2308) #4354) so DACL preservation rides the full SDDL fidelity payload instead of re-encoding only the named ACEs.
  • Reserves user.win32.security_descriptor (matches Samba's NT-ACL slot) inside the existing xattr stream as the carrier for the SDDL string - no wire-protocol changes.
  • Generator (crates/transfer/src/generator/file_list/entry.rs): when --acls is on and built with feature = "acl" on Windows, appends metadata::sddl_xattr_entry(path) to the per-entry XattrList.
  • Receiver (crates/metadata/src/xattr.rs::apply_xattrs_from_list): intercepts the reserved slot. On Windows dispatches to apply_sddl_from_xattrs -> write_dacl_sddl; on POSIX silently drops it so the standard cross-platform ACL payload (from crates/protocol/src/acl/wire) still drives the lowered POSIX bits via WAS-4 (feat(metadata): DACL <-> POSIX permission bit mapping (#2309) #4361) dacl_to_posix_mode.
  • Local Windows-to-Windows sync_acls now prefers the SDDL round-trip and falls back to the lossy named-ACE encoder only on volumes that refuse to serve a descriptor (FAT32, network mounts).
  • Brings the WAS-4 dacl_to_posix_mode / posix_mode_to_dacl helpers in alongside the WAS-5 wiring so the dispatch shape is self-contained; this PR can land before or after feat(metadata): DACL <-> POSIX permission bit mapping (#2309) #4361 (overlapping definitions will fold cleanly).

Dispatch shape

generator (Windows + --acls)
  -> metadata::sddl_xattr_entry(path)              // WAS-5
       -> acl_windows::read_dacl_sddl(path)        // WAS-2/3
       -> XattrEntry { name = "user.win32.security_descriptor", value = SDDL }
  -> XattrList.push, sort_by_name, set_xattr_list

receiver (Windows)
  apply_xattrs_from_list(dest, list)
    -> acl_windows::apply_sddl_from_xattrs(dest, list)        // WAS-5
         -> acl_windows::find_sddl_in_xattrs(list)            // WAS-5
         -> acl_windows::write_dacl_sddl(dest, sddl)          // WAS-2/3
    -> skip the reserved slot in the per-attribute write loop

receiver (POSIX)
  apply_xattrs_from_list(dest, list)
    -> skip the reserved slot (handled at higher layer via
       acl_exacl::apply_acls_from_cache reading the cross-platform
       RsyncAcl payload, with acl_windows::dacl_to_posix_mode
       available for the design-doc 5.1 lowering)

Test plan

  • CI fmt + clippy across the workspace (already cargo fmt --all).
  • CI nextest stable on Linux, macOS, Windows, musl:
    • find_sddl_in_xattrs_returns_payload / _returns_none_when_missing / _skips_abbreviated_entries
    • apply_sddl_from_xattrs_no_payload_is_noop
    • round_trip_full_mode_matrix_preserves_rwx (0o000..=0o777 round-trip via WAS-4 helpers)
    • dacl_to_posix_mode_* set (Everyone, Authenticated Users fallback, deny drop, inherited drop, non-rwx collapse)
  • CI nextest Windows-only on windows-latest (NTFS):
    • sddl_xattr_entry_round_trips_on_ntfs (seed -> encode -> apply -> read-back)
    • sync_acls_prefers_sddl_round_trip
    • Existing write_dacl_sddl_round_trips_known_descriptor still passes (regression guard).

@oferchen
oferchen force-pushed the feat/windows-acls-cli-wiring branch from fcd3ef0 to 63e619a Compare May 18, 2026 00:11
@github-actions github-actions Bot added the enhancement New feature or request label May 18, 2026
oferchen added a commit that referenced this pull request May 18, 2026
…AS-7 #2312)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
@oferchen
oferchen force-pushed the feat/windows-acls-cli-wiring branch from 63e619a to 7553de3 Compare May 18, 2026 00:57
oferchen added a commit that referenced this pull request May 18, 2026
…AS-7 #2312)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
oferchen added a commit that referenced this pull request May 18, 2026
…AS-7 #2312) (#4420)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
@oferchen
oferchen force-pushed the feat/windows-acls-cli-wiring branch 2 times, most recently from 3125751 to 15ebf05 Compare May 18, 2026 01:19
Routes the `--acls` apply path through `acl_windows::read_dacl_sddl` /
`write_dacl_sddl` on Windows so DACL preservation rides the SDDL
fidelity payload from WAS-2/3 (#4354) instead of re-encoding only the
named ACEs. Cross-platform interop keeps the WAS-4 (#4361)
`dacl_to_posix_mode` and `posix_mode_to_dacl` helpers as the lossy
fall-back when one peer is POSIX.

Wire format reserves `user.win32.security_descriptor` (matches Samba's
NT-ACL slot on Linux backends) inside the existing xattr stream. The
sender appends an `XattrEntry` with the source's SDDL via
`metadata::sddl_xattr_entry`; the receiver consumes it in
`apply_xattrs_from_list`, dispatching to `write_dacl_sddl` on Windows
and silently dropping the slot on POSIX so the cross-platform rsync
ACL payload from `crates/protocol/src/acl/wire` still drives the
lowered POSIX bits. Local Windows-to-Windows `sync_acls` likewise
prefers the SDDL round-trip and falls back to the named-ACE encoder
only on volumes that refuse to serve a descriptor (FAT32, network
mounts).

Tests cover the new helpers on every platform and round-trip a custom
DACL through a Windows tempdir under `#[cfg(windows)]` so the new
dispatch shape is exercised end-to-end on `windows-latest` nextest.
@oferchen
oferchen force-pushed the feat/windows-acls-cli-wiring branch from 15ebf05 to e983ec4 Compare May 18, 2026 01:24
@oferchen
oferchen merged commit a7afc99 into master May 18, 2026
3 of 8 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
…AS-7 #2312) (#4420)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
oferchen added a commit that referenced this pull request May 18, 2026
Routes the `--acls` apply path through `acl_windows::read_dacl_sddl` /
`write_dacl_sddl` on Windows so DACL preservation rides the SDDL
fidelity payload from WAS-2/3 (#4354) instead of re-encoding only the
named ACEs. Cross-platform interop keeps the WAS-4 (#4361)
`dacl_to_posix_mode` and `posix_mode_to_dacl` helpers as the lossy
fall-back when one peer is POSIX.

Wire format reserves `user.win32.security_descriptor` (matches Samba's
NT-ACL slot on Linux backends) inside the existing xattr stream. The
sender appends an `XattrEntry` with the source's SDDL via
`metadata::sddl_xattr_entry`; the receiver consumes it in
`apply_xattrs_from_list`, dispatching to `write_dacl_sddl` on Windows
and silently dropping the slot on POSIX so the cross-platform rsync
ACL payload from `crates/protocol/src/acl/wire` still drives the
lowered POSIX bits. Local Windows-to-Windows `sync_acls` likewise
prefers the SDDL round-trip and falls back to the named-ACE encoder
only on volumes that refuse to serve a descriptor (FAT32, network
mounts).

Tests cover the new helpers on every platform and round-trip a custom
DACL through a Windows tempdir under `#[cfg(windows)]` so the new
dispatch shape is exercised end-to-end on `windows-latest` nextest.
oferchen added a commit that referenced this pull request May 18, 2026
…AS-7 #2312) (#4420)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
oferchen added a commit that referenced this pull request May 18, 2026
Routes the `--acls` apply path through `acl_windows::read_dacl_sddl` /
`write_dacl_sddl` on Windows so DACL preservation rides the SDDL
fidelity payload from WAS-2/3 (#4354) instead of re-encoding only the
named ACEs. Cross-platform interop keeps the WAS-4 (#4361)
`dacl_to_posix_mode` and `posix_mode_to_dacl` helpers as the lossy
fall-back when one peer is POSIX.

Wire format reserves `user.win32.security_descriptor` (matches Samba's
NT-ACL slot on Linux backends) inside the existing xattr stream. The
sender appends an `XattrEntry` with the source's SDDL via
`metadata::sddl_xattr_entry`; the receiver consumes it in
`apply_xattrs_from_list`, dispatching to `write_dacl_sddl` on Windows
and silently dropping the slot on POSIX so the cross-platform rsync
ACL payload from `crates/protocol/src/acl/wire` still drives the
lowered POSIX bits. Local Windows-to-Windows `sync_acls` likewise
prefers the SDDL round-trip and falls back to the named-ACE encoder
only on volumes that refuse to serve a descriptor (FAT32, network
mounts).

Tests cover the new helpers on every platform and round-trip a custom
DACL through a Windows tempdir under `#[cfg(windows)]` so the new
dispatch shape is exercised end-to-end on `windows-latest` nextest.
@oferchen
oferchen deleted the feat/windows-acls-cli-wiring branch May 19, 2026 15:09
oferchen added a commit that referenced this pull request Aug 24, 2026
…AS-7 #2312) (#4420)

Adds crates/metadata/tests/windows_to_linux_acl_roundtrip.rs covering
the receiver-side apply_xattrs_from_list dispatch for the reserved
user.win32.security_descriptor xattr slot (WAS-5, PR #4388).

- simulated_windows_xattr_dropped_on_linux: hand-crafts an XattrEntry
  with the reserved name + two standard user.* slots, feeds it through
  apply_xattrs_from_list against a TempDir file, and tolerates both
  the WAS-5 strict-drop arm and the pre-WAS-5 verbatim-store fallback
  so the test does not flake against in-flight master.
- simulated_windows_xattr_applied_on_windows: cfg(target_os = windows),
  apply the reserved slot then read the DACL back via read_dacl_sddl.
- pure_posix_acl_roundtrip_unaffected_by_reserved_slot: standard
  user.* payload, no reserved slot; standard slots applied and the
  reserved name does not appear in the destination.

Sibling to the workspace-root tests/acl_windows_to_linux_roundtrip.rs
which pins the pure-mapping contract. This file exercises the xattr
application path, gated on feature = acl + feature = xattr, hermetic
via tempdir().
oferchen added a commit that referenced this pull request Aug 24, 2026
Routes the `--acls` apply path through `acl_windows::read_dacl_sddl` /
`write_dacl_sddl` on Windows so DACL preservation rides the SDDL
fidelity payload from WAS-2/3 (#4354) instead of re-encoding only the
named ACEs. Cross-platform interop keeps the WAS-4 (#4361)
`dacl_to_posix_mode` and `posix_mode_to_dacl` helpers as the lossy
fall-back when one peer is POSIX.

Wire format reserves `user.win32.security_descriptor` (matches Samba's
NT-ACL slot on Linux backends) inside the existing xattr stream. The
sender appends an `XattrEntry` with the source's SDDL via
`metadata::sddl_xattr_entry`; the receiver consumes it in
`apply_xattrs_from_list`, dispatching to `write_dacl_sddl` on Windows
and silently dropping the slot on POSIX so the cross-platform rsync
ACL payload from `crates/protocol/src/acl/wire` still drives the
lowered POSIX bits. Local Windows-to-Windows `sync_acls` likewise
prefers the SDDL round-trip and falls back to the named-ACE encoder
only on volumes that refuse to serve a descriptor (FAT32, network
mounts).

Tests cover the new helpers on every platform and round-trip a custom
DACL through a Windows tempdir under `#[cfg(windows)]` so the new
dispatch shape is exercised end-to-end on `windows-latest` nextest.
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