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
feat(api-proxy): centralize port configuration in types.ts (#955)
* Initial plan
* feat(api-proxy): centralize port configuration in types.ts
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* docs: document environment variables for all three containers
Add comprehensive environment variable documentation for squid, api-proxy,
and agent containers. Clearly document which token variables are redacted
with placeholder values ('placeholder-token-for-credential-isolation') in
the agent container for credential isolation.
Key additions:
- Separate tables for each container's environment variables
- Document real credentials in api-proxy vs placeholders in agent
- Explain one-shot-token protection mechanism
- Include all three API proxy endpoints (OpenAI, Anthropic, Copilot)
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
---------
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
When API keys are provided, AWF sets these environment variables in the agent container:
106
+
AWF manages environment variables differently across the three containers (squid, api-proxy, agent) to ensure secure credential isolation.
107
+
108
+
### Squid container
109
+
110
+
The Squid proxy container runs with minimal environment variables:
111
+
112
+
| Variable | Value | Description |
113
+
|----------|-------|-------------|
114
+
|`HTTP_PROXY`| Not set | Squid is the proxy, not a client |
115
+
|`HTTPS_PROXY`| Not set | Squid is the proxy, not a client |
116
+
117
+
### API proxy container
118
+
119
+
The API proxy sidecar receives **real credentials** and routing configuration:
120
+
121
+
| Variable | Value | When set | Description |
122
+
|----------|-------|----------|-------------|
123
+
|`OPENAI_API_KEY`| Real API key |`--enable-api-proxy` and env set | OpenAI API key (injected into requests) |
124
+
|`ANTHROPIC_API_KEY`| Real API key |`--enable-api-proxy` and env set | Anthropic API key (injected into requests) |
125
+
|`COPILOT_GITHUB_TOKEN`| Real token |`--enable-api-proxy` and env set | GitHub Copilot token (injected into requests) |
126
+
|`HTTP_PROXY`|`http://172.30.0.10:3128`| Always | Routes through Squid for domain filtering |
127
+
|`HTTPS_PROXY`|`http://172.30.0.10:3128`| Always | Routes through Squid for domain filtering |
128
+
129
+
:::danger[Real credentials in api-proxy]
130
+
The api-proxy container holds **real, unredacted credentials**. These are used to authenticate requests to LLM providers. This container is isolated from the agent and has all capabilities dropped for security.
131
+
:::
132
+
133
+
### Agent container
134
+
135
+
The agent container receives **redacted placeholders** and proxy URLs:
107
136
108
137
| Variable | Value | When set | Description |
109
138
|----------|-------|----------|-------------|
110
-
|`OPENAI_BASE_URL`|`http://172.30.0.30:10000/v1`|`OPENAI_API_KEY` is set | OpenAI API proxy endpoint |
111
-
|`ANTHROPIC_BASE_URL`|`http://172.30.0.30:10001`|`ANTHROPIC_API_KEY` is set | Anthropic API proxy endpoint |
139
+
|`OPENAI_BASE_URL`|`http://172.30.0.30:10000/v1`|`OPENAI_API_KEY` provided to host | Redirects OpenAI SDK to proxy |
140
+
|`ANTHROPIC_BASE_URL`|`http://172.30.0.30:10001`|`ANTHROPIC_API_KEY` provided to host | Redirects Anthropic SDK to proxy |
141
+
|`ANTHROPIC_AUTH_TOKEN`|`placeholder-token-for-credential-isolation`|`ANTHROPIC_API_KEY` provided to host | Placeholder token (real auth via BASE_URL) |
142
+
|`CLAUDE_CODE_API_KEY_HELPER`|`/usr/local/bin/get-claude-key.sh`|`ANTHROPIC_API_KEY` provided to host | Helper script for Claude Code CLI |
143
+
|`COPILOT_API_URL`|`http://172.30.0.30:10002`|`COPILOT_GITHUB_TOKEN` provided to host | Redirects Copilot CLI to proxy |
144
+
|`COPILOT_TOKEN`|`placeholder-token-for-credential-isolation`|`COPILOT_GITHUB_TOKEN` provided to host | Placeholder token (real auth via API_URL) |
145
+
|`COPILOT_GITHUB_TOKEN`|`placeholder-token-for-credential-isolation`|`COPILOT_GITHUB_TOKEN` provided to host | Placeholder token protected by one-shot-token |
146
+
|`OPENAI_API_KEY`| Not set |`--enable-api-proxy`| Excluded from agent (held in api-proxy) |
147
+
|`ANTHROPIC_API_KEY`| Not set |`--enable-api-proxy`| Excluded from agent (held in api-proxy) |
148
+
|`HTTP_PROXY`|`http://172.30.0.10:3128`| Always | Routes through Squid proxy |
149
+
|`HTTPS_PROXY`|`http://172.30.0.10:3128`| Always | Routes through Squid proxy |
150
+
|`NO_PROXY`|`localhost,127.0.0.1,172.30.0.30`|`--enable-api-proxy`| Bypass proxy for localhost and api-proxy |
151
+
|`AWF_API_PROXY_IP`|`172.30.0.30`|`--enable-api-proxy`| Used by iptables setup script |
152
+
|`AWF_ONE_SHOT_TOKENS`|`COPILOT_GITHUB_TOKEN,GITHUB_TOKEN,...`| Always | Tokens protected by one-shot-token library |
153
+
154
+
:::tip[Placeholder tokens]
155
+
Token variables in the agent are set to `placeholder-token-for-credential-isolation` instead of real values. This ensures:
156
+
- Agent code cannot exfiltrate credentials
157
+
- CLI tools that check for token presence still work
158
+
- Real authentication happens via the `*_BASE_URL` or `*_API_URL` environment variables
159
+
- The one-shot-token library protects placeholder values from being read more than once
160
+
:::
112
161
113
-
These are standard environment variables recognized by:
0 commit comments