Skip to content

Commit

Permalink
Reallow user@-arg... in prepare_invocation
Browse files Browse the repository at this point in the history
Since the `user@` prefix makes it safe as gix-transport uses it,
and there are test cases specifying that it should be permitted.
  • Loading branch information
EliahKagan committed Apr 12, 2024
1 parent 4dda375 commit 2911623
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gix-transport/src/client/blocking_io/ssh/program_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl ProgramKind {

let host_maybe_with_user_as_ssh_arg = match (url.user_as_argument(), url.host_as_argument()) {
(Usable(user), Usable(host)) => format!("{user}@{host}"),
(Usable(user), Dangerous(host)) => format!("{user}@{host}"), // The `user@` makes it safe.
(Absent, Usable(host)) => host.into(),
(Dangerous(user), _) => Err(ssh::invocation::Error::AmbiguousUserName { user: user.into() })?,
(_, Dangerous(host)) => Err(ssh::invocation::Error::AmbiguousHostName { host: host.into() })?,
Expand Down

0 comments on commit 2911623

Please sign in to comment.