lifecycleion 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/lib/dev-mode.cjs.map +1 -1
- package/dist/lib/dev-mode.js.map +1 -1
- package/dist/lib/http-client/index.d.cts +2 -2
- package/dist/lib/http-client/index.d.ts +2 -2
- package/dist/lib/http-client-mock/index.cjs +0 -14
- package/dist/lib/http-client-mock/index.cjs.map +1 -1
- package/dist/lib/http-client-mock/index.d.cts +3 -2
- package/dist/lib/http-client-mock/index.d.ts +3 -2
- package/dist/lib/http-client-mock/index.js +0 -14
- package/dist/lib/http-client-mock/index.js.map +1 -1
- package/dist/lib/http-client-node/index.cjs +38 -15
- package/dist/lib/http-client-node/index.cjs.map +1 -1
- package/dist/lib/http-client-node/index.d.cts +33 -2
- package/dist/lib/http-client-node/index.d.ts +33 -2
- package/dist/lib/http-client-node/index.js +38 -15
- package/dist/lib/http-client-node/index.js.map +1 -1
- package/dist/lib/http-client-xhr/index.cjs +0 -14
- package/dist/lib/http-client-xhr/index.cjs.map +1 -1
- package/dist/lib/http-client-xhr/index.d.cts +3 -2
- package/dist/lib/http-client-xhr/index.d.ts +3 -2
- package/dist/lib/http-client-xhr/index.js +0 -14
- package/dist/lib/http-client-xhr/index.js.map +1 -1
- package/dist/lib/lifecycle-manager/index.cjs.map +1 -1
- package/dist/lib/lifecycle-manager/index.js.map +1 -1
- package/dist/lib/logger/index.cjs.map +1 -1
- package/dist/lib/logger/index.js.map +1 -1
- package/dist/{types-CWw885iO.d.cts → types-6G59m8U9.d.cts} +1 -1
- package/dist/{types-Mso0dYOS.d.ts → types-CG10j6Lc.d.ts} +1 -1
- package/package.json +30 -17
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { H as HTTPAdapter, A as AdapterType, a as AdapterRequest, b as AdapterResponse } from '../../types-
|
|
1
|
+
import { H as HTTPAdapter, A as AdapterType, a as AdapterRequest, b as AdapterResponse } from '../../types-6G59m8U9.cjs';
|
|
2
|
+
export { c as AdapterProgressEvent, d as HTTPMethod, S as StreamResponseCancel, e as StreamResponseContext, f as StreamResponseFactory, g as StreamResponseInfo, W as WritableLike } from '../../types-6G59m8U9.cjs';
|
|
2
3
|
import '../../types-BW0vnSzd.cjs';
|
|
3
4
|
|
|
4
5
|
interface NodeAdapterConfig {
|
|
@@ -48,6 +49,36 @@ interface NodeAdapterConfig {
|
|
|
48
49
|
* routes by Host, also set defaultHeaders: { host: 'billing.internal' }.
|
|
49
50
|
*/
|
|
50
51
|
servername?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Certificate revocation list(s), used to reject a server certificate whose
|
|
54
|
+
* serial has been revoked even though its chain and hostname still check out.
|
|
55
|
+
* A revoked certificate fails the handshake with `CERT_REVOKED`.
|
|
56
|
+
*
|
|
57
|
+
* Accepts whatever your CA tooling produced. A PEM string holding SEVERAL
|
|
58
|
+
* concatenated CRLs — the format Apache's `SSLCARevocationFile`, nginx's
|
|
59
|
+
* `ssl_crl` and HAProxy's `crl-file` all expect, and what `openssl ca
|
|
60
|
+
* -gencrl` output is usually assembled into — is split into the array Node
|
|
61
|
+
* requires. A single CRL, a DER `Buffer`, or an array you built yourself is
|
|
62
|
+
* passed through untouched.
|
|
63
|
+
*
|
|
64
|
+
* The split exists because Node reads only the FIRST CRL of a concatenated
|
|
65
|
+
* string and silently ignores the rest, unlike `ca`, which reads every
|
|
66
|
+
* certificate in a bundle. See docs/http-client.md.
|
|
67
|
+
*
|
|
68
|
+
* Two things to know before using this:
|
|
69
|
+
*
|
|
70
|
+
* - **Every certificate in the chain needs a covering CRL.** Node enables
|
|
71
|
+
* `X509_V_FLAG_CRL_CHECK_ALL`, so supplying a CRL for one root while
|
|
72
|
+
* connecting through another fails with `UNABLE_TO_GET_CRL` even when
|
|
73
|
+
* nothing was revoked. Cover every root you talk to, or scope the client.
|
|
74
|
+
* - **CRLs expire.** Past `nextUpdate` the handshake fails with
|
|
75
|
+
* `CRL_HAS_EXPIRED`, including for certificates that were never revoked.
|
|
76
|
+
* Re-pass a fresh CRL before then; the refresh cadence is yours to own.
|
|
77
|
+
*
|
|
78
|
+
* Both failures are fail-closed, so a stale CRL never silently stops
|
|
79
|
+
* enforcing — but both can take out healthy connections.
|
|
80
|
+
*/
|
|
81
|
+
crl?: string | Buffer | Array<string | Buffer>;
|
|
51
82
|
/**
|
|
52
83
|
* Set to false to accept self-signed certificates in dev/test environments.
|
|
53
84
|
* Defaults to true (Node.js default — rejects invalid certs).
|
|
@@ -61,4 +92,4 @@ declare class NodeAdapter implements HTTPAdapter {
|
|
|
61
92
|
send(request: AdapterRequest): Promise<AdapterResponse>;
|
|
62
93
|
}
|
|
63
94
|
|
|
64
|
-
export { NodeAdapter, type NodeAdapterConfig };
|
|
95
|
+
export { AdapterRequest, AdapterResponse, AdapterType, HTTPAdapter, NodeAdapter, type NodeAdapterConfig };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { H as HTTPAdapter, A as AdapterType, a as AdapterRequest, b as AdapterResponse } from '../../types-
|
|
1
|
+
import { H as HTTPAdapter, A as AdapterType, a as AdapterRequest, b as AdapterResponse } from '../../types-CG10j6Lc.js';
|
|
2
|
+
export { c as AdapterProgressEvent, d as HTTPMethod, S as StreamResponseCancel, e as StreamResponseContext, f as StreamResponseFactory, g as StreamResponseInfo, W as WritableLike } from '../../types-CG10j6Lc.js';
|
|
2
3
|
import '../../types-BW0vnSzd.js';
|
|
3
4
|
|
|
4
5
|
interface NodeAdapterConfig {
|
|
@@ -48,6 +49,36 @@ interface NodeAdapterConfig {
|
|
|
48
49
|
* routes by Host, also set defaultHeaders: { host: 'billing.internal' }.
|
|
49
50
|
*/
|
|
50
51
|
servername?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Certificate revocation list(s), used to reject a server certificate whose
|
|
54
|
+
* serial has been revoked even though its chain and hostname still check out.
|
|
55
|
+
* A revoked certificate fails the handshake with `CERT_REVOKED`.
|
|
56
|
+
*
|
|
57
|
+
* Accepts whatever your CA tooling produced. A PEM string holding SEVERAL
|
|
58
|
+
* concatenated CRLs — the format Apache's `SSLCARevocationFile`, nginx's
|
|
59
|
+
* `ssl_crl` and HAProxy's `crl-file` all expect, and what `openssl ca
|
|
60
|
+
* -gencrl` output is usually assembled into — is split into the array Node
|
|
61
|
+
* requires. A single CRL, a DER `Buffer`, or an array you built yourself is
|
|
62
|
+
* passed through untouched.
|
|
63
|
+
*
|
|
64
|
+
* The split exists because Node reads only the FIRST CRL of a concatenated
|
|
65
|
+
* string and silently ignores the rest, unlike `ca`, which reads every
|
|
66
|
+
* certificate in a bundle. See docs/http-client.md.
|
|
67
|
+
*
|
|
68
|
+
* Two things to know before using this:
|
|
69
|
+
*
|
|
70
|
+
* - **Every certificate in the chain needs a covering CRL.** Node enables
|
|
71
|
+
* `X509_V_FLAG_CRL_CHECK_ALL`, so supplying a CRL for one root while
|
|
72
|
+
* connecting through another fails with `UNABLE_TO_GET_CRL` even when
|
|
73
|
+
* nothing was revoked. Cover every root you talk to, or scope the client.
|
|
74
|
+
* - **CRLs expire.** Past `nextUpdate` the handshake fails with
|
|
75
|
+
* `CRL_HAS_EXPIRED`, including for certificates that were never revoked.
|
|
76
|
+
* Re-pass a fresh CRL before then; the refresh cadence is yours to own.
|
|
77
|
+
*
|
|
78
|
+
* Both failures are fail-closed, so a stale CRL never silently stops
|
|
79
|
+
* enforcing — but both can take out healthy connections.
|
|
80
|
+
*/
|
|
81
|
+
crl?: string | Buffer | Array<string | Buffer>;
|
|
51
82
|
/**
|
|
52
83
|
* Set to false to accept self-signed certificates in dev/test environments.
|
|
53
84
|
* Defaults to true (Node.js default — rejects invalid certs).
|
|
@@ -61,4 +92,4 @@ declare class NodeAdapter implements HTTPAdapter {
|
|
|
61
92
|
send(request: AdapterRequest): Promise<AdapterResponse>;
|
|
62
93
|
}
|
|
63
94
|
|
|
64
|
-
export { NodeAdapter, type NodeAdapterConfig };
|
|
95
|
+
export { AdapterRequest, AdapterResponse, AdapterType, HTTPAdapter, NodeAdapter, type NodeAdapterConfig };
|
|
@@ -325,13 +325,17 @@ var CERT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
325
325
|
"ERR_SSL_TLSV13_ALERT_CERTIFICATE_REQUIRED",
|
|
326
326
|
"ERR_SSL_PEER_DID_NOT_RETURN_A_CERTIFICATE",
|
|
327
327
|
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
328
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"
|
|
328
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
329
|
+
"CERT_REVOKED"
|
|
329
330
|
]);
|
|
330
331
|
function isTLSCertificateError(error) {
|
|
331
332
|
const code = error.code ?? "";
|
|
332
333
|
if (CERT_ERROR_CODES.has(code)) {
|
|
333
334
|
return true;
|
|
334
335
|
}
|
|
336
|
+
if (code.includes("CRL")) {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
335
339
|
if ((code.startsWith("ERR_TLS_") || code.startsWith("ERR_SSL_")) && code.includes("CERT")) {
|
|
336
340
|
return true;
|
|
337
341
|
}
|
|
@@ -368,20 +372,6 @@ function materializeNodeRequestHeaders(headers) {
|
|
|
368
372
|
|
|
369
373
|
// src/lib/http-client/utils.ts
|
|
370
374
|
import qs from "qs";
|
|
371
|
-
|
|
372
|
-
// src/lib/domain-utils/domain-utils.ts
|
|
373
|
-
import { getDomain, getSubdomain, getPublicSuffix } from "tldts";
|
|
374
|
-
|
|
375
|
-
// src/lib/domain-utils/helpers.ts
|
|
376
|
-
import { toASCII } from "tr46";
|
|
377
|
-
var INTERNAL_PSEUDO_TLDS = Object.freeze(
|
|
378
|
-
/* @__PURE__ */ new Set(["localhost", "local", "test", "internal"])
|
|
379
|
-
);
|
|
380
|
-
|
|
381
|
-
// src/lib/domain-utils/domain-utils.ts
|
|
382
|
-
import { getDomain as getDomain2, getSubdomain as getSubdomain2 } from "tldts";
|
|
383
|
-
|
|
384
|
-
// src/lib/http-client/utils.ts
|
|
385
375
|
function resolveAbsoluteURL(url, baseURL) {
|
|
386
376
|
if (!url) {
|
|
387
377
|
return url;
|
|
@@ -471,6 +461,9 @@ var NodeAdapter = class {
|
|
|
471
461
|
}
|
|
472
462
|
httpsOptions.rejectUnauthorized = true;
|
|
473
463
|
}
|
|
464
|
+
if (this._config.crl !== void 0) {
|
|
465
|
+
httpsOptions.crl = normalizeCRL(this._config.crl);
|
|
466
|
+
}
|
|
474
467
|
if (this._config.rejectUnauthorized === false) {
|
|
475
468
|
httpsOptions.rejectUnauthorized = false;
|
|
476
469
|
}
|
|
@@ -994,6 +987,36 @@ async function streamResponseBody(res, writable, totalBytes, onProgress) {
|
|
|
994
987
|
res.on("close", onResponseClose);
|
|
995
988
|
});
|
|
996
989
|
}
|
|
990
|
+
var PEM_CRL_HEADER = "-----BEGIN X509 CRL-----";
|
|
991
|
+
var PEM_CRL_BLOCK = /-----BEGIN X509 CRL-----[\s\S]*?-----END X509 CRL-----/g;
|
|
992
|
+
var RESIDUE_OUTSIDE_PEM_BLOCKS = /\S/;
|
|
993
|
+
function normalizeCRL(crl) {
|
|
994
|
+
if (Array.isArray(crl)) {
|
|
995
|
+
return crl.flatMap((entry) => normalizeCRLEntry(entry));
|
|
996
|
+
}
|
|
997
|
+
return normalizeCRLEntry(crl);
|
|
998
|
+
}
|
|
999
|
+
function normalizeCRLEntry(entry) {
|
|
1000
|
+
if (typeof entry === "string") {
|
|
1001
|
+
return splitCRLString(entry);
|
|
1002
|
+
}
|
|
1003
|
+
const text = entry.toString("latin1");
|
|
1004
|
+
if (!text.includes(PEM_CRL_HEADER)) {
|
|
1005
|
+
return entry;
|
|
1006
|
+
}
|
|
1007
|
+
const split = splitCRLString(text);
|
|
1008
|
+
return Array.isArray(split) ? split : entry;
|
|
1009
|
+
}
|
|
1010
|
+
function splitCRLString(crl) {
|
|
1011
|
+
const blocks = crl.match(PEM_CRL_BLOCK) ?? [];
|
|
1012
|
+
const residue = crl.replace(PEM_CRL_BLOCK, "");
|
|
1013
|
+
if (RESIDUE_OUTSIDE_PEM_BLOCKS.test(residue)) {
|
|
1014
|
+
throw new Error(
|
|
1015
|
+
"NodeAdapter: the `crl` value contains content outside any complete -----BEGIN/END X509 CRL----- block. Only PEM CRL blocks separated by whitespace are accepted, because a truncated CRL and a line of commentary are indistinguishable \u2014 accepting the second would mean silently dropping the first and enforcing an incomplete revocation set. Common causes: a partial download, a clipped or mistyped delimiter, or decoded text from `openssl ... -text`, which must be stripped before the bundle is passed here."
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
return blocks.length > 1 ? blocks : crl;
|
|
1019
|
+
}
|
|
997
1020
|
function normalizeResponseHeaders(headers) {
|
|
998
1021
|
const result = {};
|
|
999
1022
|
for (const [key, value] of Object.entries(headers)) {
|