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
use openshell_core::driver_utils::{UpstreamProxyUrlError, parse_upstream_proxy_url};
426
+
427
+
ifletSome(url) = &self.https_proxy{
428
+
parse_upstream_proxy_url(url).map_err(|err| match err {
429
+
UpstreamProxyUrlError::Empty => "https_proxy must not be empty when set".to_string(),
430
+
UpstreamProxyUrlError::InlineCredentials => "https_proxy must not embed credentials in the URL; supply them through proxy_auth_secret_name and proxy_auth_secret_key".to_string(),
431
+
err => format!("https_proxy {err}"),
432
+
})?;
433
+
}
434
+
435
+
ifletSome(list) = self.no_proxy.as_deref(){
436
+
if list.trim().is_empty(){
437
+
returnErr("no_proxy must not be empty when set; omit it instead".to_string());
438
+
}
439
+
ifself.https_proxy.is_none(){
440
+
returnErr("no_proxy is set but no https_proxy is configured".to_string());
441
+
}
442
+
}
443
+
444
+
let secret_name = self.proxy_auth_secret_name.as_deref();
445
+
let secret_key = self.proxy_auth_secret_key.as_deref();
446
+
match(secret_name, secret_key){
447
+
(None,None) => {
448
+
ifself.proxy_auth_allow_insecure == Some(true){
449
+
returnErr("proxy_auth_allow_insecure is set but no proxy credential Secret is configured".to_string());
450
+
}
451
+
}
452
+
(Some(name),Some(key)) => {
453
+
if name.trim().is_empty() || key.trim().is_empty(){
454
+
returnErr(
455
+
"proxy credential Secret name and key must not be empty".to_string()
456
+
);
457
+
}
458
+
if !is_dns1123_subdomain(name){
459
+
returnErr(
460
+
"proxy_auth_secret_name must be a valid Kubernetes DNS-1123 subdomain"
"proxy_auth_secret_key must contain only letters, digits, '.', '-', or '_'"
470
+
.to_string(),
471
+
);
472
+
}
473
+
ifself.https_proxy.is_none(){
474
+
returnErr(
475
+
"proxy credential Secret is set but no https_proxy is configured"
476
+
.to_string(),
477
+
);
478
+
}
479
+
ifself.proxy_auth_allow_insecure != Some(true){
480
+
returnErr("proxy credentials use cleartext Basic auth over the connection to the http:// proxy; set proxy_auth_allow_insecure = true to accept that exposure, or remove the credential Secret".to_string());
481
+
}
482
+
ifself.topology == SupervisorTopology::Combined{
483
+
returnErr(
484
+
"proxy credential Secrets require topology = \"sidecar\"; combined topology shares the credential mount with the workload and fsGroup can make it readable by the sandbox user"
485
+
.to_string(),
486
+
);
487
+
}
488
+
}
489
+
_ => {
490
+
returnErr(
491
+
"proxy_auth_secret_name and proxy_auth_secret_key must be set together"
0 commit comments