Skip to content

fix: preserve --groupmap wildcards through daemon arg escape - #5531

Merged
oferchen merged 2 commits into
masterfrom
fix/uts-8-groupmap-wildcard
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/uts-8-groupmap-wildcard

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Forward --usermap and --groupmap as --key=value arguments from both the SSH and daemon argument builders. They were previously dropped on the client side, so the receiver never applied the mapping.
  • Preserve the original specification string on NameMapping / UserMapping / GroupMapping via a new spec() accessor so the wildcard * reaches the upstream uidlist.c:parse_name_map() parser intact.
  • Under the secluded-args wire format the value travels verbatim, matching upstream's behaviour when protect_args is active and options.c:safe_arg() skips shell escaping.

Test plan

  • CI: nextest (stable) Linux musl, Windows, macOS
  • CI: fmt + clippy
  • Unit: crates/metadata/src/mapping/tests.rs round-trip the spec accessor with *:1234 and multi-rule specs.
  • Unit: crates/core/src/client/remote/daemon_transfer/orchestration/tests.rs verifies --groupmap=*:1234 and --usermap=*:5678 are emitted verbatim by build_full_daemon_args and survive the secluded-args wire round-trip.
  • Unit: crates/core/src/client/remote/invocation/tests.rs verifies the SSH arg builder forwards the wildcard spec without escaping.

The daemon and SSH client argument builders did not forward `--usermap`
or `--groupmap` to the remote server. Mappings configured on the client
were silently dropped, so wildcard specs like `--groupmap=*:1234` had
no effect on the receiver.

Forward both options as `--key=value` arguments alongside `--iconv` and
the other long-form forwards. Under the secluded-args wire format the
value travels verbatim, so the `*` wildcard reaches the upstream
`uidlist.c:parse_name_map()` parser intact (matching upstream's behavior
when `protect_args` is active and `safe_arg()` skips shell escaping).

Preserve the original specification string on `NameMapping` /
`UserMapping` / `GroupMapping` via a new `spec()` accessor. Recomposing
from the parsed rule list would be lossy because the rules vector does
not carry the source token.

Add round-trip tests covering the daemon arg builder, SSH arg builder,
the secluded-args wire format, and the mapping spec accessors.
@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026
@oferchen
oferchen merged commit c93e740 into master Jun 10, 2026
68 checks passed
@oferchen
oferchen deleted the fix/uts-8-groupmap-wildcard branch June 10, 2026 11:13
@oferchen
oferchen restored the fix/uts-8-groupmap-wildcard branch June 11, 2026 20:16
@oferchen
oferchen deleted the fix/uts-8-groupmap-wildcard branch June 11, 2026 20:18
@oferchen
oferchen restored the fix/uts-8-groupmap-wildcard branch June 11, 2026 20:18
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix: preserve --groupmap wildcards through daemon arg escape

The daemon and SSH client argument builders did not forward `--usermap`
or `--groupmap` to the remote server. Mappings configured on the client
were silently dropped, so wildcard specs like `--groupmap=*:1234` had
no effect on the receiver.

Forward both options as `--key=value` arguments alongside `--iconv` and
the other long-form forwards. Under the secluded-args wire format the
value travels verbatim, so the `*` wildcard reaches the upstream
`uidlist.c:parse_name_map()` parser intact (matching upstream's behavior
when `protect_args` is active and `safe_arg()` skips shell escaping).

Preserve the original specification string on `NameMapping` /
`UserMapping` / `GroupMapping` via a new `spec()` accessor. Recomposing
from the parsed rule list would be lossy because the rules vector does
not carry the source token.

Add round-trip tests covering the daemon arg builder, SSH arg builder,
the secluded-args wire format, and the mapping spec accessors.

* style: collapse short builder chains to satisfy rustfmt
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