Skip to content

Commit c81cb4f

Browse files
committed
fix(sandbox): replace CIDR in NO_PROXY with explicit gateway IP; add ::1 test
- Replace 10.200.0.0/16 (CIDR) with 10.200.0.1 (explicit gateway IP). Node.js undici EnvHttpProxyAgent matches NO_PROXY entries as exact hostname strings or domain suffixes, not CIDR ranges. The CIDR entry was silently ignored, routing all virtual-network IPs through the proxy when they should be bypassed. - Add test guard: extractProxyVars() now throws if the sed extraction returns an empty block, surfacing script-format regressions as clear failures instead of silent empty-env errors. - Add ::1 (IPv6 loopback) assertion to the loopback exclusion test to match the NO_PROXY entry already present in the script. All 17 tests pass. Addresses CodeRabbit review comments on PR #704.
1 parent 623d878 commit c81cb4f

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎scripts/nemoclaw-start.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export HTTP_PROXY="http://${PROXY_HOST}:${PROXY_PORT}"
151151
export HTTPS_PROXY="http://${PROXY_HOST}:${PROXY_PORT}"
152152
# Bypass proxy for loopback, sandbox-local, and the OpenShell virtual network
153153
# so internal gateway calls (openclaw dashboard, inference.local) stay fast.
154-
export NO_PROXY="localhost,127.0.0.1,::1,inference.local,10.200.0.0/16"
154+
export NO_PROXY="localhost,127.0.0.1,::1,inference.local,10.200.0.1"
155155

156156
write_auth_profile
157157

‎test/service-env.test.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ describe("service environment", () => {
119119
["-n", "/^PROXY_HOST=/,/^export NO_PROXY=/p", scriptPath],
120120
{ encoding: "utf-8" }
121121
);
122+
if (!proxyBlock.trim()) {
123+
throw new Error(
124+
"Failed to extract proxy configuration from scripts/nemoclaw-start.sh — " +
125+
"the PROXY_HOST/NO_PROXY block may have been moved or renamed"
126+
);
127+
}
122128
const wrapper = [
123129
"#!/usr/bin/env bash",
124130
proxyBlock.trimEnd(),
@@ -169,12 +175,13 @@ describe("service environment", () => {
169175
const noProxy = vars.NO_PROXY.split(",");
170176
expect(noProxy).toContain("localhost");
171177
expect(noProxy).toContain("127.0.0.1");
178+
expect(noProxy).toContain("::1");
172179
expect(noProxy).toContain("inference.local");
173180
});
174181

175-
it("NO_PROXY excludes OpenShell virtual network range", () => {
182+
it("NO_PROXY excludes OpenShell gateway IP (undici does not support CIDR)", () => {
176183
const vars = extractProxyVars();
177-
expect(vars.NO_PROXY).toContain("10.200.0.0/16");
184+
expect(vars.NO_PROXY).toContain("10.200.0.1");
178185
});
179186
});
180187
});

0 commit comments

Comments
 (0)