Commit dd30c8e
authored
chore: refactor network permissions to use explicit domain and unix socket rule maps (openai#15120)
## Summary
This PR replaces the legacy network allow/deny list model with explicit
rule maps for domains and unix sockets across managed requirements,
permissions profiles, the network proxy config, and the app server
protocol.
Concretely, it:
- introduces typed domain (`allow` / `deny`) and unix socket permission
(`allow` / `none`) entries instead of separate `allowed_domains`,
`denied_domains`, and `allow_unix_sockets` lists
- updates config loading, managed requirements merging, and exec-policy
overlays to read and upsert rule entries consistently
- exposes the new shape through protocol/schema outputs, debug surfaces,
and app-server config APIs
- rejects the legacy list-based keys and updates docs/tests to reflect
the new config format
## Why
The previous representation split related network policy across multiple
parallel lists, which made merging and overriding rules harder to reason
about. Moving to explicit keyed permission maps gives us a single source
of truth per host/socket entry, makes allow/deny precedence clearer, and
gives protocol consumers access to the full rule state instead of
derived projections only.
## Backward Compatibility
### Backward compatible
- Managed requirements still accept the legacy
`experimental_network.allowed_domains`,
`experimental_network.denied_domains`, and
`experimental_network.allow_unix_sockets` fields. They are normalized
into the new canonical `domains` and `unix_sockets` maps internally.
- App-server v2 still deserializes legacy `allowedDomains`,
`deniedDomains`, and `allowUnixSockets` payloads, so older clients can
continue reading managed network requirements.
- App-server v2 responses still populate `allowedDomains`,
`deniedDomains`, and `allowUnixSockets` as legacy compatibility views
derived from the canonical maps.
- `managed_allowed_domains_only` keeps the same behavior after
normalization. Legacy managed allowlists still participate in the same
enforcement path as canonical `domains` entries.
### Not backward compatible
- Permissions profiles under `[permissions.<profile>.network]` no longer
accept the legacy list-based keys. Those configs must use the canonical
`[domains]` and `[unix_sockets]` tables instead of `allowed_domains`,
`denied_domains`, or `allow_unix_sockets`.
- Managed `experimental_network` config cannot mix canonical and legacy
forms in the same block. For example, `domains` cannot be combined with
`allowed_domains` or `denied_domains`, and `unix_sockets` cannot be
combined with `allow_unix_sockets`.
- The canonical format can express explicit `"none"` entries for unix
sockets, but those entries do not round-trip through the legacy
compatibility fields because the legacy fields only represent allow/deny
lists.
## Testing
`/target/debug/codex sandbox macos --log-denials /bin/zsh -c 'curl
https://www.example.com' ` gives 200 with config
```
[permissions.workspace.network.domains]
"www.example.com" = "allow"
```
and fails when set to deny: `curl: (56) CONNECT tunnel failed, response
403`.
Also tested backward compatibility path by verifying that adding the
following to `/etc/codex/requirements.toml` works:
```
[experimental_network]
allowed_domains = ["www.example.com"]
```1 parent 21a03f1 commit dd30c8e
File tree
37 files changed
+2413
-492
lines changed- codex-rs
- app-server-protocol
- schema
- json
- v2
- typescript/v2
- src/protocol
- app-server
- src
- config/src
- core
- src
- config_loader
- config
- guardian
- network-proxy
- src
- tui_app_server/src
- tui/src
37 files changed
+2413
-492
lines changedLines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9203 | 9203 | | |
9204 | 9204 | | |
9205 | 9205 | | |
| 9206 | + | |
| 9207 | + | |
| 9208 | + | |
| 9209 | + | |
| 9210 | + | |
| 9211 | + | |
| 9212 | + | |
9206 | 9213 | | |
9207 | 9214 | | |
9208 | 9215 | | |
| |||
9212 | 9219 | | |
9213 | 9220 | | |
9214 | 9221 | | |
| 9222 | + | |
9215 | 9223 | | |
9216 | 9224 | | |
9217 | 9225 | | |
| |||
9227 | 9235 | | |
9228 | 9236 | | |
9229 | 9237 | | |
| 9238 | + | |
9230 | 9239 | | |
9231 | 9240 | | |
9232 | 9241 | | |
| |||
9248 | 9257 | | |
9249 | 9258 | | |
9250 | 9259 | | |
| 9260 | + | |
9251 | 9261 | | |
9252 | 9262 | | |
9253 | 9263 | | |
| |||
9256 | 9266 | | |
9257 | 9267 | | |
9258 | 9268 | | |
| 9269 | + | |
| 9270 | + | |
| 9271 | + | |
| 9272 | + | |
| 9273 | + | |
| 9274 | + | |
| 9275 | + | |
| 9276 | + | |
| 9277 | + | |
| 9278 | + | |
9259 | 9279 | | |
9260 | 9280 | | |
9261 | 9281 | | |
| |||
9270 | 9290 | | |
9271 | 9291 | | |
9272 | 9292 | | |
| 9293 | + | |
| 9294 | + | |
| 9295 | + | |
| 9296 | + | |
| 9297 | + | |
| 9298 | + | |
| 9299 | + | |
9273 | 9300 | | |
9274 | 9301 | | |
9275 | 9302 | | |
9276 | 9303 | | |
9277 | 9304 | | |
9278 | 9305 | | |
9279 | 9306 | | |
| 9307 | + | |
| 9308 | + | |
| 9309 | + | |
| 9310 | + | |
| 9311 | + | |
| 9312 | + | |
| 9313 | + | |
| 9314 | + | |
| 9315 | + | |
| 9316 | + | |
9280 | 9317 | | |
9281 | 9318 | | |
9282 | 9319 | | |
9283 | 9320 | | |
| 9321 | + | |
| 9322 | + | |
| 9323 | + | |
| 9324 | + | |
| 9325 | + | |
| 9326 | + | |
| 9327 | + | |
9284 | 9328 | | |
9285 | 9329 | | |
9286 | 9330 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6017 | 6017 | | |
6018 | 6018 | | |
6019 | 6019 | | |
| 6020 | + | |
| 6021 | + | |
| 6022 | + | |
| 6023 | + | |
| 6024 | + | |
| 6025 | + | |
| 6026 | + | |
6020 | 6027 | | |
6021 | 6028 | | |
6022 | 6029 | | |
| |||
6026 | 6033 | | |
6027 | 6034 | | |
6028 | 6035 | | |
| 6036 | + | |
6029 | 6037 | | |
6030 | 6038 | | |
6031 | 6039 | | |
| |||
6041 | 6049 | | |
6042 | 6050 | | |
6043 | 6051 | | |
| 6052 | + | |
6044 | 6053 | | |
6045 | 6054 | | |
6046 | 6055 | | |
| |||
6062 | 6071 | | |
6063 | 6072 | | |
6064 | 6073 | | |
| 6074 | + | |
6065 | 6075 | | |
6066 | 6076 | | |
6067 | 6077 | | |
| |||
6070 | 6080 | | |
6071 | 6081 | | |
6072 | 6082 | | |
| 6083 | + | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
| 6092 | + | |
6073 | 6093 | | |
6074 | 6094 | | |
6075 | 6095 | | |
| |||
6084 | 6104 | | |
6085 | 6105 | | |
6086 | 6106 | | |
| 6107 | + | |
| 6108 | + | |
| 6109 | + | |
| 6110 | + | |
| 6111 | + | |
| 6112 | + | |
| 6113 | + | |
6087 | 6114 | | |
6088 | 6115 | | |
6089 | 6116 | | |
6090 | 6117 | | |
6091 | 6118 | | |
6092 | 6119 | | |
6093 | 6120 | | |
| 6121 | + | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
| 6125 | + | |
| 6126 | + | |
| 6127 | + | |
| 6128 | + | |
| 6129 | + | |
| 6130 | + | |
6094 | 6131 | | |
6095 | 6132 | | |
6096 | 6133 | | |
6097 | 6134 | | |
| 6135 | + | |
| 6136 | + | |
| 6137 | + | |
| 6138 | + | |
| 6139 | + | |
| 6140 | + | |
| 6141 | + | |
6098 | 6142 | | |
6099 | 6143 | | |
6100 | 6144 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
| |||
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| 121 | + | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
| |||
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| 137 | + | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
| |||
147 | 156 | | |
148 | 157 | | |
149 | 158 | | |
| 159 | + | |
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
| |||
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
158 | 178 | | |
159 | 179 | | |
160 | 180 | | |
| |||
169 | 189 | | |
170 | 190 | | |
171 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
172 | 199 | | |
173 | 200 | | |
174 | 201 | | |
175 | 202 | | |
176 | 203 | | |
177 | 204 | | |
178 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
179 | 216 | | |
180 | 217 | | |
181 | 218 | | |
182 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
183 | 227 | | |
184 | 228 | | |
185 | 229 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
| 204 | + | |
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| |||
0 commit comments