Skip to content

Allow remote resolver terminals before workspace trust - #329228

Draft
joshspicer wants to merge 2 commits into
mainfrom
joshspicer-resolver-terminal-trust
Draft

Allow remote resolver terminals before workspace trust#329228
joshspicer wants to merge 2 commits into
mainfrom
joshspicer-resolver-terminal-trust

Conversation

@joshspicer

@joshspicer joshspicer commented Aug 5, 2026

Copy link
Copy Markdown
Member

Fixes #328475.

Related duplicate: microsoft/vscode-remote-release#11613.

Summary

Add a narrowly scoped proposed TerminalOptions.isRemoteResolverTerminal option for the local, hidden terminal a remote authority resolver uses to bootstrap its connection. The option is validated against the calling extension's terminalRemoteResolver proposal before it crosses the extension-host RPC boundary.

The main thread converts the validated DTO boolean into an internal unique-symbol marker, so command arguments, serialized launch configurations, and revived terminals cannot forge or persist it. TerminalInstance consumes the marker and skips only the workspace-trust request for terminal process creation when all resolver-bootstrap constraints hold:

  • the window is resolving a remote authority;
  • workspace trust initialization is still pending;
  • the terminal has an explicit local file: URI cwd;
  • the terminal is hidden and transient; and
  • the terminal process is local.

The workspace is not marked trusted and all other Restricted Mode behavior remains unchanged. Ordinary local terminals in untrusted remote workspaces continue to wait for workspace trust, preserving #316312. Trust denial now returns before backend process creation.

The terminal service also recognizes a local file URI supplied inside an API launch config before waiting for remote terminal profiles. Without this, the resolver bootstrap terminal could stall before reaching the trust gate.

Why not the alternatives?

  • Extending Remote-SSH's no-output timeout only waits longer for a process that has not started; it does not fix the ordering dependency.
  • Flipping the Windows remote.SSH.useLocalServer default changes the connection architecture and compatibility surface rather than fixing the hidden-terminal path.
  • Reverting Enforce terminal trust for local terminals in remote workspaces #316312 would broadly allow ordinary local terminals to execute in untrusted remote workspaces, weakening the intended security boundary.

Security

The bypass is proposal-only and explicitly named for remote resolver bootstrap terminals. It authorizes only creation of the constrained local terminal process and is temporally limited to remote workspace-trust initialization.

Workspace-scoped terminal profile, cwd, automation profile, and terminal.integrated.env.* settings are restricted settings, so untrusted workspace values are not applied to this path. Proposal-enabled resolver extensions remain responsible for ensuring the bootstrap executable, arguments, environment, and local cwd are not derived from untrusted workspace content.

Extension adoption

Remote-SSH adoption draft: microsoft/vscode-remote-ssh#660.

An adopting extension should:

  1. Add terminalRemoteResolver to enabledApiProposals.
  2. Set isRemoteResolverTerminal only on the resolver bootstrap terminal in ssh-command-runner.ts.
  3. Pass local user home as an explicit local file URI and keep the terminal hidden and transient.
  4. Leave all normal terminals unchanged.
const terminal = vscode.window.createTerminal({
	name: `SSH: ${hostname}`,
	shellPath: sshPath,
	shellArgs: sshArgs,
	cwd: vscode.Uri.file(localUserHome),
	hideFromUser: true,
	isTransient: true,
	isRemoteResolverTerminal: true,
});
{
  "enabledApiProposals": [
    "resolvers",
    "terminalRemoteResolver"
  ]
}

Validation

  • ./scripts/test.sh --run src/vs/workbench/api/test/browser/extHost.api.impl.test.ts --run src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts --run src/vs/workbench/contrib/terminal/test/browser/terminalService.test.ts
  • npm run typecheck-client

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 907702b2-eba4-43b0-9fca-eb56c92d0443
Copilot AI balanced review requested due to automatic review settings August 5, 2026 17:58
@joshspicer
joshspicer marked this pull request as draft August 5, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a proposal-gated terminal option allowing Remote-SSH bootstrap terminals to start before workspace trust resolves without changing workspace trust itself.

Changes:

  • Defines and validates isRemoteResolverTerminal.
  • Propagates and consumes the marker before process creation.
  • Tests proposal enforcement, trust bypass, and ordinary terminal behavior.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.terminalRemoteResolver.d.ts Defines the proposed option.
src/vs/platform/extensions/common/extensionsApiProposals.ts Registers the proposal.
src/vs/platform/terminal/common/terminal.ts Adds the internal launch marker.
src/vs/workbench/api/common/extHost.api.impl.ts Validates proposal access.
src/vs/workbench/api/common/extHostTerminalService.ts Adds the marker to launch DTOs.
src/vs/workbench/api/common/extHost.protocol.ts Extends the terminal protocol.
src/vs/workbench/api/browser/mainThreadTerminalService.ts Transfers the marker into launch configuration.
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Consumes the marker and bypasses only the trust request.
src/vs/workbench/api/test/browser/extHost.api.impl.test.ts Tests proposal validation.
src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts Tests trust and process-creation behavior.

Review details

  • Files reviewed: 9/10 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 907702b2-eba4-43b0-9fca-eb56c92d0443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening recent SSH remote folder fails to connect

2 participants