Skip to content

fix(ssh): keep session tokens out of OpenSSH process arguments - #5826

Draft
alangou wants to merge 7 commits into
ai-openshell:mainfrom
alangou:fix/ssh-session-handoff/alangou
Draft

alangou wants to merge 7 commits into
ai-openshell:mainfrom
alangou:fix/ssh-session-handoff/alangou

Conversation

@alangou

@alangou alangou commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Keep SSH session credentials out of the process arguments used for sandbox connections, file transfers and port forwards.

What changed

The invoking CLI or TUI requests the session using its existing gateway client. OpenSSH receives a one-use local handle. The proxy reads the grant over a same-account Unix socket or Windows named pipe and uses it to open the authenticated relay. The issuer attempts revocation after relay admission, failed handoff or cancellation. File operations keep the selected sandbox identity across retries and across uploads in one create request. Existing name-based OpenSSH configuration continues to work.

Scope

An explicit --gateway now takes precedence over OPENSHELL_GATEWAY_ENDPOINT inherited from the environment. A deliberately supplied endpoint override remains available. Regenerate custom proxy commands that passed the old hidden --token option. On Unix the proxy checks the account of the socket peer and the issuer PID. The Windows named pipe restricts access to the issuing account. Revocation is best effort if the issuer dies or the gateway is unavailable.

Verification

  • Ran CLI, core, TUI, forwarding and proxy tests. Verified all 13 Cargo workspaces resolve their checked-in dependencies with --locked.
  • Compared the base and patched binaries against the same local mTLS gateway with OpenSSH. Inspected the arguments of both OpenSSH and its proxy against the actual session values. The base exposed the values and the patched processes did not.
  • Exercised interactive attach, saved SSH configuration, binary upload/download and simultaneous foreground/background forwards. Stopping one forward left the other usable.
  • On Linux, a different account knowing the handle received zero bytes. The Unix backend also compiled for Apple Silicon, and the named-pipe backend compiled for both x64 and ARM64 Windows. Native macOS and Windows execution were not covered.

Signed-off-by: Adrien Langou <alangou@nvidia.com>
Signed-off-by: Adrien Langou <alangou@nvidia.com>
Signed-off-by: Adrien Langou <alangou@nvidia.com>
Signed-off-by: Adrien Langou <alangou@nvidia.com>
@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 20, 2026
Signed-off-by: Adrien Langou <alangou@nvidia.com>
Signed-off-by: Adrien Langou <alangou@nvidia.com>
Signed-off-by: Adrien Langou <alangou@nvidia.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant