1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import assert from "node:assert/strict";
const certificateErrors = new Set([
"CERT_REVOKED",
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
"CERT_UNTRUSTED",
]);
const control = await fetch("https://atproto.com/", {
signal: AbortSignal.timeout(5000),
});
assert.equal(control.status, 200, "valid TLS control failed");
await control.body.cancel();
for (const host of [
"dv-g3b-emudhra.we-have-a-problem.com",
"dv-g3b-aaa-emudhra.we-have-a-problem.com",
]) {
await assert.rejects(
fetch(`https://${host}/`, { signal: AbortSignal.timeout(5000) }),
(error) => certificateErrors.has(error.cause?.code),
`${host} must fail certificate validation`,
);
console.log(`PASS: ${host} rejected by Node TLS`);
}