Commit 4c0b43a
authored
feat(config): move .claude to home directory with named volume and auth token support (#3)
* Move .claude config from /workspaces to home directory with named volume
- Change CLAUDE_CONFIG_DIR from /workspaces/.claude to ~/.claude
- Add Docker named volume (per-instance via ${devcontainerId}) for persistence
- Add CLAUDE_AUTH_TOKEN secret support with auto .credentials.json creation
- Replace setup-symlink-claude.sh with setup-migrate-claude.sh (one-time migration)
- Fix named volume root ownership via sudo chown on startup
- Update scope guard allowlist to resolve $HOME dynamically
- Update protected-files guard regex to cover .credentials.json
- Update all feature heredocs, poststart hooks, and docs
* Harden auth token handling, migration, and volume ownership
Security and robustness fixes from PR review:
- setup-auth.sh: Replace unquoted heredoc with printf '%s' to prevent
shell injection via CLAUDE_AUTH_TOKEN metacharacters (H1)
- setup-auth.sh: Add sk-ant-* format validation on token (L1)
- setup-auth.sh: Check/fix 600 permissions on existing .credentials.json (L2)
- setup-auth.sh: Use ${CLAUDE_CONFIG_DIR:-$HOME/.claude} pattern
consistently with other scripts (M3)
- setup-auth.sh: Document /proc token visibility limitation (M2)
- setup-migrate-claude.sh: Add idempotency check — skip silently when
destination already has content (H2)
- setup-migrate-claude.sh: Broaden trigger — migrate all content, not
just when .credentials.json exists (L3)
- setup-migrate-claude.sh: Add symlink protection on old directory (M1)
- setup-migrate-claude.sh: Use --no-dereference with cp (M1)
- setup-migrate-claude.sh: Use ${CLAUDE_CONFIG_DIR} pattern (L4)
- setup.sh: Log warning on sudo chown failure instead of silent
suppression (M4)
* Address CodeRabbit review findings (1, 2, 6, 7)
- CHANGELOG.md: Add #### Documentation subsection under Changed, add
#### Scripts subsection under Removed for consistent structure
- CLAUDE.md: Document CLAUDE_AUTH_TOKEN, .credentials.json auto-creation,
skip-if-exists behavior, sk-ant-* validation, and named volume persistence
- setup-auth.sh: Detect printf subshell write failure — report warning
instead of false success when .credentials.json write fails
- setup-migrate-claude.sh: Verify cp exit status before printing success —
warn if copy failed instead of unconditional "Migration complete"
- docs/reference/changelog.md: Mirror CHANGELOG structure fixes
Findings 3-5 (feature $HOME fallback) confirmed as false positives:
postStartCommand runs as vscode user, CLAUDE_CONFIG_DIR is exported
by setup.sh before hooks execute.
* Address remaining CodeRabbit review findings (3, 4, 5, 8, 9, 10)
- Fix hardcoded /home/vscode/.claude in changelog, use portable ~/.claude
- Remove implementation detail "(leading dot)" from changelog entry
- Set AUTH_CONFIGURED=true when credentials already exist (fixes false
"No tokens provided" summary)
- Update docs site settings.json deployment path to ~/.claude
- Harden $HOME fallback across all scripts: resolve target user's home
via SUDO_USER/USER/vscode chain instead of relying on $HOME (guards
against root context in feature installs and hooks)
- Add CLAUDE_CONFIG_DIR documentation to ccstatusline and mcp-qdrant
feature READMEs
- Fix stale .claude/settings.json references in ccstatusline README
* Harden shell scripts and fix stale docs from CodeRabbit review
- Replace eval tilde expansion with getent passwd lookup in all
PR-scoped scripts (setup-auth, setup-migrate, ccstatusline,
mcp-qdrant install + poststart hook) to prevent shell injection
via SUDO_USER/USER environment variables
- JSON-escape auth token value before writing .credentials.json
- Create credential directory with umask 077 (was default 755)
- Fix mcp-qdrant chown to use resolved _USERNAME instead of
hardcoded vscode or $(id -un)
- Update ccstatusline README verification commands to respect
CLAUDE_CONFIG_DIR environment variable
- Sync docs site changelog with devcontainer CHANGELOG fixes
(~/. claude path, remove "(leading dot)" aside)
* fix(migration): harden migration script and add .env deprecation guard
Migration script:
- Switch from cp -rn to cp -a (archive mode) for faithful copy
- Marker-based idempotency instead of checking destination contents
- Verify critical files (.claude.json, plugins/, .credentials.json)
- Fix ownership after copy (source may have different uid)
- Rename old directory to .bak on success
Setup.sh:
- Detect stale CLAUDE_CONFIG_DIR=/workspaces/.claude in .env
- Override to $HOME/.claude with warning
- Auto-comment the stale line on disk
---------
Co-authored-by: AnExiledDev <AnExiledDev@users.noreply.github.com>1 parent 873bb71 commit 4c0b43a
File tree
32 files changed
+312
-88
lines changed- .devcontainer
- docs
- features
- ccstatusline
- claude-session-dashboard
- mcp-qdrant
- plugins/devs-marketplace/plugins
- protected-files-guard/scripts
- workspace-scope-guard
- scripts
- scripts
- docs/src/content/docs
- customization
- plugins
- reference
32 files changed
+312
-88
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
12 | 28 | | |
13 | 29 | | |
14 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
15 | 43 | | |
16 | 44 | | |
17 | 45 | | |
| |||
29 | 57 | | |
30 | 58 | | |
31 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
32 | 63 | | |
33 | 64 | | |
34 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
44 | 57 | | |
45 | 58 | | |
46 | 59 | | |
| |||
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
114 | | - | |
| 127 | + | |
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
| |||
199 | 212 | | |
200 | 213 | | |
201 | 214 | | |
202 | | - | |
| 215 | + | |
203 | 216 | | |
204 | 217 | | |
205 | 218 | | |
| |||
301 | 314 | | |
302 | 315 | | |
303 | 316 | | |
| 317 | + | |
| 318 | + | |
304 | 319 | | |
305 | 320 | | |
306 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | | - | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
| |||
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
32 | 44 | | |
33 | 45 | | |
34 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
122 | | - | |
| 127 | + | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
207 | | - | |
| 208 | + | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | | - | |
| 262 | + | |
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
| |||
0 commit comments