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
**Secure your Docker builds against supply chain attacks — restrict outbound network access to only the domains you allow.**
15
15
16
-
When you run `RUN npm install` or `RUN apt-get install` in a Dockerfile, those commands can reach any server on the internet — and you have no visibility or control over where they connect. A compromised dependency could silently exfiltrate your build secrets or phone home to an attacker's server.
16
+
When you run `RUN npm install` or `RUN pip install` in a Dockerfile, those commands can execute arbitrary code and make outbound connections to any server on the internet — without visibility or control. A compromised dependency could silently exfiltrate your build secrets or phone home to an attacker's server.
17
17
18
-
buildcage prevents this. You define a list of allowed domains, and only those connections are permitted during builds. Everything else is blocked.
18
+
Buildcage prevents this. You define a list of allowed domains, and only those connections are permitted during builds. Everything else is blocked.
19
19
20
-
No Dockerfile changes required. No certificates to install. Works with any language or package manager.
20
+
No Dockerfile changes required. No proxy configuration needed. No certificates to install. Works with any language or package manager.
21
21
22
22
23
23
## How It Works
24
24
25
-
buildcage runs as a [remote driver](https://docs.docker.com/build/builders/drivers/remote/) for Docker Buildx. All `RUN` step containers are placed on an isolated network, and outbound traffic is routed through a proxy that enforces your allowlist.
25
+
Buildcage runs as a [remote driver](https://docs.docker.com/build/builders/drivers/remote/) for Docker Buildx. All `RUN` step containers are placed on an isolated network, and outbound traffic is routed through a proxy that enforces your allowlist.
- HTTPS: SNI (Server Name Indication) for domain matching — TLS is not terminated
30
30
- HTTP: Host header for domain matching
@@ -40,9 +40,9 @@ buildcage runs as a [remote driver](https://docs.docker.com/build/builders/drive
40
40
41
41
### Recommended for:
42
42
43
-
-**CI/CD pipelines pulling from public registries** — if your builds download packages from npm, PyPI, RubyGems, or other public sources, buildcage limits the blast radius of compromised packages
44
-
-**Builds that handle secrets** — if your Dockerfiles use build secrets, tokens, or credentials, buildcage prevents them from being exfiltrated to unauthorized servers
45
-
-**Teams that need network visibility** — if you need to know exactly which external services your builds contact, buildcage logs every outbound connection and can enforce an allowlist
43
+
-**CI/CD pipelines pulling from public registries** — if your builds download packages from npm, PyPI, RubyGems, or other public sources, Buildcage limits the blast radius of compromised packages
44
+
-**Builds that handle secrets** — if your Dockerfiles use build secrets, tokens, or credentials, Buildcage prevents them from being exfiltrated to unauthorized servers
45
+
-**Teams that need network visibility** — if you need to know exactly which external services your builds contact, Buildcage logs every outbound connection and can enforce an allowlist
46
46
47
47
### May not be necessary for:
48
48
@@ -70,10 +70,10 @@ buildcage runs as a [remote driver](https://docs.docker.com/build/builders/drive
70
70
71
71
### First-Time Setup (Recommended Workflow)
72
72
73
-
Using buildcage in GitHub Actions involves three workflow steps:
73
+
Using Buildcage in GitHub Actions involves three workflow steps:
74
74
75
-
1. Start the buildcage container (runs BuildKit inside a network-controlled environment)
76
-
2. Configure Docker Buildx to use the buildcage container as a remote builder
75
+
1. Start the Buildcage container (runs BuildKit inside a network-controlled environment)
76
+
2. Configure Docker Buildx to use the Buildcage container as a remote builder
77
77
3. Run your build as usual — your Dockerfile and build commands stay the same
78
78
79
79
#### Step 1: Discover what domains your build needs (Audit Mode)
@@ -89,7 +89,7 @@ jobs:
89
89
steps:
90
90
- uses: actions/checkout@v4
91
91
92
-
- name: Start buildcage in audit mode
92
+
- name: Start Buildcage in audit mode
93
93
id: buildcage
94
94
uses: dash14/buildcage/setup@v1
95
95
with:
@@ -107,7 +107,7 @@ jobs:
107
107
context: .
108
108
push: false # Set to true to push the built image
109
109
110
-
- name: Show buildcage report
110
+
- name: Show Buildcage report
111
111
if: always()
112
112
uses: dash14/buildcage/report@v1
113
113
with:
@@ -137,7 +137,7 @@ jobs:
137
137
steps:
138
138
- uses: actions/checkout@v4
139
139
140
-
- name: Start buildcage in restrict mode
140
+
- name: Start Buildcage in restrict mode
141
141
id: buildcage
142
142
uses: dash14/buildcage/setup@v1
143
143
with:
@@ -158,7 +158,7 @@ jobs:
158
158
context: .
159
159
push: false # Set to true to push the built image
160
160
161
-
- name: Show buildcage report
161
+
- name: Show Buildcage report
162
162
if: always()
163
163
uses: dash14/buildcage/report@v1
164
164
# Build fails if any unexpected connections were blocked
@@ -172,10 +172,10 @@ Your builds are now protected. Any unexpected connections will be blocked and re
172
172
173
173
### Setup Action (`dash14/buildcage/setup`)
174
174
175
-
Starts the buildcage builder container.
175
+
Starts the Buildcage builder container.
176
176
177
177
```yaml
178
-
- name: Start buildcage builder
178
+
- name: Start Buildcage builder
179
179
id: buildcage
180
180
uses: dash14/buildcage/setup@v1
181
181
with:
@@ -216,7 +216,7 @@ For detailed syntax, see [Rule Syntax](./docs/rules.md).
216
216
|------|-------------|
217
217
| `port` | BuildKit endpoint port |
218
218
219
-
Pass this port to [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action) to use buildcage as a remote builder:
219
+
Pass this port to [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action) to use Buildcage as a remote builder:
220
220
221
221
```yaml
222
222
- name: Set up Docker Buildx
@@ -294,7 +294,7 @@ In restrict mode, the report step fails if blocked connections are detected, cau
294
294
295
295
### For Technical Users
296
296
297
-
buildcage creates a controlled network environment for your Docker builds:
297
+
Buildcage creates a controlled network environment for your Docker builds:
298
298
299
299
1. **BuildKit RUN steps run in isolated containers** connected to a private network (CNI)
300
300
2. **All DNS queries return the proxy IP** (172.20.0.1), forcing traffic through the proxy
@@ -314,15 +314,15 @@ buildcage creates a controlled network environment for your Docker builds:
All containers spawned by BuildKit `RUN` steps are placed on an isolated network (CNI). DNS queries are redirected to the proxy IP, and the proxy checks each request's SNI (HTTPS) or Host header (HTTP) against the allowlist before forwarding or blocking.
320
320
321
321
---
322
322
323
323
## Trust & Self-Hosting
324
324
325
-
buildcage is a security tool — so it's fair to ask: *how do you trust buildcage itself?*
325
+
Buildcage is a security tool — so it's fair to ask: *how do you trust Buildcage itself?*
326
326
327
327
A pre-built image from a third party could be modified or rebuilt at any time without your knowledge. For a tool that sits in your build pipeline, that's a risk worth addressing.
328
328
@@ -344,21 +344,21 @@ If you don't need that level of control, you can use the image published from th
344
344
345
345
## Security Considerations
346
346
347
-
> **Important:** buildcage controls *where* your builds can connect, not *what code* they run. If a malicious package is delivered through a legitimate repository (e.g., a compromised npm package hosted on `registry.npmjs.org`), buildcage cannot detect or prevent it — the connection goes to an allowed domain.
347
+
> **Important:** Buildcage controls *where* your builds can connect, not *what code* they run. If a malicious package is delivered through a legitimate repository (e.g., a compromised npm package hosted on `registry.npmjs.org`), Buildcage cannot detect or prevent it — the connection goes to an allowed domain.
348
348
>
349
-
> Do not rely on buildcage as your sole supply chain security measure. Use it as one layer in a defense-in-depth strategy — a last line of defense that limits the blast radius of compromised dependencies by restricting their ability to communicate with external servers.
349
+
> Do not rely on Buildcage as your sole supply chain security measure. Use it as one layer in a defense-in-depth strategy — a last line of defense. If something slips through your other measures, at least it can't call home.
350
350
351
-
### What buildcage protects against
351
+
### What Buildcage protects against
352
352
353
-
buildcage blocks outbound connections to domains not on your allowlist during Docker builds. This helps mitigate scenarios such as:
353
+
Buildcage blocks outbound connections to domains not on your allowlist during Docker builds. This helps mitigate scenarios such as:
354
354
355
355
- **Data exfiltration** — prevents build secrets (e.g., environment variables, tokens) from being sent to external servers
356
356
- **Command-and-control (C2) communication** — blocks compromised dependencies from phoning home to attacker-controlled servers
357
357
- **Unexpected telemetry** — stops analytics, tracking, or other undisclosed network calls that packages may make during installation
358
358
359
359
### Security mechanisms and attack resistance
360
360
361
-
buildcage enforces network isolation through DNS-level control, HTTP/HTTPS proxy filtering, iptables rules, and CNI network isolation. These mechanisms defend against SNI spoofing, ECH bypass, DNS tunneling, non-TCP protocol tunneling, IPv6 bypass, and alternative DNS transports (DoH/DoT).
361
+
Buildcage enforces network isolation through DNS-level control, HTTP/HTTPS proxy filtering, iptables rules, and CNI network isolation. These mechanisms defend against SNI spoofing, ECH bypass, DNS tunneling, non-TCP protocol tunneling, IPv6 bypass, and alternative DNS transports (DoH/DoT).
362
362
363
363
For full technical details, see the [Security Details](./docs/security.md) document.
364
364
@@ -368,7 +368,7 @@ The only known bypass is **domain fronting** — a technique where an attacker s
368
368
369
369
## FAQ
370
370
371
-
- **Can I host buildcage in my own private repository?**
371
+
- **Can I host Buildcage in my own private repository?**
372
372
373
373
Yes. See [Trust & Self-Hosting](#trust--self-hosting) for details.
374
374
@@ -378,7 +378,7 @@ The only known bypass is **domain fronting** — a technique where an attacker s
378
378
379
379
- **Can I use this with multi-stage builds?**
380
380
381
-
Yes. buildcage works seamlessly with multi-stage Dockerfiles.
381
+
Yes. Buildcage works seamlessly with multi-stage Dockerfiles.
382
382
383
383
- **Does this work with private package registries?**
384
384
@@ -388,7 +388,7 @@ The only known bypass is **domain fronting** — a technique where an attacker s
388
388
389
389
In restrict mode, the build will fail with a clear error message. Run in audit mode first to discover all required domains.
390
390
391
-
- **Do I need to clean up the buildcage container?**
391
+
- **Do I need to clean up the Buildcage container?**
392
392
393
393
No. The container is automatically removed when the GitHub Actions job completes.
394
394
@@ -398,7 +398,7 @@ The only known bypass is **domain fronting** — a technique where an attacker s
398
398
399
399
- **Does this protect against malicious code execution?**
400
400
401
-
No. buildcage only controls network access. It doesn't prevent malicious code from running—it prevents that code from communicating with external servers.
401
+
No. Buildcage only controls network access. It doesn't prevent malicious code from running—it prevents that code from communicating with external servers.
402
402
403
403
## Troubleshooting
404
404
@@ -433,22 +433,13 @@ Contributions are welcome! Please feel free to submit issues or pull requests at
433
433
## Show Your Support
434
434
435
435
Knowing that this project is useful to others gives me the motivation to keep working on it.
436
-
If you find buildcage helpful, please consider giving it a star ⭐ on GitHub!
436
+
If you find Buildcage helpful, please consider giving it a star ⭐ on GitHub!
437
437
438
438
## Disclaimer
439
439
440
440
This software is provided "as is", without warranty of any kind, express or implied. The authors and contributors are not liable for any damages, losses, or security incidents arising from the use of this software. Use at your own risk.
441
441
442
442
## License
443
-
The buildcage source code is licensed under the MIT License. See [LICENSE](./LICENSE) file for details.
443
+
The Buildcage source code is licensed under the MIT License. See [LICENSE](./LICENSE) file for details.
444
444
445
-
The Docker image includes third-party components under their own licenses (GPL, Apache 2.0, ISC, etc.). See [THIRD_PARTY_LICENSES](./THIRD_PARTY_LICENSES) for the full list.
446
-
447
-
## Acknowledgments
448
-
449
-
buildcage is built on top of:
450
-
- [BuildKit](https://github.com/moby/buildkit) - Modern build toolkit
- [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html) - DNS server
454
-
- [s6-overlay](https://github.com/just-containers/s6-overlay) - Process supervisor
445
+
The Docker image includes third-party components under their own licenses (GPL, Apache 2.0, ISC, etc.). See [THIRD_PARTY_LICENSES](./THIRD_PARTY_LICENSES) for the full list.
Copy file name to clipboardExpand all lines: SECURITY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
I welcome reports about:
6
6
7
-
-**Proxy bypass** — ways to make network connections from `RUN` steps that evade the buildcage proxy (other than the [known domain fronting limitation](./README.md#known-limitations))
7
+
-**Proxy bypass** — ways to make network connections from `RUN` steps that evade the Buildcage proxy (other than the [known domain fronting limitation](./README.md#known-limitations))
8
8
-**Network isolation escape** — bypassing CNI isolation or iptables rules to reach the internet directly
9
9
-**GitHub Actions setup** — vulnerabilities in the `setup` or `report` actions (e.g., injection, credential leak)
10
10
-**DNS filtering bypass** — bypassing the DNS redirect mechanism
0 commit comments