fix(desktop): import CA trust variables from the login shell (#19604)
This commit is contained in:
1 parent
348f217a85
commit
aa81d1203e
2 files changed
+35
No files matched your search
@@ -367,6 +367,32 @@ describe("DesktopShellEnvironment", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("hydrates missing CA trust variables from the login shell", () =>
|
||||
Effect.gen(function* () {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
SHELL: "/bin/zsh",
|
||||
PATH: "/usr/bin",
|
||||
SSL_CERT_DIR: "/etc/ssl/certs",
|
||||
};
|
||||
|
||||
yield* runShellEnvironment({
|
||||
env,
|
||||
platform: "darwin",
|
||||
handler: () =>
|
||||
envOutput({
|
||||
PATH: "/opt/zerobrew/bin:/usr/bin",
|
||||
SSL_CERT_FILE: "/opt/zerobrew/etc/ca-certificates/cacert.pem",
|
||||
SSL_CERT_DIR: "/opt/zerobrew/etc/ca-certificates",
|
||||
NODE_EXTRA_CA_CERTS: "/Users/me/corp-root.pem",
|
||||
}),
|
||||
});
|
||||
|
||||
assert.equal(env.SSL_CERT_FILE, "/opt/zerobrew/etc/ca-certificates/cacert.pem");
|
||||
assert.equal(env.SSL_CERT_DIR, "/etc/ssl/certs");
|
||||
assert.equal(env.NODE_EXTRA_CA_CERTS, "/Users/me/corp-root.pem");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("keeps mise's PATH record with the login shell PATH", () =>
|
||||
Effect.gen(function* () {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
|
||||
@@ -86,6 +86,9 @@ const LOGIN_SHELL_ENV_NAMES = [
|
||||
"XDG_SESSION_DESKTOP",
|
||||
"XDG_SESSION_TYPE",
|
||||
"WAYLAND_DISPLAY",
|
||||
"SSL_CERT_FILE",
|
||||
"SSL_CERT_DIR",
|
||||
"NODE_EXTRA_CA_CERTS",
|
||||
"T3CODE_TELEMETRY_ENABLED",
|
||||
"__MISE_DIFF",
|
||||
] as const;
|
||||
@@ -454,6 +457,12 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix
|
||||
"XDG_DATA_HOME",
|
||||
"XDG_RUNTIME_DIR",
|
||||
"WAYLAND_DISPLAY",
|
||||
// CA trust set in the shell profile. Without it, a Node or OpenSSL build
|
||||
// that has no bundled roots (a shared-OpenSSL node on PATH) cannot verify
|
||||
// TLS, so provider updaters and agents fail to reach their registries.
|
||||
"SSL_CERT_FILE",
|
||||
"SSL_CERT_DIR",
|
||||
"NODE_EXTRA_CA_CERTS",
|
||||
// The telemetry opt-out is documented as a shell variable; GUI launches never see it.
|
||||
"T3CODE_TELEMETRY_ENABLED",
|
||||
] as const) {
|
||||
|
||||
Reference in new issue
Block a user