Skip to content

Commit 985d903

Browse files
committed
Merge main into copilot/add-version-parameter-install-script and resolve conflict
2 parents 993e23c + 7930bb8 commit 985d903

1 file changed

Lines changed: 32 additions & 194 deletions

File tree

README.md

Lines changed: 32 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,35 @@ A network firewall for agentic workflows with domain whitelisting. This tool pro
55
> [!TIP]
66
> This project is a part of GitHub Next's explorations of [Agentic Workflows](https://github.com/githubnext/gh-aw). For more background, check out the [project page on the GitHub Next website](https://githubnext.com/projects/agentic-workflows/)! ✨
77
8-
## Features
8+
## What it does
99

1010
- **L7 Domain Whitelisting**: Control HTTP/HTTPS traffic at the application layer
1111
- **Host-Level Enforcement**: Uses iptables DOCKER-USER chain to enforce firewall on ALL containers
1212
- **Docker-in-Docker Support**: Spawned containers inherit firewall restrictions
1313

14-
## Quick Start
14+
## Get started fast
1515

16-
### Requirements
16+
- **Requirement:** Docker running on your machine
17+
- **Install:**
18+
```bash
19+
curl -sSL https://raw.githubusercontent.com/githubnext/gh-aw-firewall/main/install.sh | sudo bash
20+
```
21+
Review the script before running, or download the latest release binary and verify it with the published `checksums.txt` before installing.
22+
- **Run your first command:**
23+
```bash
24+
sudo awf --allow-domains github.com -- curl https://api.github.com
25+
```
26+
Use the `--` separator to pass the command you want to run behind the firewall.
1727

18-
- **Docker**: Must be running
28+
### GitHub Copilot CLI in one line
1929

20-
### Installation
30+
```bash
31+
sudo -E awf \
32+
--allow-domains github.com,api.github.com,githubusercontent.com \
33+
-- copilot --prompt "List my repositories"
34+
```
2135

22-
**Recommended: One-line installer with SHA verification**
36+
### Installation Options
2337

2438
```bash
2539
# Install latest version
@@ -61,197 +75,21 @@ sudo awf --help
6175

6276
**Docker Image Verification:** All published container images are cryptographically signed with cosign. See [docs/image-verification.md](docs/image-verification.md) for verification instructions.
6377

64-
### Basic Usage
65-
66-
```bash
67-
# Simple HTTP request
68-
sudo awf \
69-
--allow-domains github.com,api.github.com \
70-
-- curl https://api.github.com
71-
72-
# With GitHub Copilot CLI
73-
sudo -E awf \
74-
--allow-domains github.com,api.github.com,googleapis.com \
75-
-- copilot --prompt "List my repositories"
76-
77-
# Docker-in-Docker (spawned containers inherit firewall)
78-
sudo awf \
79-
--allow-domains api.github.com,registry-1.docker.io,auth.docker.io \
80-
-- docker run --rm curlimages/curl -fsS https://api.github.com/zen
81-
```
82-
83-
**Note:** Always use the `--` separator to pass commands and arguments. This ensures proper argument handling and avoids shell escaping issues.
84-
85-
### Log Viewing
86-
87-
View Squid proxy logs from current or previous runs:
88-
89-
```bash
90-
# View recent logs with pretty formatting
91-
awf logs
92-
93-
# Follow logs in real-time
94-
awf logs -f
95-
96-
# View logs in JSON format for scripting
97-
awf logs --format json
98-
99-
# List all available log sources
100-
awf logs --list
101-
```
102-
103-
## Domain Whitelisting
104-
105-
Domains automatically match all subdomains:
106-
107-
```bash
108-
# github.com matches api.github.com, raw.githubusercontent.com, etc.
109-
sudo awf --allow-domains github.com -- curl https://api.github.com # ✓ works
110-
```
111-
112-
### Wildcard Patterns
113-
114-
You can use wildcard patterns with `*` to match multiple domains:
115-
116-
```bash
117-
# Match any subdomain of github.com
118-
--allow-domains '*.github.com'
119-
120-
# Match api-v1.example.com, api-v2.example.com, etc.
121-
--allow-domains 'api-*.example.com'
122-
123-
# Combine plain domains and wildcards
124-
--allow-domains 'github.com,*.googleapis.com,api-*.example.com'
125-
```
126-
127-
**Pattern rules:**
128-
- `*` matches any characters (converted to regex `.*`)
129-
- Patterns are case-insensitive (DNS is case-insensitive)
130-
- Overly broad patterns like `*`, `*.*`, or `*.*.*` are rejected for security
131-
- Use quotes around patterns to prevent shell expansion
132-
133-
**Examples:**
134-
| Pattern | Matches | Does Not Match |
135-
|---------|---------|----------------|
136-
| `*.github.com` | `api.github.com`, `raw.github.com` | `github.com` |
137-
| `api-*.example.com` | `api-v1.example.com`, `api-test.example.com` | `api.example.com` |
138-
| `github.com` | `github.com`, `api.github.com` | `notgithub.com` |
139-
140-
### Using Command-Line Flag
141-
142-
Common domain lists:
143-
144-
```bash
145-
# For GitHub Copilot with GitHub API
146-
--allow-domains github.com,api.github.com,githubusercontent.com,googleapis.com
147-
148-
# For MCP servers
149-
--allow-domains github.com,arxiv.org,example.com
150-
```
151-
152-
### Using a Domains File
153-
154-
You can also specify domains in a file using `--allow-domains-file`:
155-
156-
```bash
157-
# Create a domains file (see examples/domains.txt)
158-
cat > allowed-domains.txt << 'EOF'
159-
# GitHub domains
160-
github.com
161-
api.github.com
162-
163-
# NPM registry
164-
npmjs.org, registry.npmjs.org
165-
166-
# Wildcard patterns
167-
*.googleapis.com
168-
169-
# Example with inline comment
170-
example.com # Example domain
171-
EOF
172-
173-
# Use the domains file
174-
sudo awf --allow-domains-file allowed-domains.txt -- curl https://api.github.com
175-
```
176-
177-
**File format:**
178-
- One domain per line or comma-separated
179-
- Comments start with `#` (full line or inline)
180-
- Empty lines are ignored
181-
- Whitespace is trimmed
182-
- Wildcard patterns are supported
183-
184-
**Combining both methods:**
185-
```bash
186-
# You can use both flags together - domains are merged
187-
sudo awf \
188-
--allow-domains github.com \
189-
--allow-domains-file my-domains.txt \
190-
-- curl https://api.github.com
191-
```
192-
193-
194-
## Security Considerations
195-
196-
### What This Protects Against
197-
- Unauthorized egress to non-whitelisted domains
198-
- Data exfiltration via HTTP/HTTPS
199-
- DNS-based data exfiltration to unauthorized DNS servers
200-
- MCP servers accessing unexpected endpoints
201-
202-
### Agent Container Security (User Mode)
78+
## Explore the docs
20379

