Commit 2ad3a5b
sandbox: enforce VS Code git credential lockdown via devcontainer settings
Pin three Dev Containers settings in devcontainer.json so VS Code never
forwards host git credentials into the container in the first place,
rather than relying on env-var clearing in `just claude`:
git.terminalAuthentication: false -> stops VS Code's Git
extension from setting GIT_ASKPASS / VSCODE_GIT_IPC_HANDLE in
integrated terminals (source: vscode/extensions/git/src/askpass.ts)
dev.containers.gitCredentialHelperConfigLocation: "none"
-> stops Dev Containers
from writing a credential.helper line into /etc/gitconfig
dev.containers.copyGitConfig: false -> stops the host
~/.gitconfig (with its url.insteadOf rewrites and per-host helpers)
from being copied into the container
A compromised model can no longer reach a leaked VS Code IPC socket by
editing the hook or recipe, because the socket is never wired up.
Knock-on cleanup:
- devcontainer.json: drop the now-redundant remoteEnv blanks for
GIT_ASKPASS / VSCODE_GIT_IPC_HANDLE / VSCODE_GIT_ASKPASS_{MAIN,NODE,
EXTRA_ARGS}. The new settings prevent VS Code from setting them at
all; sandbox-check.sh catches any regression. SSH_AUTH_SOCK= stays
in remoteEnv — there is no VS Code setting alternative for it.
- justfile: drop VSCODE_GIT_IPC_HANDLE= / GIT_ASKPASS= from `just claude`
for the same reason; SSH_AUTH_SOCK= stays.
- sandbox-check.sh: env-var failures for the credential bridge now
point at "rebuild the devcontainer" since `just claude` no longer
fixes them.
- README-CLAUDE.md: rewrite the credential-injection section to lead
with the settings as the primary defence; postStart.sh and the
sandbox-check.sh hook are belt-and-braces verifications, not the
only enforcement.
Requires devcontainer rebuild for the settings to take effect.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5be632f commit 2ad3a5b
4 files changed
Lines changed: 50 additions & 36 deletions
File tree
- template
- .devcontainer
- {% if add_claude %}.claude{% endif %}/hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
| |||
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | | - | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
Lines changed: 19 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | | - | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
0 commit comments