You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fcc2651
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sandbox,podman): deliver corporate proxy config on the supervisor argv
The proxy settings were injected as reserved OPENSHELL_UPSTREAM_* container
environment variables. The driver only wrote names the operator configured,
but container runtimes layer the spec environment over ENV values baked
into the sandbox image, so an image could supply NO_PROXY=*, enable
hostname CONNECT, or point an unconfigured deployment at an
attacker-controlled proxy whenever the operator left a field unset.
The settings now travel as supervisor command-line arguments
(--upstream-proxy, --upstream-no-proxy, --upstream-proxy-auth-file,
--upstream-proxy-auth-allow-insecure,
--upstream-proxy-connect-by-hostname) built by the driver from operator
config. The driver sets the container entrypoint and command explicitly,
so neither sandbox spec/template environment nor image ENV can influence
argv, and an omitted flag genuinely means unconfigured — in every
supervisor topology, since the supervisor no longer consults its
environment for these settings at all. Credentials stay on the root-only
secret mount; only the mount path appears on argv.
The reserved environment names, their strip-list entries, and the
env-based validation surface are removed. UpstreamProxyConfig::from_args
replaces from_env, reusing the same shared fail-closed validation and
pairing rules keyed by the CLI flag names.
Driver tests now assert the argv contract, including that sandbox-supplied
environment cannot add, remove, or redirect proxy flags; supervisor tests
cover from_args mapping and its pairing rules.
Signed-off-by: Philippe Martin <[email protected]>
`host.containers.internal`) to the reserved`NO_PROXY` list when the corporate
119
+
`host.containers.internal`) to the operator`NO_PROXY` list when the corporate
119
120
proxy cannot reach the container host. `NO_PROXY` matching is port-aware and
120
121
resolution-aware: an entry with a `:port` qualifier only bypasses that port,
121
122
and IP/CIDR entries also match hostnames through their validated resolved
@@ -129,40 +130,38 @@ the answer that passed SSRF and `allowed_ips` validation. The hostname still
129
130
travels inside the tunnel (TLS SNI, application `Host`). In split-horizon
130
131
networks, point the gateway host at the corporate resolver so internal names
131
132
validate to their internal addresses; the `proxy_connect_by_hostname`
132
-
opt-in (reserved `OPENSHELL_UPSTREAM_PROXY_CONNECT_BY_HOSTNAME`) exists as a
133
+
opt-in exists as a
133
134
last resort for proxies whose ACLs filter on hostnames and reject IP CONNECT
134
135
targets — with it, the proxy resolves the name itself and its ACLs become
135
136
the effective egress control for proxied TLS. (Resolving through the proxy's
136
137
own DNS view, e.g. DoH tunneled via CONNECT, is a possible future
137
138
enhancement and out of scope.) The workload child's proxy variables are
138
139
unaffected — they are always rewritten to point at the local policy proxy.
139
140
140
-
The configuration is fail-closed: a reserved variable that is present but
141
-
invalid — a present-but-empty value, an unsupported or malformed proxy URL, an
142
-
unreadable auth file, a malformed credential, or an auth file or `NO_PROXY`
143
-
list set while no proxy URL is configured — is fatal to supervisor startup
144
-
instead of being treated as unset, so a misconfiguration can never silently
145
-
degrade to direct dialing or unauthenticated proxy access. Only a fully unset
146
-
variable means "no proxy". The driver validates the same rules at
147
-
sandbox-create time through validators shared with the supervisor
141
+
The configuration is fail-closed: a setting that is present but invalid — an
142
+
empty value, an unsupported or malformed proxy URL, an unreadable auth file,
143
+
a malformed credential, or an auth file or `NO_PROXY` list set while no proxy
144
+
URL is configured — is fatal to supervisor startup instead of being treated
145
+
as unset, so a misconfiguration can never silently degrade to direct dialing
146
+
or unauthenticated proxy access. Only an omitted argument means "no proxy".
147
+
The driver validates the same rules at sandbox-create time through
148
+
validators shared with the supervisor
148
149
(`openshell_core::driver_utils::parse_upstream_proxy_url` and
149
150
`parse_upstream_proxy_credential`).
150
151
151
152
Proxy credentials are never embedded in the URL: an inline `user:pass@` is
152
153
rejected because it would be stored in `gateway.toml` and exposed in container
153
154
metadata. Operators supply credentials via `proxy_auth_file`; the driver
154
-
stages them as a root-only secret mounted at a fixed path and exports only
155
-
that path in `OPENSHELL_UPSTREAM_PROXY_AUTH_FILE`. The supervisor reads the
155
+
stages them as a root-only secret mounted at a fixed path and passes only
156
+
that path on the supervisor's command line. The supervisor reads the
156
157
file and builds the `Proxy-Authorization: Basic` header; a credential that is
157
158
empty, contains control characters, or is not in `user:pass` form is fatal on
158
-
both sides. The reserved proxy variables —
159
-
including the auth-file path — are stripped from workload child processes.
159
+
both sides.
160
160
161
161
The Basic header travels over the plain-TCP connection to the `http://` proxy,
162
162
so it is readable on the network path between sandbox host and proxy.
163
163
Configuring `proxy_auth_file` therefore requires the explicit opt-in
164
-
`proxy_auth_allow_insecure = true`, delivered to the supervisor as the
165
-
reserved `OPENSHELL_UPSTREAM_PROXY_AUTH_ALLOW_INSECURE` variable. Both the
164
+
`proxy_auth_allow_insecure = true`. Both the
166
165
driver (at sandbox-create time) and the supervisor (at startup) reject an
167
166
auth file without the acknowledgement, and the acknowledgement without an
168
167
auth file, so credentials are never sent in cleartext without an explicit
/// Corporate forward-proxy URL the supervisor chains TLS (CONNECT) egress
119
-
/// through, e.g. `http://proxy.corp.com:8080`.
120
-
///
121
-
/// This is an operator-owned egress boundary. Compute drivers set it from
122
-
/// gateway configuration in the supervisor's required-variable tier so that
123
-
/// sandbox spec/template environment cannot override it. The supervisor reads
124
-
/// *only* this reserved name — never the conventional `HTTPS_PROXY` /
125
-
/// `ALL_PROXY` variables, which the sandbox creator controls and which are
126
-
/// reserved for pointing the workload child at the local policy proxy.
/// Explicit operator acknowledgement (`true`) that the proxy credential is
146
-
/// sent as a cleartext `Proxy-Authorization: Basic` header over the plain-TCP
147
-
/// connection to the `http://` corporate proxy.
148
-
///
149
-
/// Basic auth is base64, not encryption, so anyone on the network path
150
-
/// between the sandbox host and the proxy can recover the credential. The
151
-
/// supervisor refuses to send credentials without this acknowledgement:
152
-
/// [`UPSTREAM_PROXY_AUTH_FILE`] set without this variable equal to `true` is
153
-
/// a fatal startup error, as is this variable set without an auth file.
154
-
/// Compute drivers write it in the required-variable tier from the driver's
Copy file name to clipboardExpand all lines: crates/openshell-driver-podman/README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -356,12 +356,12 @@ Through the gateway, the same settings are the `https_proxy`, `no_proxy`,
356
356
`proxy_connect_by_hostname` keys under `[openshell.drivers.podman]`; see
357
357
`docs/reference/gateway-config.mdx`.
358
358
359
-
This is an operator-owned egress boundary: the supervisor reads it from reserved
360
-
`OPENSHELL_UPSTREAM_*` variables written at highest priority, so sandbox and
361
-
template environment cannot override it, and the conventional
362
-
`HTTPS_PROXY`/`HTTP_PROXY`/`NO_PROXY` variables a sandbox controls do not steer
363
-
it. Credentials must be supplied through`proxy_auth_file`; an inline
364
-
`user:pass@` in the URL is rejected at startup.
359
+
This is an operator-owned egress boundary: the driver passes the settings on
360
+
the supervisor's command line, so sandbox and template environment — and any
361
+
`ENV` baked into the sandbox image — cannot override them, and the
362
+
conventional `HTTPS_PROXY`/`HTTP_PROXY`/`NO_PROXY` variables a sandbox
363
+
controls do not steer it. Credentials must be supplied through
364
+
`proxy_auth_file`; an inline `user:pass@` in the URL is rejected at startup.
365
365
366
366
Basic auth over an `http://` proxy is cleartext on the wire: anyone on the
367
367
network path between the sandbox host and the proxy can recover the
/// The in-container supervisor chains policy-approved TLS tunnels
142
-
/// through this proxy with HTTP CONNECT instead of dialing upstream
143
-
/// destinations directly. Only `http://` proxy URLs in explicit
144
-
/// `http://host:port` form (scheme and port required) are supported.
145
-
/// This is an operator-owned egress boundary: it is written in the
146
-
/// required-variable tier so sandbox/template environment cannot override
147
-
/// it, and the conventional `HTTPS_PROXY` variables are not used.
140
+
/// The supervisor chains policy-approved TLS tunnels through this proxy
141
+
/// with HTTP CONNECT instead of dialing upstream destinations directly.
142
+
/// Only `http://` proxy URLs in explicit `http://host:port` form (scheme
143
+
/// and port required) are supported. This is an operator-owned egress
144
+
/// boundary delivered on the supervisor's command line, so
145
+
/// sandbox/template environment cannot override it, and the conventional
146
+
/// `HTTPS_PROXY` variables are not used.
148
147
pubhttps_proxy:Option<String>,
149
-
/// Comma-separated `NO_PROXY` list injected as the reserved
150
-
/// `OPENSHELL_UPSTREAM_NO_PROXY` variable (e.g.
148
+
/// Comma-separated `NO_PROXY` list passed alongside the proxy URL (e.g.
151
149
/// `*.svc.cluster.local,10.0.0.0/8`). Destinations matching an entry are
152
150
/// dialed directly instead of through the corporate proxy. Entries take
153
151
/// an optional `:port` qualifier that limits them to that destination
0 commit comments