Skip to content

Commit d620d65

Browse files
authored
feat(sandbox): inject DENO_CERT into sandbox child environment (#1441)
Sandbox processes running on Deno couldn't TLS-verify connections to services signed by OpenShell's per-sandbox ephemeral CA because Deno doesn't consult `SSL_CERT_FILE` / `NODE_EXTRA_CA_CERTS`. Deno reads its own `DENO_CERT` env var (additive PEM bundle, same shape as `NODE_EXTRA_CA_CERTS`) for that. Add `DENO_CERT` to `child_env::tls_env_vars` pointing at the standalone OpenShell CA cert (not the combined system+sandbox bundle, since DENO_CERT is additive). The three callers in `process.rs` / `ssh.rs` iterate the array, so the size bump from 5 to 6 entries flows through without caller changes. Updates the security best-practices doc to enumerate `DENO_CERT` alongside the other trust-store env vars. Tracks: brevdev/dex-ui#5 Signed-off-by: Alec Fong <alecf@nvidia.com>
1 parent 65a3a7c commit d620d65

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎crates/openshell-sandbox/src/child_env.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ pub fn proxy_env_vars(proxy_url: &str) -> [(&'static str, String); 9] {
2424
pub fn tls_env_vars(
2525
ca_cert_path: &Path,
2626
combined_bundle_path: &Path,
27-
) -> [(&'static str, String); 5] {
27+
) -> [(&'static str, String); 6] {
2828
let ca_cert_path = ca_cert_path.display().to_string();
2929
let combined_bundle_path = combined_bundle_path.display().to_string();
3030
[
31-
("NODE_EXTRA_CA_CERTS", ca_cert_path),
31+
("NODE_EXTRA_CA_CERTS", ca_cert_path.clone()),
32+
("DENO_CERT", ca_cert_path),
3233
("SSL_CERT_FILE", combined_bundle_path.clone()),
3334
("REQUESTS_CA_BUNDLE", combined_bundle_path.clone()),
3435
("CURL_CA_BUNDLE", combined_bundle_path.clone()),
@@ -81,6 +82,7 @@ mod tests {
8182
let stdout = String::from_utf8(output.stdout).expect("utf8");
8283

8384
assert!(stdout.contains("NODE_EXTRA_CA_CERTS=/etc/openshell-tls/openshell-ca.pem"));
85+
assert!(stdout.contains("DENO_CERT=/etc/openshell-tls/openshell-ca.pem"));
8486
assert!(stdout.contains("SSL_CERT_FILE=/etc/openshell-tls/ca-bundle.pem"));
8587
assert!(stdout.contains("REQUESTS_CA_BUNDLE=/etc/openshell-tls/ca-bundle.pem"));
8688
assert!(stdout.contains("CURL_CA_BUNDLE=/etc/openshell-tls/ca-bundle.pem"));

‎docs/security/best-practices.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ This enables credential injection and L7 inspection without explicit configurati
120120

121121
| Aspect | Detail |
122122
|---|---|
123-
| Default | Auto-detect and terminate. OpenShell generates the sandbox CA at startup and injects it into the process trust stores (`NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`). |
123+
| Default | Auto-detect and terminate. OpenShell generates the sandbox CA at startup and injects it into the process trust stores (`NODE_EXTRA_CA_CERTS`, `DENO_CERT`, `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`). |
124124
| What you can change | Set `tls: skip` on an endpoint to disable TLS detection and termination for that endpoint. Use this for client-certificate mTLS to upstream or non-standard binary protocols. |
125125
| Risk if relaxed | `tls: skip` disables credential injection and L7 inspection for that endpoint. The proxy relays encrypted traffic without seeing the contents. |
126126
| Recommendation | Use auto-detect (the default) for most endpoints. Use `tls: skip` only when the upstream requires the client's own TLS certificate (mTLS) or uses a non-HTTP protocol. |

0 commit comments

Comments
 (0)