MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / build_proxy_command

Function build_proxy_command

crates/openshell-core/src/forward.rs:786–801  ·  view source on GitHub ↗

Build the SSH `ProxyCommand` string used to tunnel to a sandbox. Every interpolated argument is shell-escaped so that server-supplied values (gateway URL, sandbox id, token, gateway name) cannot inject shell metacharacters into the command that OpenSSH executes via `/bin/sh -c`.

(
    exe: &str,
    gateway_url: &str,
    sandbox_id: &str,
    token: &str,
    gateway_name: &str,
)

Source from the content-addressed store, hash-verified

784/// (gateway URL, sandbox id, token, gateway name) cannot inject shell
785/// metacharacters into the command that OpenSSH executes via `/bin/sh -c`.
786pub fn build_proxy_command(
787 exe: &str,
788 gateway_url: &str,
789 sandbox_id: &str,
790 token: &str,
791 gateway_name: &str,
792) -> String {
793 format!(
794 "{} ssh-proxy --gateway {} --sandbox-id {} --token {} --gateway-name {}",
795 shell_escape(exe),
796 shell_escape(gateway_url),
797 shell_escape(sandbox_id),
798 shell_escape(token),
799 shell_escape(gateway_name),
800 )
801}
802
803/// Error returned when a `CreateSshSessionResponse` fails validation.
804///

Calls

no outgoing calls