Skip to content

docs(windows): audit path normalization#3429

Merged
oferchen merged 1 commit into
masterfrom
docs/windows-path-normalization-audit
Apr 29, 2026
Merged

docs(windows): audit path normalization#3429
oferchen merged 1 commit into
masterfrom
docs/windows-path-normalization-audit

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

Static-analysis audit of how oc-rsync handles Windows path inputs at every entry point: CLI parsing, flist encode/decode, daemon sanitization, local-copy planning, and symlink safety. Tracks task #1842.

Documents one HIGH-severity bug, one MEDIUM, three LOW, and one INFORMATIONAL finding.

Path-Form Map

The audit tabulates the 12 path forms a Windows user can pass on the command line and traces each through CLI parse -> wire bytes -> receiver decode -> on-disk result, comparing against upstream rsync 3.4.1's Cygwin behaviour. Forms covered:

  • Drive-letter absolute (C:\foo\bar) and drive-relative (C:foo\bar)
  • UNC (\\server\share\foo) and verbatim long-path (\\?\C:\foo, \\?\UNC\server\share)
  • Mixed-slash drive-letter (C:/foo/bar)
  • Cygwin (/cygdrive/c/foo) and MSYS (/c/foo) - oc-rsync is native Win32, so these are NOT translated.
  • Relative with backslash (foo\bar\baz) and forward slash (foo/bar/baz)
  • Trailing dot, DOS reserved names, single-colon SSH, drive-letter alone (C:)

Findings

# Severity Subject
F1 HIGH Backslash leaks into wire-encoded filenames on Windows -> Linux push
F2 MEDIUM transfer_role::operand_is_remote duplicates engine::local_copy::operand_is_remote and lacks \\?\ extended-prefix detection
F3 LOW Symlink safety checks only POSIX-style absolute paths
F4 LOW name_bytes() non-Unix branch performs UTF-8 lossy round-trip
F5 LOW strip_leading_slashes non-Unix branch uses to_string_lossy
F6 INFO Trailing dots, spaces, DOS reserved names forwarded verbatim (matches upstream)

In-PR Fix

None - this is an audit-only PR. The HIGH-severity finding F1 requires a wire-format change with new golden-byte tests and is filed as a follow-up. The audit document includes the full follow-up task list with severity ratings and concrete fix directions.

Test plan

  • cargo fmt --all (no code changes)
  • CI fmt+clippy
  • CI nextest (stable)
  • CI Windows / macOS / Linux musl

Closes nothing yet; tracks #1842 with follow-ups.

Static analysis of every entry point that consumes or emits a path on
Windows: CLI parsing, flist encode/decode, daemon sanitization, local-
copy planning, and symlink safety. Compares against upstream rsync
3.4.1 (Cygwin build) and identifies one high-severity correctness bug
(F1: backslash leaks into wire-encoded filenames) plus four lower-
severity gaps. Audit-only commit; F1 fix is filed as a follow-up
because it requires a wire-format change with dedicated golden tests.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 29, 2026
@oferchen oferchen merged commit 27789dc into master Apr 29, 2026
12 checks passed
@oferchen oferchen deleted the docs/windows-path-normalization-audit branch April 29, 2026 10:21
oferchen added a commit that referenced this pull request May 1, 2026
Static analysis of every entry point that consumes or emits a path on
Windows: CLI parsing, flist encode/decode, daemon sanitization, local-
copy planning, and symlink safety. Compares against upstream rsync
3.4.1 (Cygwin build) and identifies one high-severity correctness bug
(F1: backslash leaks into wire-encoded filenames) plus four lower-
severity gaps. Audit-only commit; F1 fix is filed as a follow-up
because it requires a wire-format change with dedicated golden tests.
oferchen added a commit that referenced this pull request May 5, 2026
Static analysis of every entry point that consumes or emits a path on
Windows: CLI parsing, flist encode/decode, daemon sanitization, local-
copy planning, and symlink safety. Compares against upstream rsync
3.4.1 (Cygwin build) and identifies one high-severity correctness bug
(F1: backslash leaks into wire-encoded filenames) plus four lower-
severity gaps. Audit-only commit; F1 fix is filed as a follow-up
because it requires a wire-format change with dedicated golden tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant