Skip to content

fix: implement upstream 3.4.4 unbackslash_arg on non-protect_args daemon path (URV-2.a) - #5544

Merged
oferchen merged 2 commits into
masterfrom
fix/urv-2a-unbackslash-arg-non-protect
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/urv-2a-unbackslash-arg-non-protect

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Mirror upstream rsync 3.4.4's io.c:1295-1306 unbackslash_arg() and the new unescape parameter clientserver.c:1073 passes to the first read_args() call. Under non-protect daemon mode the client backslash-escapes shell and wildcard metacharacters via options.c:safe_arg(); without a matching unescape on the receiving side the daemon parses the literal \* token and loses the wildcard.
  • Daemon: add unbackslash_arg() and apply it to phase-1 option args (those preceding the . CWD marker) so a non-secluded client's escapes are reversed before option parsing, matching upstream io.c:1336-1359.
  • Client: route every phase-1 daemon arg through safe_arg_for_daemon(), splitting --key=value at the first = so option values get the WILD_CHARS+SHELL_CHARS escape and bare filename / module-path args get the SHELL_CHARS escape (mirroring options.c:safe_arg() exactly). The protect_args path is unchanged.

Test plan

  • CI: nextest (stable) Linux musl, Windows, macOS
  • CI: fmt + clippy
  • Unit (daemon): unbackslash_arg_collapses_backslash_escapes, unescape_phase1_option_args_stops_at_dot_marker, unescape_phase1_option_args_no_dot_marker_unescapes_all in crates/daemon/src/daemon/sections/module_access/tests.rs.
  • Unit (client): option_arg_round_trips_shell_meta_value (audit-cited --groupmap=*:1234;dangerous case), filename_arg_preserves_escaped_wildcard, option_arg_doubles_pre_escaped_wildcard, and the SHELL_CHARS / WILD_CHARS coverage tests in crates/core/src/client/remote/daemon_transfer/orchestration/arguments.rs.

Mirrors upstream rsync 3.4.4's io.c:1295-1306 unbackslash_arg() and the new
`unescape` parameter that clientserver.c:1073 passes to the first read_args()
call. Under non-protect_args daemon mode the client backslash-escapes shell
and wildcard metacharacters via options.c:safe_arg(); without a matching
unescape on the receiving side the daemon parses the literal `\*` token and
loses the wildcard. The protect_args path remains unaffected because the
secluded-args stream is not shell-evaluated.

- Daemon: add unbackslash_arg() and apply it to phase-1 option args (those
  preceding the `.` CWD marker) so a non-secluded client's escapes are
  reversed before option parsing, matching upstream io.c:1336-1359.
- Client: route every phase-1 daemon arg through safe_arg_for_daemon(),
  splitting `--key=value` at the first `=` so option values get the
  WILD_CHARS+SHELL_CHARS escape and bare filename / module-path args get
  the SHELL_CHARS escape (mirroring options.c:safe_arg() exactly).
- Tests cover the round-trip on both sides plus the audit-cited regression
  `--groupmap=*:1234;dangerous` and upstream's `\<wildcard>` preserve-as-is
  exception for filename args.
@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
@oferchen
oferchen merged commit 855b75a into master Jun 10, 2026
67 of 69 checks passed
@oferchen
oferchen deleted the fix/urv-2a-unbackslash-arg-non-protect branch June 10, 2026 11:13
oferchen added a commit that referenced this pull request Aug 24, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Aug 24, 2026
…mon path (URV-2.a) (#5544)

* fix: implement upstream 3.4.4 unbackslash_arg on non-protect daemon path

Mirrors upstream rsync 3.4.4's io.c:1295-1306 unbackslash_arg() and the new
`unescape` parameter that clientserver.c:1073 passes to the first read_args()
call. Under non-protect_args daemon mode the client backslash-escapes shell
and wildcard metacharacters via options.c:safe_arg(); without a matching
unescape on the receiving side the daemon parses the literal `\*` token and
loses the wildcard. The protect_args path remains unaffected because the
secluded-args stream is not shell-evaluated.

- Daemon: add unbackslash_arg() and apply it to phase-1 option args (those
  preceding the `.` CWD marker) so a non-secluded client's escapes are
  reversed before option parsing, matching upstream io.c:1336-1359.
- Client: route every phase-1 daemon arg through safe_arg_for_daemon(),
  splitting `--key=value` at the first `=` so option values get the
  WILD_CHARS+SHELL_CHARS escape and bare filename / module-path args get
  the SHELL_CHARS escape (mirroring options.c:safe_arg() exactly).
- Tests cover the round-trip on both sides plus the audit-cited regression
  `--groupmap=*:1234;dangerous` and upstream's `\<wildcard>` preserve-as-is
  exception for filename args.

* style: apply rustfmt to daemon transfer arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant