chore: sync OpenShell/NemoClaw proxy bypass behavior (#22)
- Add host command NO_PROXY augmentation for loopback aliases and inference.local - Document controller-launched OpenShell/NemoClaw proxy bypass handling - Extend portability regression coverage Co-authored-by: Mark Mckeen <markmckeen@Marks-Mac-mini.local>
This commit is contained in:
co-authored by
Mark Mckeen
parent
c32aa0f146
commit
f3c61df430
@@ -403,6 +403,8 @@ The controller also accepts an OpenShell config-file form at `~/.config/openshel
|
||||
|
||||
Those values are translated into `OPENSHELL_GATEWAY_HOST`, `OPENSHELL_GATEWAY_PORT`, and `OPENSHELL_GATEWAY_URL` for controller-launched OpenShell/NemoClaw child processes.
|
||||
|
||||
When the host shell has `HTTP_PROXY`/`HTTPS_PROXY` set, controller-launched OpenShell/NemoClaw commands also augment `NO_PROXY`/`no_proxy` for loopback, container-host aliases, and `inference.local`. This mirrors NemoClaw's current host-subprocess proxy bypass behavior and avoids routing local gateway or managed inference traffic through a workstation proxy.
|
||||
|
||||
## Security Limitations
|
||||
|
||||
This is not production hardened.
|
||||
|
||||
@@ -124,6 +124,39 @@ function stringConfigValue(value: unknown) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
function proxyBypassEnv() {
|
||||
const hasProxy = Boolean(process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy)
|
||||
if (!hasProxy) return {}
|
||||
|
||||
const requiredBypasses = [
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"host.docker.internal",
|
||||
"host.containers.internal",
|
||||
"::1",
|
||||
"0.0.0.0",
|
||||
"inference.local",
|
||||
]
|
||||
|
||||
const extend = (value: string | undefined) => {
|
||||
const parts = (value || "")
|
||||
.split(",")
|
||||
.map((entry) => entry.trim())
|
||||
.filter(Boolean)
|
||||
|
||||
for (const host of requiredBypasses) {
|
||||
if (!parts.includes(host)) parts.push(host)
|
||||
}
|
||||
|
||||
return parts.join(",")
|
||||
}
|
||||
|
||||
return {
|
||||
NO_PROXY: extend(process.env.NO_PROXY),
|
||||
no_proxy: extend(process.env.no_proxy),
|
||||
}
|
||||
}
|
||||
|
||||
function readOpenShellGatewayAddressConfig() {
|
||||
const configDir = OPENSHELL_XDG_CONFIG_HOME ? path.join(OPENSHELL_XDG_CONFIG_HOME, "openshell") : ""
|
||||
const candidates = unique([
|
||||
@@ -173,6 +206,7 @@ export function hostCommandEnv(extra: Record<string, string | undefined> = {}) {
|
||||
...(OPENSHELL_HOME ? { HOME: OPENSHELL_HOME } : {}),
|
||||
...(OPENSHELL_XDG_CONFIG_HOME ? { XDG_CONFIG_HOME: OPENSHELL_XDG_CONFIG_HOME } : {}),
|
||||
...openshellGatewayAddressEnv(),
|
||||
...proxyBypassEnv(),
|
||||
PATH: HOST_PATH,
|
||||
NO_COLOR: "1",
|
||||
CLICOLOR: "0",
|
||||
|
||||
@@ -75,6 +75,9 @@ assert.match(versionedInstallSource, /NVIDIA_API_KEY="\$\{NVIDIA_API_KEY:-\}"/,
|
||||
|
||||
assert.match(hostCommandsSource, /export const HOST_PATH/, 'host command resolution must centralize PATH construction')
|
||||
assert.match(hostCommandsSource, /OPENSHELL_CONTROL_VENV/, 'host command resolution must include the installer-managed virtual environment')
|
||||
assert.match(hostCommandsSource, /function proxyBypassEnv\(\)/, 'host command env must augment NO_PROXY for controller-launched OpenShell/NemoClaw subprocesses')
|
||||
assert.match(hostCommandsSource, /"inference\.local"/, 'host command env must bypass host HTTP proxies for OpenShell-managed inference.local')
|
||||
assert.match(hostCommandsSource, /\.\.\.proxyBypassEnv\(\)/, 'host command env must apply proxy bypasses before launching host commands')
|
||||
assert.match(hostCommandsSource, /\.venv\/bin/, 'host command resolution must include the default project virtual environment')
|
||||
assert.match(hostCommandsSource, /\.nemoclaw\/source\/bin\/nemoclaw\.js/, 'host command resolution must support standard ~/.nemoclaw installs')
|
||||
assert.match(hostCommandsSource, /\.nemoclaw\/source\/scripts\/setup\.sh/, 'host command resolution must support legacy ~/.nemoclaw setup workflows')
|
||||
|
||||
Reference in New Issue
Block a user