Repository navigation
Make the Devcontainer Snippets' Read-Only Mounts Actually Read-Only - #3868
Conversation
The Dev Containers CLI drops `readonly` from a mount's object form. So the host's `allowed_signers`, the file commit verification trusts, was writable from inside the container, while the docs called it read-only. The string form passes straight to Docker's `--mount` flag and honors it.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the changes consistently implement the documented read-only mount behavior while preserving writable GitHub CLI configuration.
No open issues 🎉
What changed in this PR
This pull request updates the catalog Dev Container snippets so SSH public key and Git signer mounts are actually read-only while keeping the GitHub CLI configuration writable. It also documents the required mount syntax.
Changes:
- Replaces object-form mounts with Docker-compatible string-form mounts.
- Adds read-only bind mounts for the public key and
allowed_signersfiles. - Documents why the string form is required and aligns the documentation with the configuration.
| File | Description |
|---|---|
docs/devcontainer.md |
Documents the string-form mount requirement and read-only behavior. |
catalog/snippets/devcontainer/python/devcontainer.json |
Applies read-only string-form mounts to the Python snippet. |
catalog/snippets/devcontainer/dotnet/devcontainer.json |
Applies read-only string-form mounts to the .NET snippet. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3868 +/- ##
===========================================
+ Coverage 81.60% 83.31% +1.70%
===========================================
Files 26 29 +3
Lines 9070 9956 +886
===========================================
+ Hits 7402 8295 +893
+ Misses 1668 1661 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
#3870) ## Summary Promotes #3866 and #3868 to `main`. Closes #3858. Closes #3860. - **#3866** repoints the catalog devcontainer snippets at images that start, `python:3-3.14-bookworm` and `dotnet:2-10.0`. It also documents why those tags are kept by hand. - **#3868** moves the snippets' mounts to the string form, so the public key and `allowed_signers` mounts are read-only rather than writable from the container. Each snippet was started with post-create on a Windows host's Docker Desktop, from a scratch tree and a synthetic home. Each feature pull request's body holds that measurement. `ptr727/ESPHome-Config` carries the Python snippet with both defects, and stays as it is until a resync reaches it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Part of #3860.
Why
Each catalog devcontainer snippet declared its public key and
allowed_signersmounts in the object form with"readonly": true. The Dev Containers CLI drops that key, so both host files were writable from inside the container.allowed_signersis the filegit verify-commitandgit log --show-signaturetrust, so a process in the container could add a signer that outlives the container.docs/devcontainer.mdcalled both mounts read-only.What Changed
--mountflag. Theghconfig mount moves with them, so the list holds one form, and it stays read-write.docs/devcontainer.mdstates why the string form is used, so a later tidy does not restore the object form. Its mode table was already what the mounts should do, and now matches what they do.Verification
Each snippet ran through
devcontainer upwith post-create, using the Dev Containers extension's bundled CLI (0.469.0) on Docker Desktop's WSL2 backend, from a scratch tree and a synthetic home.id_ed25519.pubindocker inspectRW=trueRW=falseRW=falseallowed_signersindocker inspectRW=trueRW=falseRW=false.config/ghindocker inspectRW=trueRW=trueRW=truevscode.config/ghupexited 0 for each snippet, so the read-only mounts break neither the feature build nor post-create. The full test suite was not run, since no test parses these mounts and the change touches no code.Not measured: a commit signed and verified in the container with these mounts. The synthetic home holds no real key, so this probe shows the signers file is readable at its path and refuses a write, and stops there.
Not in This Change
ptr727/ESPHome-Configcarries the Python snippet's old mount lines, so its host files stay writable until a resync reaches it.mountslines and rebases over this.🤖 Generated with Claude Code