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 1f19d26
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sandbox,podman): escape generated TOML and require explicit proxy URL form
Escape backslashes, quotes, and control characters when gateway.sh writes
proxy values into gateway.toml, so a hostile or unusual environment value
cannot corrupt the config or inject extra keys.
Restrict the upstream proxy URL grammar to the documented http://host:port
form: a scheme-less value is no longer normalized to http:// and a missing
port is no longer silently defaulted to 80. Docs, README, and CLI help now
state the explicit-form requirement consistently.
Also fix a test-only call of handle_tcp_connection that was missing the
upstream_proxy argument added in an earlier commit.
Signed-off-by: Philippe Martin <[email protected]>
`host.containers.internal`) to the reserved `NO_PROXY` list when the corporate
119
-
proxy cannot reach the container host. Only `http://` proxy URLs in
120
-
`scheme://host:port` form are supported; a path, query, or fragment is
121
-
rejected. Local DNS resolution and SSRF validation still run before the
119
+
proxy cannot reach the container host. Only `http://` proxy URLs in explicit
120
+
`http://host:port` form are supported — the scheme and port are both
121
+
required, and a path, query, or fragment is rejected. Local DNS resolution and SSRF validation still run before the
122
122
proxied dial; the CONNECT target sent to the corporate proxy is the requested
123
123
hostname. The workload child's proxy variables are unaffected — they are
124
124
always rewritten to point at the local policy proxy.
#[error("proxy URL must include an explicit scheme, e.g. http://proxy.corp.com:3128")]
115
+
MissingScheme,
111
116
/// The URL uses a scheme other than `http` (TLS and SOCKS proxies are
112
117
/// not supported by the sandbox supervisor).
113
118
#[error(
114
119
"unsupported proxy scheme '{0}': only http:// forward proxies are \
115
120
supported by the sandbox supervisor"
116
121
)]
117
122
UnsupportedScheme(String),
123
+
/// The URL has no explicit port. Corporate proxies rarely listen on the
124
+
/// scheme default (80), so a forgotten port is rejected instead of
125
+
/// silently dialing port 80.
126
+
#[error("proxy URL must include an explicit proxy port, e.g. http://proxy.corp.com:3128")]
127
+
MissingPort,
118
128
/// The URL embeds `user:pass@` credentials, which would leak into config
119
129
/// and container metadata. Credentials must come from the proxy auth file.
120
130
#[error("proxy URL must not embed credentials; supply them via the proxy auth file")]
/// Parse and validate a corporate upstream-proxy URL.
134
144
///
135
-
/// A bare `host:port` (no `://`) is normalized to `http://host:port`. Only
136
-
/// `http://` proxies are accepted, inline userinfo is rejected, and the port
137
-
/// defaults to 80. The URL must address the proxy only: a path (other than
138
-
/// a bare trailing `/`), query, or fragment is rejected rather than silently
139
-
/// discarded.
145
+
/// The accepted grammar is exactly `http://host:port`: the scheme and the
146
+
/// port must both be explicit, only `http://` proxies are accepted, and
147
+
/// inline userinfo is rejected. The URL must address the proxy only: a path
148
+
/// (other than a bare trailing `/`), query, or fragment is rejected rather
// An explicit scheme-default port is accepted even though the url
415
+
// crate normalizes it away in the parsed form.
416
+
let addr = parse_upstream_proxy_url("http://proxy.corp.com:80").unwrap();
350
417
assert_eq!(addr.port,80);
351
-
let addr = parse_upstream_proxy_url("proxy.corp.com:3128").unwrap();
Copy file name to clipboardExpand all lines: crates/openshell-driver-podman/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -345,7 +345,7 @@ Podman resources after out-of-band container removal or label drift.
345
345
|`OPENSHELL_PODMAN_TLS_CA`|`--podman-tls-ca`| unset | Host path to the CA certificate mounted for sandbox mTLS. |
346
346
|`OPENSHELL_PODMAN_TLS_CERT`|`--podman-tls-cert`| unset | Host path to the client certificate mounted for sandbox mTLS. |
347
347
|`OPENSHELL_PODMAN_TLS_KEY`|`--podman-tls-key`| unset | Host path to the client private key mounted for sandbox mTLS. |
348
-
|`OPENSHELL_SANDBOX_HTTPS_PROXY`|`--sandbox-https-proxy`| unset | Corporate forward proxy URL for the supervisor's upstream TLS dials, chained with HTTP CONNECT. Only credential-free `http://` URLs are supported. Plain-HTTP requests always dial directly. |
348
+
|`OPENSHELL_SANDBOX_HTTPS_PROXY`|`--sandbox-https-proxy`| unset | Corporate forward proxy URL for the supervisor's upstream TLS dials, chained with HTTP CONNECT. Only credential-free `http://host:port` URLs are supported (scheme and port required). Plain-HTTP requests always dial directly. |
349
349
|`OPENSHELL_SANDBOX_NO_PROXY`|`--sandbox-no-proxy`| unset | Comma-separated `NO_PROXY` list (hostnames, domain suffixes, IPs, CIDRs) dialed directly instead of through the corporate proxy. |
350
350
|`OPENSHELL_SANDBOX_PROXY_AUTH_FILE`|`--sandbox-proxy-auth-file`| unset | Path to a file containing the proxy credentials as `user:pass`. Staged as a root-only Podman secret so credentials never appear in config or container metadata. |
/// The in-container supervisor chains policy-approved TLS tunnels
142
142
/// through this proxy with HTTP CONNECT instead of dialing upstream
143
-
/// destinations directly. Only `http://` proxy URLs are supported.
143
+
/// destinations directly. Only `http://` proxy URLs in explicit
144
+
/// `http://host:port` form (scheme and port required) are supported.
144
145
/// This is an operator-owned egress boundary: it is written in the
145
146
/// required-variable tier so sandbox/template environment cannot override
146
147
/// it, and the conventional `HTTPS_PROXY` variables are not used.
// A scheme-less value (previously normalized to http://) and a
549
+
// port-less value (previously defaulted to 80) are both rejected so
550
+
// gateway.toml matches the documented http://host:port grammar.
551
+
for url in["proxy.corp.com:8080","http://proxy.corp.com"]{
552
+
let cfg = PodmanComputeConfig{
553
+
https_proxy:Some(url.to_string()),
554
+
..PodmanComputeConfig::default()
555
+
};
556
+
let err = cfg.validate_proxy_config().unwrap_err();
Copy file name to clipboardExpand all lines: crates/openshell-driver-podman/src/main.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -104,8 +104,9 @@ struct Args {
104
104
#[arg(long, env = "OPENSHELL_PODMAN_TLS_KEY")]
105
105
podman_tls_key:Option<PathBuf>,
106
106
107
-
/// Corporate forward proxy URL for the supervisor's upstream TLS dials
108
-
/// (http:// only). Credentials must not be embedded in the URL; use
107
+
/// Corporate forward proxy URL for the supervisor's upstream TLS dials,
108
+
/// in explicit `http://host:port` form (scheme and port required).
109
+
/// Credentials must not be embedded in the URL; use
Copy file name to clipboardExpand all lines: crates/openshell-supervisor-network/src/upstream_proxy.rs
+13-5Lines changed: 13 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -280,7 +280,7 @@ impl UpstreamProxyConfig {
280
280
}
281
281
}
282
282
283
-
/// Parse an `http://host[:port]` proxy URL with the same validation rules the
283
+
/// Parse an `http://host:port` proxy URL with the same validation rules the
// The accepted grammar is exactly `http://host:port`; lenient
513
+
// defaulting would let a typo silently target the wrong proxy.
# supervisor chains policy-approved TLS tunnels through this proxy with HTTP
394
394
# CONNECT instead of dialing destinations directly. Plain-HTTP requests are
395
395
# not proxied and always dial the destination directly. Only http:// proxy
396
-
# URLs are supported, in scheme://host:port form: a URL carrying a path,
397
-
# query, or fragment is rejected rather than silently truncated.
396
+
# URLs in explicit http://host:port form are supported: the scheme and port
397
+
# are both required, and a URL carrying a path, query, or fragment is
398
+
# rejected rather than silently truncated.
398
399
# NO_PROXY entries (hostnames, domain suffixes, IPs, CIDRs) are dialed
399
400
# directly. This is an operator-owned egress boundary:
400
401
# sandbox and template environment cannot override it, and the conventional
0 commit comments