vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

CANNOT Disable Credential Forwarding Git GnuPG SSH

Open desmond-rhodes opened this issue 6 months ago • 4 comments

  • VSCode Version: 1.99.3 17baf841131aa23349f217ca7c570c76ee87b957 x64
  • Local OS Version: WSL 2 (Debian Bookworm) Windows 11 x64
  • Remote OS Version: Debian Bookworm amd64
  • Remote Extension/Connection Type: Dev Containers

There is no way to disable credential forwarding to devcontainer. Not for Git, not for GnuPG, not for SSH.

The fact that this is enabled by default and there's no way to opt-out at all, it's almost a malware behavior.

These are credentials that we are dealing with, SECRETS! It's not something that should be willy nilly be touched by VSCode or any extensions for that matter.

Steps to Reproduce:

  1. Configure Git, GnuPG, and SSH in WSL 2

  2. Create a project in WSL 2 with the following devcontainer:

.devcontainer/devcontainer.json

{
    "build": {
        "dockerfile": "Dockerfile"
    }
}

.devcontainer/Dockerfile

FROM debian:bookworm
RUN apt-get update && apt-get -y install git gnupg openssh-client
RUN useradd 'dev' -ms '/bin/bash'
USER "dev"
RUN touch ~/.config ~/.gnupg ~/.ssh
  1. Open the project in devcontainer. It will clearly fail because none of ~/.config, ~/.gnupg, and ~/.ssh are folders.

Does this issue occur when you try this locally?: Yes Does this issue occur when you try this locally and all extensions are disabled?: Yes

desmond-rhodes avatar Jun 11 '25 03:06 desmond-rhodes

We can add a setting.

chrmarti avatar Jun 11 '25 08:06 chrmarti

Please do :pray: It's crucial.

desmond-rhodes avatar Jun 11 '25 09:06 desmond-rhodes

Given how often supply chain attacks happen with NPM these days, tuning devcontainers for security might be actually useful for security-conscious developers.

Granted devcontainers can't be 100% safe. But hardened/rootless Docker + user in devcontainer isn't root + no silly holes like opt-out implicit forwarding of SSH/Git/etc would go a long way in giving many developers a safer development environment.

Interpause avatar Nov 26 '25 18:11 Interpause

This should have a CVE to be honest.

jamesdrake101 avatar Nov 27 '25 19:11 jamesdrake101