Network Rules
Network policy controls ordinary network access for shell, process, and built-in tools.
Built-in behavior:
| Preset | Network |
|---|---|
workspace | Proxy-mediated. Localhost is allowed. Private destinations may ask. Link-local is denied. |
readonly | Denied. |
danger | Allowed. |
In proxy mode, DuckAgent checks both the requested host and resolved addresses. A deny on either side blocks the request. An ask on either side triggers approval.
Proxy environment
Section titled “Proxy environment”When network.mode is proxy, DuckAgent starts a managed local proxy and passes proxy settings to sandboxed child processes.
The proxy env covers common HTTP, HTTPS, WebSocket, npm, and Yarn clients:
HTTP_PROXYHTTPS_PROXYALL_PROXYWS_PROXYWSS_PROXYhttp_proxyhttps_proxyall_proxyws_proxywss_proxyNPM_CONFIG_PROXYNPM_CONFIG_HTTP_PROXYNPM_CONFIG_HTTPS_PROXYYARN_HTTP_PROXYYARN_HTTPS_PROXYNo-proxy variables are cleared so requests do not bypass DuckAgent’s policy:
NO_PROXYno_proxyNPM_CONFIG_NO_PROXYNPM_CONFIG_NOPROXYnpm_config_no_proxynpm_config_noproxyYARN_NO_PROXYyarn_no_proxyGLOBAL_AGENT_NO_PROXYglobal_agent_no_proxyThe proxy evaluates the target host and resolved IP address before forwarding. If the parent process already uses an upstream proxy, DuckAgent can forward through that upstream while still enforcing sandbox policy first.
Env-backed network requests
Section titled “Env-backed network requests”Sandbox env can define secret-backed requests. In that mode, the child process does not receive the real token. It receives:
- a placeholder token value such as
duckagent-secret:OPENAI_API_KEY; - a rewritten base URL such as
http://127.0.0.1:<port>/__duckagent_secret/OPENAI_API_KEY.
Requests to that local URL are reverse-proxied to the configured upstream URL. DuckAgent injects the real secret into the configured header before sending the upstream request.
See Environment & Secrets for the full config example.
MCP servers that connect through their own transport are not controlled only by ordinary network rules. Use MCP config and permissions.tools for those boundaries.