Skip to content

Make the Devcontainer Snippets' Read-Only Mounts Actually Read-Only #3860

Closed

Description

@ptr727

Found by a local review on #3859, then measured on a Windows host with Docker Desktop's WSL2 backend against a synthetic home.

Defect

Each catalog devcontainer snippet declares its public key and allowed_signers mounts in the object form with "readonly": true. The Dev Containers CLI drops that key. So docs/devcontainer.md's read-only mode for those rows is false, and the host files are writable from inside the container.

Measured with devcontainer up from the extension's bundled CLI (extension 0.469.0), using the Python snippet with its image tag replaced because of #3858:

  • docker inspect reports RW=true for /home/vscode/.ssh/id_ed25519.pub and /home/vscode/.config/git/allowed_signers.
  • echo "# synthetic write" >> /home/vscode/.config/git/allowed_signers, run as vscode in the container, succeeded, and the line appeared in the host's file.

Why It Matters

allowed_signers is the file git verify-commit and git log --show-signature trust on the host. A process in the container can add a signer to it, and that outlives the container. The docs tell a reader this cannot happen.

The review read the CLI's generateMountCommand as emitting only type, src, and dst for the object form, which matches this measurement. It was not traced further, and the CLI's supported route to a read-only bind mount is part of this work to confirm.

Reach

Both snippets declare the mounts this way, and ptr727/ESPHome-Config's .devcontainer/python/devcontainer.json carries the same lines. Nothing here depends on the host platform, so a Linux host can fix and verify it.

Done When

  • A container started from each snippet reports RW=false for both mounts, and the write above is refused.
  • docs/devcontainer.md's table matches what the mounts do.
  • The gh config mount stays read-write.

Bounds

The same mounts lines are touched by #1763, whichever lands second rebases over the first. #3858 holds the image tags that stop a snippet starting at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions