# sandbox: Replace allow_network bool with a NetworkAccess enum \(\#59218\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bf746a7a26b7d40dad2c02ab82cb8f74e42784d1)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bf746a7a26b7d40dad2c02ab82cb8f74e42784d1

Requested commit: bf746a7a26b7d40dad2c02ab82cb8f74e42784d1

Commit: bf746a7a26b7d40dad2c02ab82cb8f74e42784d1

Tree: d3bdcc1749a9da6e22a4311ef65bc0ac39bea86a

Author: Richard Feldman

Committer: GitHub

## Message

```
sandbox: Replace allow_network bool with a NetworkAccess enum (#59218)

Fourth PR of the stack adding hostname-allowlisted network access to
agent terminal sandboxing. Stacked on the `http_proxy` crate PRs
(#59217, #59222, #59223) — review/merge those first; this PR's diff is
only the sandbox change.

Replaces the `allow_network: bool` field on the macOS Seatbelt
`SandboxPermissions` with a `NetworkAccess` enum: `None` (block all
egress), `All` (the previous `allow_network: true` behavior), and
`LocalhostPort(u16)`, which confines a sandboxed command to a single
loopback port. The new variant emits a Seatbelt rule permitting outbound
TCP only to `localhost:<port>` and isn't constructed yet; it exists to
pin sandboxed commands to the in-process network proxy in a later PR.
The sole consumer maps its existing boolean to `All`/`None`, so behavior
is unchanged.

Release Notes:

- N/A
```

## Parents

- [50b2f63cfe35dd7c0095d1e996305b7c12ff0bff](https://git.cafe/gitcafe/zed/commit/50b2f63cfe35dd7c0095d1e996305b7c12ff0bff?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bf746a7a26b7d40dad2c02ab82cb8f74e42784d1?format=markdown)
