Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Linux/WSL2 sandbox: SSH & HTTPS git fail — credential files (~/.ssh, ~/.git-credentials) masked inside sandbox

Open iamhypernaut opened this issue 1 month ago • 2 comments

Before opening, please confirm:

Operating System

Ubuntu 24.04.3 LTS on WSL2 (kernel 6.6.87.2-microsoft-standard-WSL2)

Kiro Version

kiro-cli 2.34.0

Bug Description

In the local command sandbox on Linux/WSL2, credential paths (~/.ssh, ~/.git-credentials) are masked to empty inside the sandbox, so neither SSH nor HTTPS remote git can authenticate. The network/DNS path works — SSH reaches the host — but there is no key or stored credential available to authenticate with, and no sandbox.json / settings knob to allowlist a credential path. Result: no authenticated remote git (clone-from-remote, fetch, pull, push) works for a sandboxed agent on Linux/WSL2.

Steps to Reproduce

  1. sandbox.json: enabled: true, networkAccess: DEFAULT_ALLOWED, mcpSandboxing: false.
  2. Start a sandboxed agent session.
  3. ls -la ~/.ssh → directory appears empty despite keys existing on host.
  4. git ls-remote [email protected]:/.git HEAD → Permission denied (publickey) / Host key verification failed.
  5. git ls-remote https://bitbucket.org//.git HEAD → could not read Username ... No such device or address.

Expected Behavior

A sandboxed agent should be able to perform authenticated remote git (at minimum push its own feature branch) without the operator disabling the sandbox entirely.

Conversation ID

No response

Additional Context

Network path works; credential masking is the blocker

SSH reaches the server — it fails at auth, not at DNS resolution. The failure is purely that credential files are masked to empty / character-special devices inside the sandbox, so there is no key or stored credential to authenticate with.

SSH key is masked to empty:

$ ls -la ~/.ssh total 0 drwxr-xr-x 2 . drwxr-x--- 33 .. $ stat -c '%n %s %U' ~/.ssh/id_ed25519 stat: cannot statx '/home//.ssh/id_ed25519': No such file or directory

(The key file genuinely exists on the host — it is masked only inside the sandbox.)

SSH auth therefore fails (network reaches the server, auth has no key):

$ ssh -o StrictHostKeyChecking=accept-new -T [email protected] [email protected]: Permission denied (publickey). # exit 255 $ git ls-remote [email protected]:/.git HEAD Host key verification failed. fatal: Could not read from remote repository. # exit 128

HTTPS also fails — ~/.git-credentials is masked to a char-special device:

$ stat -c '%A %s %U' ~/.git-credentials crw-rw-rw- 0 nobody # real file on host is a normal 244-byte file $ git ls-remote https://bitbucket.org//.git HEAD fatal: could not read Username for 'https://bitbucket.org': No such device or address

iamhypernaut avatar Oct 27 '26 11:10 iamhypernaut

Thanks for the detailed report and the thorough debugging work — it's really helpful that you've pinpointed the issue to credential files being masked inside the sandbox rather than a network connectivity problem! We understand how important authenticated git access is for sandboxed agent workflows on Linux/WSL2. A maintainer will take a look at this soon, and we appreciate you taking the time to document the steps so clearly! 🙌

github-actions[bot] avatar Oct 27 '26 11:10 github-actions[bot]

Thanks for raising this. The sandbox on Linux/WSL2 appears to mask credential paths (~/.ssh, ~/.git-credentials) to empty or character-special devices, which prevents both SSH and HTTPS git authentication even though the network path is reachable. Marking this as a bug to investigate further.

AnilMaktala avatar Oct 27 '26 12:10 AnilMaktala