|
| 1 | +--- |
| 2 | +title: Use egress filters for GitHub Actions runners |
| 3 | +ogTitle: How to configure egress filtering for your Depot GitHub Actions runners |
| 4 | +description: Learn how to configure egress filtering rules to control which external services your GitHub Actions runners can connect to. |
| 5 | +--- |
| 6 | + |
| 7 | +Configure egress filtering to control which external services your GitHub Actions runners can connect to by blocking or allowing connections at the network level. Egress filtering helps prevent data exfiltration and reduces the attack surface of your CI infrastructure. |
| 8 | + |
| 9 | +### Configuration |
| 10 | + |
| 11 | +Configure egress rules on your organization's [settings page](/orgs/_/settings), in the **GitHub Actions Runners** section under **Egress Rules**. |
| 12 | + |
| 13 | +By default, Depot runners allow outbound connections to any external service. You can set the default rule (target `*`) to either `Deny` or `Allow`. You can add more rules to allow or deny connections to specific IPs, CIDRs, or hostnames. |
| 14 | + |
| 15 | +The following example shows a set of rules to get a Docker build with Golang working: |
| 16 | + |
| 17 | +[](/images/egress-filter-rules.webp) |
| 18 | + |
| 19 | +This example first applies a blanket deny rule, which blocks all outbound connections by default. Then, it allows connections to the following: |
| 20 | + |
| 21 | +- `auth.docker.io` and `docker.io` for Docker Hub authentication and registry access |
| 22 | +- `sum.golang.org` and `proxy.golang.org` for Go modules and proxy access |
| 23 | +- `storage.googleapis.com` for Google Cloud Storage access |
| 24 | + |
| 25 | +### How the runner applies the rules |
| 26 | + |
| 27 | +The runner applies the filtering rules in the following order: |
| 28 | + |
| 29 | +1. Allow all loopback traffic (127.0.0.1, ::1) to prevent breaking localhost services. |
| 30 | +2. Apply Deny rules: denied IPs and CIDR blocks take precedence. |
| 31 | +3. Apply Allow rules: explicitly permitted IP addresses and CIDR blocks. |
| 32 | +4. Apply the default policy (ALLOW or DENY) to all other traffic. |
| 33 | + |
| 34 | +When you specify a hostname in your rules, it's resolved to IP addresses and pinned in `/etc/hosts` to ensure consistent filtering. |
| 35 | + |
| 36 | +### Pre-configured rules |
| 37 | + |
| 38 | +To ensure that runners can still connect to necessary services, we automatically add certain IPs and hosts to the allowlist: |
| 39 | + |
| 40 | +- depot.dev domains |
| 41 | +- GitHub Actions service IPs |
| 42 | +- AWS service IPs |
| 43 | + |
| 44 | +Container builds with `depot build` also work with egress filtering enabled. Depot dynamically adds BuildKit machine IPs to the allowlist as they're allocated. |
| 45 | + |
| 46 | +### Limitations |
| 47 | + |
| 48 | +Keep the following limitations in mind when you use egress filtering: |
| 49 | + |
| 50 | +- You can't use Tailscale with egress filters because each modifies the network config in incompatible ways. |
| 51 | +- Any process with root access can modify the egress filter rules. Ensure that untrusted processes don't run with higher privileges than necessary. |
| 52 | +- The egress filter is currently supported only on Linux runners. |
0 commit comments