cc-sandboxer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +515 -0
- package/README.vi.md +509 -0
- package/README.zh.md +508 -0
- package/cc-sandboxer.sh +682 -0
- package/docker/Dockerfile +65 -0
- package/docker/init-firewall.sh +126 -0
- package/package.json +46 -0
- package/vscode/tasks.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
# Claude Code Sandbox
|
|
2
|
+
|
|
3
|
+
**English** | [Tiếng Việt](README.vi.md) | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
██████╗██╗ █████╗ ██╗ ██╗██████╗ ███████╗
|
|
7
|
+
██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗██╔════╝
|
|
8
|
+
██║ ██║ ███████║██║ ██║██║ ██║█████╗
|
|
9
|
+
██║ ██║ ██╔══██║██║ ██║██║ ██║██╔══╝
|
|
10
|
+
╚██████╗███████╗██║ ██║╚██████╔╝██████╔╝███████╗
|
|
11
|
+
╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
12
|
+
C O D E S A N D B O X
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Run `claude --dangerously-skip-permissions` safely inside a Docker sandbox.**
|
|
16
|
+
|
|
17
|
+
One command. Full isolation. Terminal or VS Code.
|
|
18
|
+
|
|
19
|
+
[![Docker][docker-badge]][docker-url]
|
|
20
|
+
[![OrbStack][orbstack-badge]][orbstack-url]
|
|
21
|
+
[![VS Code][vscode-badge]][vscode-url]
|
|
22
|
+
[![License: MIT][license-badge]][license-url]
|
|
23
|
+
|
|
24
|
+
[docker-badge]: https://img.shields.io/badge/Docker-Ready-2496ED?style=for-the-badge&logo=docker&logoColor=white
|
|
25
|
+
[docker-url]: https://www.docker.com/
|
|
26
|
+
[orbstack-badge]: https://img.shields.io/badge/OrbStack-Compatible-000000?style=for-the-badge
|
|
27
|
+
[orbstack-url]: https://orbstack.dev/
|
|
28
|
+
[vscode-badge]: https://img.shields.io/badge/VS_Code-DevContainer-007ACC?style=for-the-badge&logo=visual-studio-code&logoColor=white
|
|
29
|
+
[vscode-url]: https://code.visualstudio.com/
|
|
30
|
+
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge
|
|
31
|
+
[license-url]: LICENSE
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### Via npx (recommended)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Run in current directory
|
|
41
|
+
npx cc-sandboxer
|
|
42
|
+
|
|
43
|
+
# Run with a specific project
|
|
44
|
+
npx cc-sandboxer ~/projects/my-app
|
|
45
|
+
|
|
46
|
+
# One-shot task
|
|
47
|
+
npx cc-sandboxer . -p "Fix all lint errors"
|
|
48
|
+
|
|
49
|
+
# Setup VS Code DevContainer
|
|
50
|
+
npx cc-sandboxer --init ~/projects/my-app
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Via git clone
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/ngocquang/cc-sandbox.git
|
|
57
|
+
cd cc-sandbox
|
|
58
|
+
chmod +x cc-sandboxer.sh
|
|
59
|
+
./cc-sandboxer.sh
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### VS Code (DevContainer)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Setup DevContainer in your project
|
|
66
|
+
npx cc-sandboxer --init ~/projects/my-app
|
|
67
|
+
|
|
68
|
+
# Open in VS Code -> Reopen in Container -> Run tasks
|
|
69
|
+
code ~/projects/my-app
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> First run builds a Docker image (~2-3 min). After that, startup takes seconds.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Why?
|
|
77
|
+
|
|
78
|
+
[Claude Code](https://docs.anthropic.com/en/docs/claude-code) with `--dangerously-skip-permissions` is incredibly productive — Claude can execute **any** command without prompting. But running it on your bare machine is risky:
|
|
79
|
+
|
|
80
|
+
| | Without Sandbox | With Sandbox |
|
|
81
|
+
| ------------ | ---------------------------- | ------------------------------- |
|
|
82
|
+
| Filesystem | Full access to your machine | Only `/workspace` |
|
|
83
|
+
| Network | Unrestricted internet | Firewall whitelist only |
|
|
84
|
+
| Outbound TCP | All ports open | All non-whitelisted TCP blocked |
|
|
85
|
+
| Worst case | `rm -rf /` nukes your system | Container dies, host is fine |
|
|
86
|
+
| Overhead | None | ~3 seconds |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
### Option A — npx (no install needed)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx cc-sandboxer
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Option B — Global install
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install -g cc-sandboxer
|
|
102
|
+
cc-sandboxer
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Option C — Clone the repo
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/ngocquang/cc-sandbox.git
|
|
109
|
+
cd cc-sandbox
|
|
110
|
+
chmod +x cc-sandboxer.sh
|
|
111
|
+
./cc-sandboxer.sh
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Shell Alias (optional)
|
|
115
|
+
|
|
116
|
+
Add to your `~/.zshrc` or `~/.bashrc` for quick access:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
alias cc="npx cc-sandboxer"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Then reload your shell:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
source ~/.zshrc
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Now you can use:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cc # current directory
|
|
132
|
+
cc ~/projects/my-app # specific project
|
|
133
|
+
cc . -p "Fix all lint errors"
|
|
134
|
+
cc . --continue
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Prerequisites
|
|
138
|
+
|
|
139
|
+
You need **one** of these container runtimes:
|
|
140
|
+
|
|
141
|
+
> **Note:** Supports **macOS** and **Linux** only. Windows is not supported.
|
|
142
|
+
|
|
143
|
+
| Runtime | Platform | Install |
|
|
144
|
+
| -------------- | ------------- | ------------------------------------------------------------- |
|
|
145
|
+
| Docker Desktop | macOS / Linux | [docker.com](https://www.docker.com/products/docker-desktop/) |
|
|
146
|
+
| OrbStack | macOS | [orbstack.dev](https://orbstack.dev/) |
|
|
147
|
+
| Colima | macOS / Linux | [github](https://github.com/abiosoft/colima) |
|
|
148
|
+
| Docker Engine | Linux | [docs.docker.com](https://docs.docker.com/engine/install/) |
|
|
149
|
+
|
|
150
|
+
For VS Code mode, also install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Terminal Mode
|
|
155
|
+
|
|
156
|
+
### Interactive (recommended)
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
cc-sandboxer # current directory
|
|
160
|
+
cc-sandboxer ~/projects/my-app # specific project
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### One-shot tasks
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cc-sandboxer . -p "Refactor the auth module and write tests"
|
|
167
|
+
cc-sandboxer . -p "Fix all ESLint errors and add missing types"
|
|
168
|
+
cc-sandboxer . -p "Read SPEC.md -> write failing tests -> implement -> iterate"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Resume previous conversation
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
cc-sandboxer . --continue
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Block dangerous commands
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
cc-sandboxer . --disallowedTools "Bash(rm:*)"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Shell mode
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cc-sandboxer --shell
|
|
187
|
+
# Then run manually inside:
|
|
188
|
+
# claude --dangerously-skip-permissions
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> All commands work with `npx cc-sandboxer`, `cc-sandboxer` (global install), or `./cc-sandboxer.sh` (cloned repo).
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## VS Code Mode
|
|
196
|
+
|
|
197
|
+
The `--init` flag sets up a full DevContainer environment in your project — no manual config needed.
|
|
198
|
+
|
|
199
|
+
### Setup
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
./cc-sandboxer.sh --init ~/projects/my-app
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This creates:
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
your-project/
|
|
209
|
+
├── devcontainer/
|
|
210
|
+
│ ├── Dockerfile # Sandbox image with all tools
|
|
211
|
+
│ ├── devcontainer.json # VS Code container config
|
|
212
|
+
│ └── init-firewall.sh # Network security rules
|
|
213
|
+
└── .vscode/
|
|
214
|
+
└── tasks.json # Pre-configured Claude tasks
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Recommended: Install Claude Code Extension
|
|
218
|
+
|
|
219
|
+
For the best experience in DevContainer, install the [Claude Code extension](https://marketplace.visualstudio.com/items?itemName=anthropic.claude-code) in VS Code **before** opening the container. The DevContainer is pre-configured to auto-install it inside the container, but having it on the host ensures seamless setup.
|
|
220
|
+
|
|
221
|
+
> **Tip:** The extension provides a native VS Code GUI for Claude Code — chat panel, inline suggestions, and task management — all within the sandbox.
|
|
222
|
+
|
|
223
|
+
### Open in VS Code
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
1. code ~/projects/my-app
|
|
227
|
+
2. Cmd+Shift+P -> "Dev Containers: Reopen in Container"
|
|
228
|
+
3. Wait for build (first time only)
|
|
229
|
+
4. The Claude Code extension auto-installs inside the container.
|
|
230
|
+
5. Done! You're inside the sandbox.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### VS Code Tasks
|
|
234
|
+
|
|
235
|
+
Once inside the container, use `Cmd+Shift+P` -> `Tasks: Run Task`:
|
|
236
|
+
|
|
237
|
+
| Task | Description |
|
|
238
|
+
| ------------------------- | ---------------------------------- |
|
|
239
|
+
| Claude: Skip Permissions | Interactive mode |
|
|
240
|
+
| Claude: Resume Last Chat | Continue previous conversation |
|
|
241
|
+
| Claude: One-Shot Task | Prompts you for a task description |
|
|
242
|
+
| Claude: Safe Mode (no rm) | Skip permissions but block `rm` |
|
|
243
|
+
| Firewall: Re-initialize | Re-apply network rules |
|
|
244
|
+
| Claude: Login | First-time authentication |
|
|
245
|
+
|
|
246
|
+
### First-time Authentication
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Run the login task, or in terminal:
|
|
250
|
+
claude login
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The auth token is persisted in a Docker volume — you only need to do this once.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Security
|
|
258
|
+
|
|
259
|
+
### Network Firewall
|
|
260
|
+
|
|
261
|
+
The container runs an `iptables` firewall with **default-deny for all outbound TCP**. Only whitelisted domains are allowed:
|
|
262
|
+
|
|
263
|
+
| Service | Domains |
|
|
264
|
+
| -------------- | ------------------------------------------------------------------ |
|
|
265
|
+
| Claude API | `api.anthropic.com`, `auth.anthropic.com`, `statsig.anthropic.com`, `sentry.io`, `anthropic.gallerycdn.azure.cn` |
|
|
266
|
+
| Claude Code | `storage.googleapis.com` |
|
|
267
|
+
| npm | `registry.npmjs.org`, `registry.yarnpkg.com` |
|
|
268
|
+
| GitHub | `github.com`, `api.github.com`, `*.githubusercontent.com` |
|
|
269
|
+
| PyPI | `pypi.org`, `files.pythonhosted.org` |
|
|
270
|
+
| Microsoft | `microsoft.com` |
|
|
271
|
+
| VS Code | `marketplace.visualstudio.com`, `open-vsx.org`, `*.vo.msecnd.net`, `gallerycdn.vsassets.io`, `vscode.download.prss.microsoft.com`, `default.exp-tas.com` |
|
|
272
|
+
|
|
273
|
+
**Everything else is blocked.** Claude can't exfiltrate code or download from untrusted sources.
|
|
274
|
+
|
|
275
|
+
Key security features:
|
|
276
|
+
|
|
277
|
+
- **All outbound TCP blocked** by default (not just ports 80/443)
|
|
278
|
+
- **DNS tunneling mitigated** — DNS queries restricted to local resolvers only
|
|
279
|
+
- **Input validation** — domain names validated before adding to whitelist
|
|
280
|
+
- **No seccomp=unconfined** — only `NET_ADMIN` capability granted for iptables
|
|
281
|
+
|
|
282
|
+
#### Add custom domains
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# CLI mode
|
|
286
|
+
./cc-sandboxer.sh --allow-domain "api.example.com" --allow-domain "docker.io"
|
|
287
|
+
|
|
288
|
+
# DevContainer mode — edit devcontainer/init-firewall.sh
|
|
289
|
+
# Or set the env var in devcontainer.json:
|
|
290
|
+
# "containerEnv": { "EXTRA_ALLOWED_DOMAINS": "api.example.com,docker.io" }
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Filesystem Isolation
|
|
294
|
+
|
|
295
|
+
| What | Access |
|
|
296
|
+
| --------------- | ------------------------- |
|
|
297
|
+
| Your project | Mounted at `/workspace` |
|
|
298
|
+
| Host filesystem | Isolated |
|
|
299
|
+
| `.gitconfig` | Read-only |
|
|
300
|
+
| Auth tokens | Docker volume (persisted) |
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Configuration
|
|
305
|
+
|
|
306
|
+
### Environment Variables
|
|
307
|
+
|
|
308
|
+
| Variable | Default | Description |
|
|
309
|
+
| ----------------------- | ------------------ | --------------------------------------------------- |
|
|
310
|
+
| `TZ` | `Asia/Ho_Chi_Minh` | Container timezone |
|
|
311
|
+
| `EXTRA_ALLOWED_DOMAINS` | _(empty)_ | Comma-separated domains for firewall (DevContainer) |
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
TZ=America/New_York ./cc-sandboxer.sh
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Customize DevContainer
|
|
318
|
+
|
|
319
|
+
After running `--init`, you can edit any file in `devcontainer/`:
|
|
320
|
+
|
|
321
|
+
**Add tools** — edit `devcontainer/Dockerfile`:
|
|
322
|
+
|
|
323
|
+
```dockerfile
|
|
324
|
+
# Add Python ML tools
|
|
325
|
+
RUN pip3 install --break-system-packages numpy pandas
|
|
326
|
+
|
|
327
|
+
# Add Go
|
|
328
|
+
RUN curl -OL https://go.dev/dl/go1.22.0.linux-amd64.tar.gz && \
|
|
329
|
+
tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
|
|
330
|
+
ENV PATH=$PATH:/usr/local/go/bin
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Add VS Code extensions** — edit `devcontainer/devcontainer.json`:
|
|
334
|
+
|
|
335
|
+
```jsonc
|
|
336
|
+
"customizations": {
|
|
337
|
+
"vscode": {
|
|
338
|
+
"extensions": [
|
|
339
|
+
"anthropic.claude-code",
|
|
340
|
+
"dbaeumer.vscode-eslint",
|
|
341
|
+
"esbenp.prettier-vscode"
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Then rebuild: `Cmd+Shift+P` -> `Dev Containers: Rebuild Container`
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## What's in the Box?
|
|
352
|
+
|
|
353
|
+
| Category | Tools |
|
|
354
|
+
| ------------ | ------------------------------- |
|
|
355
|
+
| **Runtime** | Node.js 20, Python 3, npm, pip |
|
|
356
|
+
| **Editor** | nano, vim |
|
|
357
|
+
| **Search** | ripgrep (`rg`), fd-find |
|
|
358
|
+
| **VCS** | git, gh (GitHub CLI), git-delta |
|
|
359
|
+
| **Shell** | zsh, Oh My Zsh, fzf |
|
|
360
|
+
| **Network** | curl, wget, jq |
|
|
361
|
+
| **Security** | iptables, ipset, dnsutils |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## All CLI Options
|
|
366
|
+
|
|
367
|
+
```text
|
|
368
|
+
Usage: cc-sandboxer [project_path] [options]
|
|
369
|
+
|
|
370
|
+
Arguments:
|
|
371
|
+
project_path Path to project (default: current directory)
|
|
372
|
+
|
|
373
|
+
Setup:
|
|
374
|
+
--init Setup devcontainer + VS Code tasks in project
|
|
375
|
+
--rebuild Force rebuild Docker image
|
|
376
|
+
--version, -v Show version
|
|
377
|
+
--help, -h Show help
|
|
378
|
+
|
|
379
|
+
Runtime:
|
|
380
|
+
--shell Open shell without starting Claude
|
|
381
|
+
--no-firewall Skip network firewall
|
|
382
|
+
--allow-domain NAME Whitelist extra domain (repeatable)
|
|
383
|
+
--continue, -c Resume previous conversation
|
|
384
|
+
-p "prompt" One-shot task mode
|
|
385
|
+
--disallowedTools TOOLS Block specific Claude tools
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Cleanup
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
# Remove persisted data
|
|
394
|
+
docker volume rm claude-config claude-npm claude-history
|
|
395
|
+
|
|
396
|
+
# Remove image
|
|
397
|
+
docker rmi cc-sandboxer:latest
|
|
398
|
+
|
|
399
|
+
# Remove DevContainer volumes
|
|
400
|
+
docker volume rm claude-code-config claude-code-npm claude-code-history
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Troubleshooting
|
|
406
|
+
|
|
407
|
+
### "Firewall skipped"
|
|
408
|
+
|
|
409
|
+
The container needs `NET_ADMIN` capability.
|
|
410
|
+
In CLI mode, this is set automatically.
|
|
411
|
+
In DevContainer mode, check that `devcontainer.json` has:
|
|
412
|
+
|
|
413
|
+
```json
|
|
414
|
+
"runArgs": ["--cap-add=NET_ADMIN"]
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Claude not authenticated
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# CLI mode
|
|
421
|
+
./cc-sandboxer.sh --shell
|
|
422
|
+
claude login
|
|
423
|
+
|
|
424
|
+
# VS Code mode
|
|
425
|
+
# Cmd+Shift+P -> Tasks: Run Task -> Claude: Login
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### First build is slow
|
|
429
|
+
|
|
430
|
+
First build downloads Node.js, system packages, and Claude Code (~2-3 min).
|
|
431
|
+
Subsequent runs use the cached image.
|
|
432
|
+
Force rebuild to update Claude Code:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
./cc-sandboxer.sh --rebuild
|
|
436
|
+
# or in VS Code:
|
|
437
|
+
# Cmd+Shift+P -> Dev Containers: Rebuild Container
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Need a blocked domain
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# CLI
|
|
444
|
+
./cc-sandboxer.sh --allow-domain "your-domain.com"
|
|
445
|
+
|
|
446
|
+
# DevContainer
|
|
447
|
+
# add to init-firewall.sh ALLOWED_DOMAINS array
|
|
448
|
+
# or set env:
|
|
449
|
+
# EXTRA_ALLOWED_DOMAINS="domain1.com,domain2.com"
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Claude Code extension not working in container
|
|
453
|
+
|
|
454
|
+
If you see: _"This extension is disabled in this workspace because it is defined to run in the Remote Extension Host"_
|
|
455
|
+
|
|
456
|
+
**Fix (one-time):**
|
|
457
|
+
|
|
458
|
+
1. Open the **Extensions** sidebar (`Cmd+Shift+X`)
|
|
459
|
+
2. Search for **"Claude Code"**
|
|
460
|
+
3. Click **"Install in Dev Container"**
|
|
461
|
+
4. The extension is now persisted in a Docker volume — it survives container rebuilds
|
|
462
|
+
|
|
463
|
+
> **Why?** The Claude Code extension requires installation inside the container's Remote Extension Host. The DevContainer config attempts auto-install, but some VS Code setups require a one-time manual install. After that, the volume mount keeps it available permanently.
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
## Testing
|
|
468
|
+
|
|
469
|
+
Unit tests use [bats-core](https://github.com/bats-core/bats-core) (Bash Automated Testing System).
|
|
470
|
+
|
|
471
|
+
### Install & Run
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
# Install bats (macOS)
|
|
475
|
+
brew install bats-core
|
|
476
|
+
|
|
477
|
+
# Run all tests
|
|
478
|
+
bats tests/
|
|
479
|
+
|
|
480
|
+
# Run specific test file
|
|
481
|
+
bats tests/cc-sandbox.bats
|
|
482
|
+
bats tests/init-firewall.bats
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Coverage
|
|
486
|
+
|
|
487
|
+
| Area | Tests | What's covered |
|
|
488
|
+
| --- | --- | --- |
|
|
489
|
+
| CLI flags | 5 | `--version`, `-v`, `--help`, `-h`, all documented options |
|
|
490
|
+
| Domain validation | 5 | Missing arg, flag collision, special chars, spaces, slashes |
|
|
491
|
+
| `--init` mode | 10 | File creation, no-overwrite, content validation, source parity |
|
|
492
|
+
| Firewall generation | 7 | Default/extra domains, iptables rules, DNS tunneling, SSH, syntax |
|
|
493
|
+
| Firewall script | 19 | Syntax, domains, security rules, ipset ordering, regex validation |
|
|
494
|
+
| Display | 3 | Banner, version string, ASCII art |
|
|
495
|
+
| **Total** | **49** | |
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Contributing
|
|
500
|
+
|
|
501
|
+
PRs welcome! Some ideas:
|
|
502
|
+
|
|
503
|
+
- [ ] Add Cursor IDE support
|
|
504
|
+
- [ ] Add Windsurf support
|
|
505
|
+
- [ ] Per-project firewall configs
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## License
|
|
510
|
+
|
|
511
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
**Built for developers who like their `rm -rf` contained.**
|