204-
The agent container runs user commands as a **non-root user** (`awfuser`) for enhanced security:
80+
- [Quick start](docs/quickstart.md) — install, verify, and run your first command
81+
- [Usage guide](docs/usage.md) — CLI flags, domain allowlists, Docker-in-Docker examples
82+
- [Logging quick reference](docs/logging_quickref.md) and [Squid log filtering](docs/squid_log_filtering.md) — view and filter traffic
83+
- [Security model](docs/security.md) — what the firewall protects and how
84+
- [Architecture](docs/architecture.md) — how Squid, Docker, and iptables fit together
85+
- [Troubleshooting](docs/troubleshooting.md) — common issues and fixes
86+
- [Image verification](docs/image-verification.md) — cosign signature verification
20587

206-
- **Privilege Separation**: Privileged operations (iptables setup, DNS configuration) run as root in the entrypoint, then privileges are dropped before executing user commands
207-
- **UID/GID Matching**: The `awfuser` UID/GID is automatically adjusted to match the host user's UID/GID, ensuring correct file ownership for mounted volumes
208-
- **Reduced Attack Surface**: If a user command is compromised, it cannot modify system files or escape the container's security boundaries
209-
- **Docker Access**: The `awfuser` is added to the docker group, allowing MCP servers to spawn containers while still running as non-root
88+
## Development
21089

211-
**Note:** The `awf` CLI itself requires `sudo` for host-level iptables configuration (DOCKER-USER chain), but the agent processes (GitHub Copilot CLI, etc.) run without root privileges inside the container.
212-
213-
### DNS Server Restriction
214-
215-
DNS traffic is restricted to trusted servers only (default: Google DNS 8.8.8.8, 8.8.4.4). This prevents DNS-based data exfiltration attacks where an attacker encodes data in DNS queries to a malicious DNS server.
216-
217-
```bash
218-
# Use custom DNS servers
219-
sudo awf \
220-
--allow-domains github.com \
221-
--dns-servers 1.1.1.1,1.0.0.1 \
222-
-- curl https://api.github.com
223-
```
224-
225-
## Development & Testing
226-
227-
### Running Tests
228-
229-
```bash
230-
# Install dependencies
231-
npm install
232-
233-
# Run all tests
234-
npm test
235-
236-
# Run tests with coverage report
237-
npm run test:coverage
238-
239-
# Run tests in watch mode
240-
npm run test:watch
241-
```
242-
243-
### Building
244-
245-
```bash
246-
# Build TypeScript
247-
npm run build
248-
249-
# Run linter
250-
npm run lint
251-
252-
# Clean build artifacts
253-
npm run clean
254-
```
90+
- Install dependencies: `npm install`
91+
- Run tests: `npm test`
92+
- Build: `npm run build`
25593

25694
## Contributing
25795

0 commit comments

Comments
 (0)