Skip to content

Commit ac52e71

Browse files
maruiz93claude
andcommitted
fix: remove allowed_ips from host-side API server policies
Per NVIDIA/OpenShell#1560, allowed_ips is no longer required when endpoints are explicitly declared with host+port in the policy. Validated by creating a sandbox with the updated policy and curling both host servers (builder :9090, provisioner :9091) successfully. - Remove allowed_ips from full-access and restricted policies - Remove HOST_IP resolution and policy template rendering from run.sh - Point harness files to raw policy files instead of rendered ones - Add required role field to all harness files (new fullsend requirement) Refs: NVIDIA/OpenShell#1633 Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Marta Anon <[email protected]>
1 parent cd6df4e commit ac52e71

11 files changed

Lines changed: 86 additions & 59 deletions

‎0010-host-side-api-server/README.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ See [HOW_TO.md](HOW_TO.md).
4040
- **Repo provisioner depends on OpenShell#1272**: if content inspection hooks
4141
ship in OpenShell, the scan-before-copy flow could be handled natively
4242

43+
## Changelog
44+
45+
### 2026-07-16: Remove `allowed_ips` requirement
46+
47+
OpenShell maintainer [johntmyers confirmed](https://github.com/NVIDIA/OpenShell/issues/1633#issuecomment-1)
48+
that PR [NVIDIA/OpenShell#1560](https://github.com/NVIDIA/OpenShell/pull/1560) removed
49+
the `allowed_ips` requirement when endpoints are explicitly declared with host+port in
50+
the policy. Validated locally on OpenShell v0.0.83 (rootless Podman + pasta, Fedora 44):
51+
52+
- Both builder (`:9090`) and provisioner (`:9091`) reachable from sandbox without `allowed_ips`
53+
- Undeclared endpoints still blocked by the proxy
54+
55+
Changes:
56+
- Removed `allowed_ips: ["{{HOST_IP}}/32"]` from both policies
57+
- Removed HOST_IP resolution and policy template rendering from `run.sh`
58+
- Harness files now reference raw policies directly (no rendered copies)
59+
- Added `role: experiment` to all harness files (required by current fullsend)
60+
61+
Servers still bind to `0.0.0.0` — the remaining motivation for
62+
[NVIDIA/OpenShell#1633](https://github.com/NVIDIA/OpenShell/issues/1633) (`host.local`
63+
supervisor-proxied endpoints) is eliminating `0.0.0.0` binding in favor of `127.0.0.1`.
64+
4365
## Findings
4466

4567
See [results/findings.md](results/findings.md) (populated after running).

‎0010-host-side-api-server/findings.md‎

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ inside the sandbox and must be used in:
7575
- **Env files** delivered into the sandbox (`BUILDER_URL`, `PROVISIONER_URL`)
7676
- **Network policy endpoints** (`host: host.openshell.internal`)
7777

78-
The host IP is still needed for `allowed_ips` in network policies (SSRF
78+
~~The host IP is still needed for `allowed_ips` in network policies (SSRF
7979
allowlisting requires a CIDR, not a hostname). The orchestrator resolves this
8080
at runtime via `getent hosts host.openshell.internal` and renders it into
81-
policy templates with `sed "s/{{HOST_IP}}/$HOST_IP/g"`.
81+
policy templates with `sed "s/{{HOST_IP}}/$HOST_IP/g"`.~~
82+
83+
**Update (2026-07-16):** `allowed_ips` is no longer required. See
84+
[below](#2026-07-16-allowed_ips-no-longer-required-for-declared-endpoints).
8285

8386
### Server process contract
8487

@@ -165,22 +168,22 @@ network_policies:
165168
method: POST
166169
path: /build
167170
# ...additional allowed paths
168-
allowed_ips:
169-
- "{{HOST_IP}}/32"
170171
binaries:
171172
- path: "**/curl"
172173
```
173174

174175
Key elements:
175176
- **`protocol: rest`**: Enables HTTP method + path matching at L7
176-
- **`allowed_ips`**: Overrides SSRF protection for the host bridge IP (rendered
177-
from template at orchestrator startup)
178177
- **`binaries`**: Restricts which executables can reach the endpoint (`**/curl`
179178
ensures only curl can call the API, not arbitrary processes)
180179
- **Restricted policies** omit discovery endpoints (`/openapi.json`,
181180
`/tools.json`) and non-essential operations (`/push`, `/images`) to test
182181
agent behavior under reduced API surface
183182

183+
> **Note:** The original experiment included `allowed_ips: ["{{HOST_IP}}/32"]`
184+
> in endpoint declarations. This is no longer needed — see
185+
> [update below](#2026-07-16-allowed_ips-no-longer-required-for-declared-endpoints).
186+
184187
### Orchestrator lifecycle
185188

186189
The wrapper script (`run.sh`) manages the full lifecycle:
@@ -190,14 +193,16 @@ The wrapper script (`run.sh`) manages the full lifecycle:
190193
3. **Generate bearer token** (UUID) and export as `API_TOKEN`
191194
4. **Start API servers** (builder on :9090, provisioner on :9091) with `--token`
192195
5. **Health-check** both servers (poll `/healthz` up to 15s, verify PIDs alive)
193-
6. **Resolve host IP** via `getent hosts host.openshell.internal`
194-
7. **Render policy templates** — substitute `{{HOST_IP}}` into both policy files
195-
8. **Generate env file** with `BUILDER_URL` and `PROVISIONER_URL` using
196+
6. **Generate env file** with `BUILDER_URL` and `PROVISIONER_URL` using
196197
`host.openshell.internal` hostname
197-
9. **Run `fullsend run`** with `--fullsend-dir .` (experiment directory is the
198+
7. **Run `fullsend run`** with `--fullsend-dir .` (experiment directory is the
198199
fullsend directory)
199-
10. **Cleanup on exit** (trap): kill server PIDs, delete provider, remove
200-
rendered policies and temp env file
200+
8. **Cleanup on exit** (trap): kill server PIDs, delete provider, remove
201+
temp env file
202+
203+
> **Note:** The original lifecycle included HOST_IP resolution (step 6) and
204+
> policy template rendering (step 7) for `allowed_ips`. These steps were
205+
> removed in the 2026-07-16 update.
201206

202207
The harness files deliver the env file into the sandbox via `host_files`:
203208
```yaml
@@ -375,5 +380,34 @@ This has been filed as
375380

376381
All URLs delivered into the sandbox must use `host.openshell.internal`, never
377382
raw IPs. The L7 proxy matches requests by hostname, and SSRF protection blocks
378-
private IP addresses. The `allowed_ips` field in network policies handles the
379-
SSRF allowlisting separately using the rendered host IP.
383+
private IP addresses.
384+
385+
### 2026-07-16: `allowed_ips` no longer required for declared endpoints
386+
387+
OpenShell maintainer johntmyers
388+
[confirmed](https://github.com/NVIDIA/OpenShell/issues/1633#issuecomment-1)
389+
that [PR #1560](https://github.com/NVIDIA/OpenShell/pull/1560) removed the
390+
`allowed_ips` requirement when endpoints are explicitly declared with host+port
391+
in the policy.
392+
393+
**Validation (OpenShell v0.0.83, rootless Podman + pasta, Fedora 44 kernel 7.0.9):**
394+
395+
| Endpoint | Port | Policy has `allowed_ips`? | Result from sandbox |
396+
|----------|------|--------------------------|---------------------|
397+
| builder `/tools.json` | 9090 | No | 200 OK |
398+
| provisioner `/tools.json` | 9091 | No | 200 OK |
399+
| `example.com` (not in policy) | 80 | N/A | Blocked |
400+
401+
**What changed:**
402+
- Removed `allowed_ips: ["{{HOST_IP}}/32"]` from both policies
403+
- Removed HOST_IP resolution and policy template rendering from `run.sh`
404+
- Harness files now reference raw policy files directly (no rendered copies)
405+
406+
**Implications:**
407+
- The `{{HOST_IP}}` templating step was the most fragile part of the setup
408+
(platform-dependent IP resolution, sed rendering, separate rendered files).
409+
Its removal simplifies the orchestrator significantly.
410+
- Servers still bind to `0.0.0.0` — the remaining motivation for
411+
[NVIDIA/OpenShell#1633](https://github.com/NVIDIA/OpenShell/issues/1633)
412+
is eliminating `0.0.0.0` binding in favor of `127.0.0.1` via supervisor-proxied
413+
`host.local` endpoints.

‎0010-host-side-api-server/harness/baked-instructions-full.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-full-access.yaml
4+
policy: policies/full-access.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/harness/baked-instructions-restricted.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-restricted.yaml
4+
policy: policies/restricted.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/harness/openapi-discovery-full.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-full-access.yaml
4+
policy: policies/full-access.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/harness/openapi-discovery-restricted.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-restricted.yaml
4+
policy: policies/restricted.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/harness/tooluse-discovery-full.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-full-access.yaml
4+
policy: policies/full-access.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/harness/tooluse-discovery-restricted.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
agent: agents/test-agent.md
2+
role: experiment
23
model: opus
3-
policy: policies/rendered-restricted.yaml
4+
policy: policies/restricted.yaml
45

56
providers:
67
- api-server

‎0010-host-side-api-server/policies/full-access.yaml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ network_policies:
4848
- allow:
4949
method: GET
5050
path: /tools.json
51-
allowed_ips:
52-
- "{{HOST_IP}}/32"
5351
binaries:
5452
- path: "**/curl"
5553
provisioner:
@@ -72,7 +70,5 @@ network_policies:
7270
- allow:
7371
method: GET
7472
path: /tools.json
75-
allowed_ips:
76-
- "{{HOST_IP}}/32"
7773
binaries:
7874
- path: "**/curl"

‎0010-host-side-api-server/policies/restricted.yaml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ network_policies:
3434
- allow:
3535
method: POST
3636
path: /build
37-
allowed_ips:
38-
- "{{HOST_IP}}/32"
3937
binaries:
4038
- path: "**/curl"
4139
provisioner:
@@ -52,7 +50,5 @@ network_policies:
5250
- allow:
5351
method: GET
5452
path: /repo/status/*
55-
allowed_ips:
56-
- "{{HOST_IP}}/32"
5753
binaries:
5854
- path: "**/curl"

0 commit comments

Comments
 (0)