Skip to content

Commit c1877ce

Browse files
CopilotlpcoxCopilotCopilot
authored
Sync CLI docs and refresh compiled workflow artifacts for consistency checker (#2115)
* Initial plan * docs: sync CLI flag documentation with implementation Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/3d1c4bc9-2d27-4992-8793-cdafb4ec1fb4 * docs: clarify DIFC proxy flag wording Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/3d1c4bc9-2d27-4992-8793-cdafb4ec1fb4 * Update docs/usage.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Initial plan Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * chore: rebase main and recompile workflows Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/4f16749e-8ad3-433a-a9a6-e3eff88697da Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> * Revert broken lock file changes The Copilot agent incorrectly replaced all github/gh-aw-actions/setup@SHA references with ./actions/setup (a local path that doesn't exist) across all lock files. This reverts those changes, keeping only the documentation updates to docs/usage.md and docs-site CLI reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Landon Cox <landon.cox@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aac083b commit c1877ce

File tree

2 files changed

+173
-18
lines changed

2 files changed

+173
-18
lines changed

docs-site/src/content/docs/reference/cli-reference.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ awf [options] -- <command>
1919

2020
| Option | Type | Default | Description |
2121
|--------|------|---------|-------------|
22+
| `--config <path>` | string || Path to AWF JSON/YAML config file (use `-` to read from stdin) |
2223
| `--allow-domains <domains>` | string || Comma-separated list of allowed domains (optional; if not specified, all network access is blocked) |
2324
| `--allow-domains-file <path>` | string || Path to file containing allowed domains |
2425
| `--ruleset-file <path>` | string | `[]` | YAML rule file for domain allowlisting (repeatable) |
@@ -35,6 +36,7 @@ awf [options] -- <command>
3536
| `--image-registry <url>` | string | `ghcr.io/github/gh-aw-firewall` | Container image registry |
3637
| `--image-tag <tag>` | string | `latest` | Container image tag. Supports optional per-image digest pinning: `<tag>,squid=sha256:...,agent=sha256:...,agent-act=sha256:...,api-proxy=sha256:...,cli-proxy=sha256:...` |
3738
| `--skip-pull` | flag | `false` | Use local images without pulling from registry |
39+
| `--docker-host <socket>` | string | auto-detected | Docker socket for AWF's own containers |
3840
| `-e, --env <KEY=VALUE>` | string | `[]` | Environment variable (repeatable) |
3941
| `--env-all` | flag | `false` | Pass all host environment variables |
4042
| `--exclude-env <name>` | string | `[]` | Exclude a variable from `--env-all` passthrough (repeatable) |
@@ -44,8 +46,10 @@ awf [options] -- <command>
4446
| `--memory-limit <limit>` | string | `6g` | Memory limit for the agent container |
4547
| `--dns-servers <servers>` | string | Auto-detected | Trusted DNS servers (comma-separated; auto-detected from host, falls back to `8.8.8.8,8.8.4.4`) |
4648
| `--dns-over-https [resolver-url]` | optional string | `https://dns.google/dns-query` | Enable DNS-over-HTTPS via sidecar proxy |
49+
| `--upstream-proxy <url>` | string | auto-detected | Upstream (corporate) proxy URL for Squid to chain through |
4750
| `--proxy-logs-dir <path>` | string || Directory to save Squid proxy logs to |
4851
| `--audit-dir <path>` | string || Directory for firewall audit artifacts |
52+
| `--session-state-dir <path>` | string || Directory to save Copilot CLI session state |
4953
| `--enable-host-access` | flag | `false` | Enable access to host services via host.docker.internal |
5054
| `--allow-host-ports <ports>` | string | `80,443` | Ports to allow when using --enable-host-access |
5155
| `--allow-host-service-ports <ports>` | string || Ports to allow ONLY to host gateway (for GitHub Actions `services:`) |
@@ -58,15 +62,34 @@ awf [options] -- <command>
5862
| `--openai-api-base-path <path>` | string || Base path prefix for OpenAI API requests |
5963
| `--anthropic-api-target <host>` | string | `api.anthropic.com` | Target hostname for Anthropic API requests |
6064
| `--anthropic-api-base-path <path>` | string || Base path prefix for Anthropic API requests |
65+
| `--gemini-api-target <host>` | string | `generativelanguage.googleapis.com` | Target hostname for Gemini API requests |
66+
| `--gemini-api-base-path <path>` | string || Base path prefix for Gemini API requests |
6167
| `--rate-limit-rpm <n>` | number | `600` | Max requests per minute per provider |
6268
| `--rate-limit-rph <n>` | number | `10000` | Max requests per hour per provider |
6369
| `--rate-limit-bytes-pm <n>` | number | `52428800` (~50 MB) | Max request bytes per minute per provider |
6470
| `--no-rate-limit` | flag || Disable rate limiting in API proxy |
71+
| `--difc-proxy-host <host:port>` | string || Connect to external DIFC proxy and enable CLI proxy sidecar |
72+
| `--difc-proxy-ca-cert <path>` | string || Path to TLS CA cert for external DIFC proxy verification |
73+
| `--diagnostic-logs` | flag | `false` | Collect diagnostics on non-zero exit |
6574
| `-V, --version` | flag || Display version |
6675
| `-h, --help` | flag || Display help |
6776

6877
## Options Details
6978

79+
### `--config <path>`
80+
81+
Load AWF options from a JSON or YAML config file. Use `-` to read config from stdin.
82+
83+
CLI flags always take precedence over values loaded from the config file.
84+
85+
```bash
86+
# Load from file
87+
sudo awf --config ./awf.yml -- curl https://api.github.com
88+
89+
# Load from stdin
90+
cat awf.yml | sudo awf --config - -- curl https://api.github.com
91+
```
92+
7093
### `--allow-domains <domains>`
7194

7295
Comma-separated list of allowed domains. Domains automatically match all subdomains. Supports wildcard patterns, protocol-specific filtering, and special keywords.
@@ -370,6 +393,18 @@ When using `--skip-pull`, you are responsible for verifying image authenticity.
370393
The `--skip-pull` flag cannot be used with `--build-local` since building images requires pulling base images from the registry.
371394
:::
372395

396+
### `--docker-host <socket>`
397+
398+
Override the Docker socket used by AWF for its own container operations.
399+
400+
```bash
401+
sudo awf --docker-host unix:///run/user/1000/docker.sock \
402+
--allow-domains github.com \
403+
-- curl https://api.github.com
404+
```
405+
406+
The value must be a `unix://` socket URI.
407+
373408
### `-e, --env <KEY=VALUE>`
374409

375410
Pass environment variable to container. Can be specified multiple times.
@@ -508,6 +543,18 @@ Enable DNS-over-HTTPS (DoH) via a sidecar proxy. When enabled, DNS queries are e
508543
Use `--dns-over-https` without a value to use the Google DNS default. Provide a custom URL only if your environment requires a specific resolver.
509544
:::
510545

546+
### `--upstream-proxy <url>`
547+
548+
Configure Squid to chain outbound traffic through an upstream corporate proxy.
549+
550+
```bash
551+
sudo awf --upstream-proxy http://proxy.corp.com:3128 \
552+
--allow-domains github.com \
553+
-- curl https://api.github.com
554+
```
555+
556+
If omitted, AWF auto-detects host `https_proxy`/`http_proxy` settings.
557+
511558
### `--enable-host-access`
512559

513560
Enable access to host services via `host.docker.internal`. This allows containers to connect to services running on the host machine (e.g., local development servers, MCP gateways).
@@ -605,6 +652,16 @@ ls ./audit/
605652
Use `--audit-dir` in CI/CD pipelines to capture firewall configuration for audit trails. Can also be set via the `AWF_AUDIT_DIR` environment variable.
606653
:::
607654

655+
### `--session-state-dir <path>`
656+
657+
Directory to persist Copilot CLI session state (such as `events.jsonl`) during execution.
658+
659+
```bash
660+
sudo awf --session-state-dir ./session-state \
661+
--allow-domains github.com \
662+
-- copilot --prompt "hello"
663+
```
664+
608665
### `--agent-image <value>`
609666

610667
Specify the agent container image to use. Supports pre-built presets or custom base images.
@@ -777,6 +834,35 @@ sudo -E awf --enable-api-proxy \
777834
-- command
778835
```
779836

837+
### `--gemini-api-target <host>`
838+
839+
Target hostname for Gemini API requests. Useful for private gateways or compatible Gemini endpoints.
840+
841+
- **Default:** `generativelanguage.googleapis.com`
842+
- **Requires:** `--enable-api-proxy`
843+
844+
```bash
845+
sudo -E awf --enable-api-proxy \
846+
--gemini-api-target ai-gateway.internal.example.com \
847+
--allow-domains ai-gateway.internal.example.com \
848+
-- command
849+
```
850+
851+
### `--gemini-api-base-path <path>`
852+
853+
Base path prefix prepended to Gemini API requests.
854+
855+
- **Default:** none
856+
- **Requires:** `--enable-api-proxy`
857+
858+
```bash
859+
sudo -E awf --enable-api-proxy \
860+
--gemini-api-target ai-gateway.internal.example.com \
861+
--gemini-api-base-path /gemini \
862+
--allow-domains ai-gateway.internal.example.com \
863+
-- command
864+
```
865+
780866
### `--rate-limit-rpm <n>`
781867

782868
Maximum number of requests per minute per provider. Rate limiting is opt-in — it is only enabled when at least one `--rate-limit-*` flag is provided.
@@ -831,6 +917,33 @@ sudo -E awf --enable-api-proxy --no-rate-limit \
831917
-- command
832918
```
833919

920+
### `--difc-proxy-host <host:port>`
921+
922+
Connect to an external DIFC proxy (`mcpg`) and enable the CLI proxy sidecar for `gh` command routing.
923+
924+
```bash
925+
sudo awf --difc-proxy-host 127.0.0.1:5555 \
926+
--allow-domains github.com \
927+
-- gh repo view github/gh-aw-firewall
928+
```
929+
930+
### `--difc-proxy-ca-cert <path>`
931+
932+
Path to a CA certificate written by the external DIFC proxy. Recommended when using `--difc-proxy-host` over TLS.
933+
934+
```bash
935+
sudo awf --difc-proxy-host 127.0.0.1:5555 \
936+
--difc-proxy-ca-cert /tmp/mcpg-ca.crt \
937+
--allow-domains github.com \
938+
-- gh repo view github/gh-aw-firewall
939+
```
940+
941+
### `--diagnostic-logs`
942+
943+
Collect container logs, exit state, and a sanitized config snapshot when the wrapped command exits non-zero.
944+
945+
Diagnostic artifacts are written to `<workDir>/diagnostics/` (or `<audit-dir>/diagnostics/` when `--audit-dir` is set).
946+
834947
:::caution
835948
When using a custom `--openai-api-target` or `--anthropic-api-target`, you must add the target domain to `--allow-domains` so the firewall permits outbound traffic. AWF emits a warning if a custom target is set but not in the allowlist.
836949
:::
@@ -963,6 +1076,7 @@ awf predownload [options]
9631076
| `--image-tag <tag>` | string | `latest` | Container image tag (applies to squid, agent, agent-act, api-proxy, and cli-proxy images). Supports optional digest metadata — see [`--image-tag`](#--image-tag-tag) for format details. |
9641077
| `--agent-image <value>` | string | `default` | Agent image preset (`default`, `act`) or custom image |
9651078
| `--enable-api-proxy` | flag | `false` | Also download the API proxy image |
1079+
| `--difc-proxy` | flag | `false` | Also download the CLI proxy image used when runtime flag `--difc-proxy-host` is set |
9661080

9671081
:::tip
9681082
After pre-downloading, use `--skip-pull` on subsequent runs to skip pulling images at runtime.
@@ -977,6 +1091,9 @@ awf predownload
9771091
# Pre-download including the API proxy image
9781092
awf predownload --enable-api-proxy
9791093
1094+
# Pre-download including the CLI proxy image
1095+
awf predownload --difc-proxy
1096+
9801097
# Pre-download a specific version
9811098
awf predownload --image-tag v0.3.0
9821099

docs/usage.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
sudo awf [options] -- <command>
77
88
Options:
9+
--config <path> Path to AWF JSON/YAML config file (use "-" to read from stdin)
910
-d, --allow-domains <domains> Comma-separated list of allowed domains. Supports wildcards and protocol prefixes:
1011
- github.com: exact domain + subdomains (HTTP & HTTPS)
1112
- *.github.com: any subdomain of github.com
@@ -43,31 +44,44 @@ Options:
4344
default → agent:<tag>
4445
act → agent-act:<tag>
4546
--skip-pull Use local images without pulling from registry (requires images to be
46-
pre-downloaded) (default: false)
47+
pre-downloaded) (default: false)
48+
--docker-host <socket> Docker socket for AWF's own containers (default: auto-detect from
49+
DOCKER_HOST env). Example: unix:///run/user/1000/docker.sock
4750
-e, --env <KEY=VALUE> Additional environment variables to pass to container (can be
48-
specified multiple times)
51+
specified multiple times)
4952
--env-all Pass all host environment variables to container (excludes system vars
50-
like PATH) (default: false)
51-
-v, --mount <path:path> Volume mount (can be specified multiple times). Format:
52-
host_path:container_path[:ro|rw]
53+
like PATH) (default: false)
54+
--exclude-env <name> Exclude a specific environment variable from --env-all passthrough
55+
(can be specified multiple times)
56+
--env-file <path> Read environment variables from a file (KEY=VALUE format, one per line)
57+
-v, --mount <host_path:container_path[:ro|rw]> Volume mount (can be specified multiple times). Format:
58+
host_path:container_path[:ro|rw]
5359
--container-workdir <dir> Working directory inside the container (should match GITHUB_WORKSPACE
5460
for path consistency)
5561
--dns-servers <servers> Comma-separated list of trusted DNS servers. DNS traffic is ONLY
56-
allowed to these servers (default: 8.8.8.8,8.8.4.4)
62+
allowed to these servers (default: auto-detected from host resolvers,
63+
falls back to 8.8.8.8,8.8.4.4)
64+
--upstream-proxy <url> Upstream (corporate) proxy URL for Squid to chain through.
65+
Auto-detected from host https_proxy/http_proxy if not set.
5766
--proxy-logs-dir <path> Directory to save Squid proxy logs to (writes access.log directly to
58-
this directory)
67+
this directory)
68+
--audit-dir <path> Directory for firewall audit artifacts (configs, policy manifest,
69+
iptables state)
5970
--session-state-dir <path> Directory to save Copilot CLI session state (events.jsonl, session
60-
data). Writes directly during execution (timeout-safe, predictable
61-
path). Also configurable via AWF_SESSION_STATE_DIR env var.
71+
data). Writes directly during execution (timeout-safe, predictable
72+
path). Also configurable via AWF_SESSION_STATE_DIR env var.
6273
--enable-host-access Enable access to host services via host.docker.internal. Security
6374
warning: When combined with --allow-domains host.docker.internal,
6475
containers can access ANY service on the host machine. (default: false)
6576
--allow-host-ports <ports> Comma-separated list of ports or port ranges to allow when using
66-
--enable-host-access. By default, only ports 80 and 443 are allowed.
67-
Example: --allow-host-ports 3000 or --allow-host-ports 3000,8080 or
68-
--allow-host-ports 3000-3010,8000-8090
77+
--enable-host-access. By default, only ports 80 and 443 are allowed.
78+
Example: --allow-host-ports 3000 or --allow-host-ports 3000,8080 or
79+
--allow-host-ports 3000-3010,8000-8090
80+
--allow-host-service-ports <ports> Comma-separated ports to allow ONLY to host gateway
81+
(for GitHub Actions services). Auto-enables host access.
82+
Example: --allow-host-service-ports 5432,6379
6983
--ssl-bump Enable SSL Bump for HTTPS content inspection (allows URL path
70-
filtering for HTTPS) (default: false)
84+
filtering for HTTPS) (default: false)
7185
--allow-urls <urls> Comma-separated list of allowed URL patterns for HTTPS (requires --ssl-bump).
7286
Supports wildcards: https://github.com/myorg/*
7387
--enable-api-proxy Enable API proxy sidecar for holding authentication credentials.
@@ -76,29 +90,46 @@ Options:
7690
--copilot-api-target <host> Target hostname for Copilot API requests
7791
(default: api.githubcopilot.com)
7892
--openai-api-target <host> Target hostname for OpenAI API requests (default: api.openai.com)
93+
--openai-api-base-path <path> Base path prefix for OpenAI API requests
7994
--anthropic-api-target <host> Target hostname for Anthropic API requests
80-
(default: api.anthropic.com)
95+
(default: api.anthropic.com)
96+
--anthropic-api-base-path <path> Base path prefix for Anthropic API requests
97+
--gemini-api-target <host> Target hostname for Gemini API requests
98+
(default: generativelanguage.googleapis.com)
99+
--gemini-api-base-path <path> Base path prefix for Gemini API requests
81100
--rate-limit-rpm <n> Max requests per minute per provider (requires --enable-api-proxy)
82101
--rate-limit-rph <n> Max requests per hour per provider (requires --enable-api-proxy)
83102
--rate-limit-bytes-pm <n> Max request bytes per minute per provider (requires --enable-api-proxy)
84103
--no-rate-limit Disable rate limiting in the API proxy (requires --enable-api-proxy)
104+
--difc-proxy-host <host:port> Connect to an external DIFC proxy (Multi-Cloud Proxy Gateway, "mcpg")
105+
and enable the CLI proxy sidecar for gh command routing
106+
--difc-proxy-ca-cert <path> Path to TLS CA cert written by external DIFC proxy
85107
--ruleset-file <path> YAML rule file for domain allowlisting (repeatable).
86-
Schema: version: 1, rules: [{domain, subdomains}]
108+
Schema: version: 1, rules: [{domain, subdomains}]
87109
--dns-over-https [url] Enable DNS-over-HTTPS via sidecar proxy
88110
(default: https://dns.google/dns-query)
89-
--memory-limit <limit> Memory limit for the agent container (default: 2g)
90-
Examples: 1g, 4g, 512m
111+
--memory-limit <limit> Memory limit for the agent container (default: 6g)
112+
Examples: 1g, 4g, 512m
91113
--enable-dind Enable Docker-in-Docker by exposing host Docker socket.
92114
WARNING: allows firewall bypass via docker run (default: false)
93115
--enable-dlp Enable DLP (Data Loss Prevention) scanning to block credential
94-
exfiltration in outbound request URLs. (default: false)
116+
exfiltration in outbound request URLs. (default: false)
117+
--diagnostic-logs Collect container logs, exit state, and sanitized config on non-zero
118+
exit. Written to <workDir>/diagnostics/ (or <audit-dir>/diagnostics/)
95119
-V, --version Output the version number
96120
-h, --help Display help for command
97121
98122
Arguments:
99123
command Command to execute (wrap in quotes, use -- separator)
100124
101125
Commands:
126+
predownload [options] Pre-download Docker images for offline use or faster startup
127+
--image-registry <registry> Container image registry (default: ghcr.io/github/gh-aw-firewall)
128+
--image-tag <tag> Container image tag (default: latest)
129+
--agent-image <value> Agent image preset (default, act) or custom image
130+
--enable-api-proxy Also download the API proxy image
131+
--difc-proxy Also download the CLI proxy image (for --difc-proxy-host)
132+
102133
logs [options] View and analyze Squid proxy logs
103134
-f, --follow Follow log output in real-time (like tail -f)
104135
--format <format> Output format: raw, pretty (colorized), json
@@ -113,6 +144,13 @@ Commands:
113144
logs summary [options] Generate summary report (markdown by default)
114145
--format <format> Output format: json, markdown, pretty
115146
--source <path> Path to log directory or "running" for live container
147+
148+
logs audit [options] Show firewall audit with policy rule matching
149+
--format <format> Output format: json, markdown, pretty
150+
--source <path> Path to log directory or "running" for live container
151+
--rule <id> Filter to specific rule ID
152+
--domain <domain> Filter to specific domain
153+
--decision <decision> Filter to "allowed" or "denied"
116154
```
117155

118156
## Basic Examples

0 commit comments

Comments
 (0)