forked from mtusi2026/mtusi2026lab7
Prepare verified laboratory 7 implementation and evidence
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { local } from "./runtime";
|
||||
const allowed = [
|
||||
"ERR_SSL_TLSV13_ALERT_CERTIFICATE_REQUIRED",
|
||||
"ERR_SSL_TLSV1_ALERT_CERTIFICATE_REQUIRED",
|
||||
"ERR_SSL_TLSV1_ALERT_UNKNOWN_CA",
|
||||
"ERR_SSL_SSLV3_ALERT_BAD_CERTIFICATE",
|
||||
"ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE",
|
||||
"ERR_SSL_TLSV1_ALERT_ACCESS_DENIED",
|
||||
"ERR_SSL_TLSV1_ALERT_DECRYPT_ERROR",
|
||||
"ERR_SSL_TLSV1_ALERT_DECODE_ERROR",
|
||||
"ECONNRESET",
|
||||
"EPROTO",
|
||||
"EPIPE",
|
||||
"UNCLASSIFIED_TLS_ERROR",
|
||||
"ERR_TLS_CERT_ALTNAME_INVALID",
|
||||
"SELF_SIGNED_CERT_IN_CHAIN",
|
||||
];
|
||||
for (const name of await readdir(resolve(local, "diagnostics"))) {
|
||||
if (!name.startsWith("tls-negative-")) continue;
|
||||
const value = JSON.parse(
|
||||
await readFile(resolve(local, "diagnostics", name), "utf8"),
|
||||
);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
kind: ["trust", "client", "role"].includes(value.kind)
|
||||
? value.kind
|
||||
: "OTHER",
|
||||
code: allowed.includes(value.code) ? value.code : "OTHER",
|
||||
unexpected_success: value.message === "TLS_NEGATIVE_UNEXPECTED_SUCCESS",
|
||||
timeout: value.message === "TRANSPORT_TIMEOUT",
|
||||
certificate_required: /certificate required/i.test(value.message),
|
||||
unknown_ca: /unknown ca/i.test(value.message),
|
||||
bad_certificate: /bad certificate/i.test(value.message),
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user