Skip to content

Commit b5b9c42

Browse files
committed
fix(server): preserve non-enumerable OpenSSL certificate trust
1 parent bf05df7 commit b5b9c42

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎apps/server/src/resourceTelemetry/DesktopTelemetryReceiver.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ describe("DesktopTelemetryReceiver", () => {
7474
yield* applySnapshot({ ...message, environment: { NODE_EXTRA_CA_CERTS: null } });
7575
expect(fingerprints(NodeTls.getCACertificates("default"))).toEqual(fingerprints([baseline]));
7676
expect(environment.NODE_EXTRA_CA_CERTS).toBeUndefined();
77+
78+
NodeTls.setDefaultCACertificates([]);
79+
yield* fs.writeFileString(certificatePath, extra);
80+
const applyOpaqueTrust = makeApplyDesktopShellEnvironmentSnapshot(environment, "darwin");
81+
yield* applyOpaqueTrust(message);
82+
expect(NodeTls.getCACertificates("default")).toEqual([]);
83+
expect(environment.NODE_EXTRA_CA_CERTS).toBe(certificatePath);
7784
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
7885
);
7986

‎apps/server/src/resourceTelemetry/DesktopTelemetryReceiver.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@ export function makeApplyDesktopShellEnvironmentSnapshot(
238238
return false;
239239
});
240240
}
241+
// --use-openssl-ca roots are not enumerable; replacing the list would discard them.
242+
if (baseCertificates.length === 0) {
243+
yield* Effect.logWarning(
244+
"Preserving non-enumerable TLS trust. Restart to apply updated desktop shell certificates.",
245+
);
246+
return;
247+
}
241248
const fs = yield* FileSystem.FileSystem;
242249
const file = message.environment.NODE_EXTRA_CA_CERTS;
243250
const bundle = file ? yield* fs.readFileString(file) : undefined;

0 commit comments

Comments
 (0)