microsoft / microsoft/vscode-remote-release

Remote SSH: askpass socket path exceeds macOS 104-char Unix socket limit (regression in 0.123.0)

Open
#11,677 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Environment

  • VS Code: 1.123.0
  • Remote - SSH extension: 0.123.0
  • OS: macOS (Darwin 25.5.0)
  • Remote target: Linux (local network, SSH key with no passphrase)

Bug

The getIPCHandlePath("askpass", 20) function in the Remote SSH extension generates a Unix domain socket path that exceeds macOS's 104-character limit for sun_path in sockaddr_un.

The generated path follows this pattern:

${os.tmpdir()}/vscode-ssh-askpass-${randomBytes(20).toString('hex')}.sock

On macOS, os.tmpdir() returns a long path like:

/var/folders/h8/rh8crjd90y958tn9gmmd2h8m0000gp/T/

This results in a socket path of ~131 characters:

/var/folders/h8/rh8crjd90y958tn9gmmd2h8m0000gp/T/vscode-ssh-askpass-96e1eb7fc64181afe031df77e5f06e04161d4beb.sock

The socket silently fails to bind, causing the local server's /delay-shutdown keepalive requests to fail with EINVAL. After 3 failed attempts (at 2-second intervals), the connection is dropped:

Server delay-shutdown request failed: connect EINVAL /var/folders/h8/rh8crjd90y958tn9gmmd2h8m0000gp/T/vscode-ssh-askpass-8776ed6fc311016dd310b4d4a73aa8d0d9d352c2.sock - Local (undefined:undefined)

This causes constant reconnection loops.

Regression

This was not an issue before the 0.123.0 update (applied 2025-06-03). The remote.SSH.ipcSocketPath setting exists for the main IPC socket but does not apply to the askpass socket.

Suggested Fix

Either:

  1. Respect remote.SSH.ipcSocketPath for the askpass socket as well, or
  2. Reduce the random bytes from 20 (40 hex chars) to something shorter (e.g., 8 bytes / 16 hex chars), or
  3. On macOS, detect the path length and fall back to /tmp if it would exceed 104 characters

Workaround

Launch VS Code with TMPDIR=/tmp:

#!/bin/bash
export TMPDIR=/tmp
exec open -a "Visual Studio Code" "$@"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at getIPCHandlePath("askpass", 20) and trace how its generated path is used to bind and connect the Unix socket. Reproduce with a long macOS TMPDIR or the reported path, then verify that the askpass socket stays within the 104-character limit and that delay-shutdown requests no longer fail or trigger reconnection loops.

Written by the indexing model from the issue text.

Assessment

Domain
devtools, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.