Skip to content

Commit 373fd11

Browse files
committed
docs: document sandbox-scoped kit network policies
Kit network policy docs did not cover sandbox-scoped rules or kit-level deniedDomains. Update the Sandboxes policy and kits pages with scoped policy examples, deniedDomains guidance, and a small policy page formatting fix. Co-Authored-By: Codex <noreply@openai.com> noreply@openai.com> oreply@openai.com>
1 parent 1414b91 commit 373fd11

4 files changed

Lines changed: 56 additions & 16 deletions

File tree

content/manuals/ai/sandboxes/customize/build-an-agent.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ agent can't reach it.
113113

114114
## Allow network access
115115

116-
The network block does two things: it lists the hosts the sandbox is
117-
allowed to reach (`allowedDomains`), and it wires the kit-side half of
118-
the auth flow from [Plan authentication](#plan-authentication)
119-
(`serviceDomains` + `serviceAuth`).
116+
The network block does two things: it lists the hosts the sandbox can
117+
reach (`allowedDomains`), and it wires the kit-side half of the auth flow
118+
from [Plan authentication](#plan-authentication) with `serviceDomains` and
119+
`serviceAuth`.
120120

121121
```yaml
122122
network:
@@ -136,6 +136,10 @@ install/CDN subdomains (`*.ampcode.com`). Treat it as a starting point;
136136
Amp may reach other domains (model providers, analytics, updates) that
137137
you'll discover by watching `sbx policy log` while testing.
138138

139+
Kits can also declare `deniedDomains` for hosts the sandbox should not
140+
reach, such as telemetry endpoints. Deny rules take precedence over
141+
allow rules and apply only to sandboxes that use the kit.
142+
139143
For the auth wiring, when the agent makes an outbound request to
140144
`ampcode.com`, the proxy looks up the host in `serviceDomains` to find
141145
the service id `amp`, then uses `serviceAuth.amp` to inject an
@@ -279,6 +283,8 @@ Two loops help:
279283

280284
- Watch the network policy log (`sbx policy log`) to catch blocked
281285
requests, then add their domains to `allowedDomains`.
286+
- Add domains to `deniedDomains` when the agent should stay blocked from
287+
a host even if another policy permits it.
282288
- Edit the spec and re-run `sbx run --kit ./amp/ amp` to pick up changes.
283289
Remove the sandbox first (`sbx rm <name>`) for a clean start.
284290

@@ -304,7 +310,8 @@ the same decisions for your agent:
304310
into a custom image. Pick install if it's a one-line script; bake if
305311
the install is slow or you need a pinned version.
306312
- **Network mapping**: list only the API host in `serviceDomains`, not
307-
a wildcard. Keep install/CDN paths out of TLS-intercepting mode.
313+
a wildcard. Keep install/CDN paths out of TLS-intercepting mode. Use
314+
`deniedDomains` for hosts the agent should not reach.
308315
- **Credential injection**: if the agent validates the API key's format
309316
locally, register with `sbx secret set-custom` and pick a matching
310317
placeholder. If it accepts the env var as-is, declare

content/manuals/ai/sandboxes/customize/kits.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ A kit packages a set of capabilities a sandbox can use, such as:
1818
- Tools to install
1919
- Environment variables to set
2020
- Credentials to inject
21-
- Domains to allow
21+
- Network rules to allow or deny domains
2222
- Files to drop in
2323
- Startup commands to run
2424

2525
You declare these in a single `spec.yaml` file, point the CLI at the
2626
directory (or a ZIP, OCI artifact, or Git URL), and the sandbox applies
2727
and enforces them at runtime. Credentials stay on the host and go through
2828
a proxy instead of entering the VM, and outbound traffic is restricted to
29-
the domains the kit allows.
29+
the domains permitted by the kit's network rules.
3030

3131
A kit is either a mixin or an agent:
3232

@@ -113,15 +113,23 @@ be visible inside the sandbox VM.
113113

114114
### Control network access
115115

116-
Network rules define which domains the sandbox can reach:
116+
Network rules define which domains the sandbox can reach or block. Kit
117+
network rules apply only to sandboxes that use the kit:
117118

118119
```yaml
119120
network:
120121
allowedDomains:
121122
- api.example.com
122123
- "*.cdn.example.com"
124+
deniedDomains:
125+
- telemetry.example.com
123126
```
124127

128+
Use `allowedDomains` for hosts the agent needs, such as package
129+
registries, install endpoints, or external APIs. Use `deniedDomains` for
130+
hosts the agent should not reach, such as telemetry endpoints. If a domain
131+
matches both an allow rule and a deny rule, the deny rule wins.
132+
125133
For authenticated services, see
126134
[Authenticate to external services](#authenticate-to-external-services).
127135

@@ -441,6 +449,7 @@ Service identifiers link credentials to [network rules](#network).
441449
```yaml
442450
network:
443451
allowedDomains: [<domain>, ...]
452+
deniedDomains: [<domain>, ...]
444453
serviceDomains:
445454
<domain>: <service-id>
446455
serviceAuth:
@@ -452,6 +461,7 @@ network:
452461
| Field | Description |
453462
| ------------------------- | ---------------------------------------------------------------- |
454463
| `allowedDomains` | Domains the sandbox can reach. Wildcards supported. |
464+
| `deniedDomains` | Domains the sandbox can't reach. Deny rules take precedence. |
455465
| `serviceDomains` | Map of domain to service identifier from `credentials.sources`. |
456466
| `serviceAuth.headerName` | HTTP header the proxy sets (for example, `Authorization`). |
457467
| `serviceAuth.valueFormat` | Format string for the header value (for example, `"Bearer %s"`). |

content/manuals/ai/sandboxes/security/defaults.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ it (deny-by-default). All non-HTTP protocols (raw TCP, UDP including DNS, and
1818
ICMP) are blocked at the network layer. Traffic to private IP ranges, loopback
1919
addresses, and link-local addresses is also blocked.
2020

21-
Run `sbx policy ls` to see the active allow rules for your installation. To
21+
Run `sbx policy ls` to see the active network rules for your installation. To
2222
customize network access, see [Policies](policy.md).
2323

2424
## Workspace defaults

content/manuals/ai/sandboxes/security/policy.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Sandboxes are [network-isolated](isolation.md) from your host and from each
1111
other. A policy system controls what a sandbox can access over the network.
1212

1313
Use the `sbx policy` command to configure network access rules. Rules apply
14-
to all sandboxes on the machine.
14+
to all sandboxes on the machine by default. Network allow, deny, list, and
15+
remove commands can also target one sandbox with `--sandbox`.
1516

1617
## Network policies
1718

@@ -72,13 +73,21 @@ services. Run `sbx policy ls` to see the active rules for your installation.
7273

7374
Use [`sbx policy allow`](/reference/cli/sbx/policy/allow/) and
7475
[`sbx policy deny`](/reference/cli/sbx/policy/deny/) to add network access
75-
rules. Changes take effect immediately and apply to all sandboxes:
76+
rules. Changes take effect immediately. By default, they apply to all
77+
sandboxes:
7678

7779
```console
7880
$ sbx policy allow network api.anthropic.com
7981
$ sbx policy deny network ads.example.com
8082
```
8183

84+
Use `--sandbox` to scope a rule to one sandbox:
85+
86+
```console
87+
$ sbx policy allow network --sandbox my-sandbox api.example.com
88+
$ sbx policy deny network --sandbox my-sandbox ads.example.com
89+
```
90+
8291
Specify multiple hosts in one command with a comma-separated list:
8392

8493
```console
@@ -89,12 +98,19 @@ List all active policy rules with `sbx policy ls`:
8998

9099
```console
91100
$ sbx policy ls
92-
ID TYPE DECISION RESOURCES
93-
a1b2c3d4-e5f6-7890-abcd-ef1234567890 network allow api.anthropic.com, *.npmjs.org
94-
f9e8d7c6-b5a4-3210-fedc-ba0987654321 network deny ads.example.com
101+
NAME TYPE ORIGIN DECISION STATUS RESOURCES
102+
balanced-dev network local allow active api.anthropic.com
103+
ads-block network local deny active ads.example.com
104+
kit:my-sandbox network sandbox:my-sandbox allow active api.example.com
105+
kit:my-sandbox:deny network sandbox:my-sandbox deny active telemetry.example.com
95106
```
96107

97-
Use `--type network` to show only network policies.
108+
Use `--type network` to show only network policies. Use `--sandbox` to show
109+
global rules plus rules scoped to one sandbox:
110+
111+
```console
112+
$ sbx policy ls --sandbox my-sandbox
113+
```
98114

99115
Remove a policy by resource or by rule ID:
100116

@@ -103,6 +119,12 @@ $ sbx policy rm network --resource ads.example.com
103119
$ sbx policy rm network --id 2d3c1f0e-4a73-4e05-bc9d-f2f9a4b50d67
104120
```
105121

122+
To remove a sandbox-scoped policy, include the sandbox name:
123+
124+
```console
125+
$ sbx policy rm network --sandbox my-sandbox --resource api.example.com
126+
```
127+
106128
### Resetting to defaults
107129

108130
To remove all custom policies and restore the default policy, use
@@ -202,7 +224,8 @@ machine-readable output, or `--type network` to filter by policy type.
202224

203225
All outbound traffic is blocked by default unless an explicit rule allows it.
204226
If a domain matches both an allow and a deny rule, the deny rule wins
205-
regardless of specificity.
227+
regardless of specificity. A sandbox-scoped deny rule can block a domain for
228+
one sandbox even when a global rule permits the same domain.
206229

207230
To unblock a domain, find the deny rule with `sbx policy ls` and remove it
208231
with `sbx policy rm`.

0 commit comments

Comments
 (0)