You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restructure README for clearer navigation and reduce redundancy
- Reorganize sections: merge Operation Modes into Usage with GitHub Actions, move Local Usage under Development
- Unify Troubleshooting into a single local-reproduction workflow
- Add Job Summary section with screenshots for both modes
- Simplify parameter references to use GitHub Actions input names
- Add cleanup FAQ entry and Buildx integration example
@@ -44,7 +44,7 @@ When you run `RUN npm install` or `RUN apt-get install` in a Dockerfile, these c
44
44
- Your build logs show exactly what was blocked
45
45
- The report step fails if blocked connections are detected, causing the workflow to fail
46
46
47
-
**Two modes available** (see [Operation Modes](#operation-modes) for details):
47
+
**Two modes available** (see [Usage with GitHub Actions](#usage-with-github-actions) for details):
48
48
49
49
- **Audit mode**: Records all network destinations during builds, useful for creating allowlists.
50
50
- **Restrict mode**: Allows access only to permitted domains, blocking everything else.
@@ -82,7 +82,11 @@ When you run `RUN npm install` or `RUN apt-get install` in a Dockerfile, these c
82
82
83
83
### First-Time Setup (Recommended Workflow)
84
84
85
-
Using buildcage in GitHub Actions involves three workflow steps: (1) start the buildcage container, which runs BuildKit inside a network-controlled environment; (2) configure Docker Buildx to use the buildcage container as a remote builder; (3) run your build as usual. Your Dockerfile and build commands stay the same — only the builder backend changes.
85
+
Using buildcage in GitHub Actions involves three workflow steps:
86
+
87
+
1. Start the buildcage container (runs BuildKit inside a network-controlled environment)
88
+
2. Configure Docker Buildx to use the buildcage container as a remote builder
89
+
3. Run your build as usual — your Dockerfile and build commands stay the same
86
90
87
91
#### Step 1: Discover what domains your build needs (Audit Mode)
88
92
@@ -113,7 +117,7 @@ jobs:
113
117
uses: docker/build-push-action@v6
114
118
with:
115
119
context: .
116
-
push: false
120
+
push: false # Set to true to push the built image
117
121
118
122
- name: Show what domains were accessed
119
123
if: always()
@@ -124,22 +128,11 @@ jobs:
124
128
125
129
#### Step 2: Check the report
126
130
127
-
The report will show output like:
131
+
The report action outputs a Job Summary showing every domain your build contacted:
The report step fails if blocked connections are detected, causing the workflow to fail. You can disable this by setting `fail_on_blocked: false` in the report action.
232
-
233
-
**Example report output when connections are blocked:**
@@ -273,13 +222,23 @@ Starts the buildcage builder container.
273
222
| `allowed_https_domains` | No | empty | Allowed HTTPS domains (comma-separated, without port) |
274
223
| `port` | No | `1234` | BuildKit endpoint port on localhost |
275
224
276
-
#####Outputs
225
+
#### Outputs
277
226
278
227
| Name | Description |
279
228
|------|-------------|
280
229
| `port` | BuildKit endpoint port |
281
230
282
-
##### Tips
231
+
Pass this port to [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action) to use buildcage as a remote builder:
- Start with audit mode to discover required domains, then switch to restrict mode.
285
244
- Wildcard domains are supported (e.g., `*.github.com` matches all subdomains of `github.com`).
@@ -292,7 +251,7 @@ Starts the buildcage builder container.
292
251
allowed_https_domains: registry.npmjs.org
293
252
```
294
253
295
-
#### Report Action
254
+
### Report Action
296
255
297
256
Displays communication logs after builds and optionally fails if any BLOCKED connections are found.
298
257
@@ -302,51 +261,27 @@ Displays communication logs after builds and optionally fails if any BLOCKED con
302
261
uses: dash14/buildcage/report@v1
303
262
```
304
263
305
-
##### Parameters
306
-
307
-
| Parameter | Required | Default | Description |
308
-
|-----------|----------|---------|-------------|
309
-
| `fail_on_blocked` | No | `true` | Fail the step if blocked connections are detected |
264
+
#### Job Summary
310
265
311
-
### Local Usage (Without GitHub Actions)
266
+
**Audit mode:**
312
267
313
-
GitHub Actions inputs use lowercase names (e.g., `proxy_mode`), while environment variables for local/Docker Compose usage use uppercase (e.g., `PROXY_MODE`).
- **Major CDN countermeasures** — Major CDN providers like CloudFront and Cloudflare have already introduced measures to restrict domain fronting. Consult your CDN provider's documentation for current details.
@@ -496,7 +431,7 @@ A: Yes! buildcage works seamlessly with multi-stage Dockerfiles.
496
431
497
432
**Q: Does this work with private package registries?**
498
433
499
-
A: Yes. Just add your private registry's domain to `ALLOWED_HTTPS_DOMAINS`.
434
+
A: Yes. Just add your private registry's domain to `allowed_https_domains`.
500
435
501
436
**Q: What happens if I forget to add a required domain?**
502
437
@@ -506,15 +441,19 @@ A: In restrict mode, the build will fail with a clear error message. Run in audi
506
441
507
442
A: Yes. Prefix wildcards like `*.example.com` are supported and will match all subdomains (e.g., `sub.example.com`, `deep.sub.example.com`). Note that `*.example.com` does not match `example.com` itself—add both if needed. Suffix wildcards (e.g., `example.*`) are not supported.
508
443
444
+
**Q: Do I need to clean up the buildcage container?**
445
+
446
+
A: No. The container is automatically removed when the GitHub Actions job completes.
447
+
509
448
**Q: Does this protect against malicious code execution?**
510
449
511
450
A: No. buildcage only controls network access. It doesn't prevent malicious code from running—it prevents that code from communicating with external servers.
512
451
513
452
## Troubleshooting
514
453
515
-
If you encounter issues:
454
+
If you encounter issues, try reproducing the problem locally to get detailed logs:
GitHub Actions inputs use lowercase names (e.g., `proxy_mode`), while environment variables for local/Docker Compose usage use uppercase (e.g., `PROXY_MODE`).
551
+
552
+
#### Starting the Builder
553
+
554
+
**Audit mode** (log all connections):
555
+
556
+
```bash
557
+
make run_audit_mode
558
+
```
559
+
560
+
**Restrict mode** (allowlist-based):
561
+
562
+
```bash
563
+
make run_restrict_mode
564
+
```
565
+
566
+
**Start with custom domains**:
567
+
568
+
```bash
569
+
ALLOWED_HTTPS_DOMAINS="github.com,npmjs.org,example.com" make run_restrict_mode
0 commit comments