@browsercore/tls 0.4.19 → 0.4.21

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.
Files changed (66) hide show
  1. package/README.md +140 -23
  2. package/dist/certificates/ca-constraints.d.ts +15 -13
  3. package/dist/certificates/ca-constraints.d.ts.map +1 -1
  4. package/dist/certificates/ca-constraints.js +41 -59
  5. package/dist/certificates/ca-constraints.js.map +1 -1
  6. package/dist/certificates/cert-extensions.d.ts +59 -9
  7. package/dist/certificates/cert-extensions.d.ts.map +1 -1
  8. package/dist/certificates/cert-extensions.js +104 -50
  9. package/dist/certificates/cert-extensions.js.map +1 -1
  10. package/dist/certificates/certificate-path.d.ts +66 -7
  11. package/dist/certificates/certificate-path.d.ts.map +1 -1
  12. package/dist/certificates/certificate-path.js +125 -11
  13. package/dist/certificates/certificate-path.js.map +1 -1
  14. package/dist/certificates/certificates.d.ts.map +1 -1
  15. package/dist/certificates/certificates.js +107 -29
  16. package/dist/certificates/certificates.js.map +1 -1
  17. package/dist/certificates/extension-policy.d.ts +16 -6
  18. package/dist/certificates/extension-policy.d.ts.map +1 -1
  19. package/dist/certificates/extension-policy.js +17 -6
  20. package/dist/certificates/extension-policy.js.map +1 -1
  21. package/dist/certificates/extension-values.d.ts +131 -0
  22. package/dist/certificates/extension-values.d.ts.map +1 -0
  23. package/dist/certificates/extension-values.js +443 -0
  24. package/dist/certificates/extension-values.js.map +1 -0
  25. package/dist/certificates/general-names.d.ts +142 -0
  26. package/dist/certificates/general-names.d.ts.map +1 -0
  27. package/dist/certificates/general-names.js +354 -0
  28. package/dist/certificates/general-names.js.map +1 -0
  29. package/dist/certificates/name-constraints.d.ts +245 -0
  30. package/dist/certificates/name-constraints.d.ts.map +1 -0
  31. package/dist/certificates/name-constraints.js +692 -0
  32. package/dist/certificates/name-constraints.js.map +1 -0
  33. package/dist/certificates/name-match.d.ts +59 -0
  34. package/dist/certificates/name-match.d.ts.map +1 -0
  35. package/dist/certificates/name-match.js +271 -0
  36. package/dist/certificates/name-match.js.map +1 -0
  37. package/dist/errors.d.ts +61 -1
  38. package/dist/errors.d.ts.map +1 -1
  39. package/dist/errors.js +48 -0
  40. package/dist/errors.js.map +1 -1
  41. package/dist/handshake/client-hello.d.ts +16 -2
  42. package/dist/handshake/client-hello.d.ts.map +1 -1
  43. package/dist/handshake/client-hello.js +38 -5
  44. package/dist/handshake/client-hello.js.map +1 -1
  45. package/dist/handshake/handshake.d.ts +1 -1
  46. package/dist/handshake/handshake.d.ts.map +1 -1
  47. package/dist/handshake/handshake.js.map +1 -1
  48. package/dist/index.d.ts +2 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/session/binder.d.ts +76 -0
  53. package/dist/session/binder.d.ts.map +1 -0
  54. package/dist/session/binder.js +107 -0
  55. package/dist/session/binder.js.map +1 -0
  56. package/dist/session/psk-extension.d.ts +49 -0
  57. package/dist/session/psk-extension.d.ts.map +1 -0
  58. package/dist/session/psk-extension.js +96 -0
  59. package/dist/session/psk-extension.js.map +1 -0
  60. package/dist/session/psk-offer.d.ts +52 -0
  61. package/dist/session/psk-offer.d.ts.map +1 -0
  62. package/dist/session/psk-offer.js +62 -0
  63. package/dist/session/psk-offer.js.map +1 -0
  64. package/dist/types.d.ts +28 -1
  65. package/dist/types.d.ts.map +1 -1
  66. package/package.json +2 -2
@@ -11,7 +11,17 @@
11
11
  * extension-policy.ts — this layer only turns bytes into structured fields.
12
12
  */
13
13
  import { readTlv, peekTag, parseOid } from "./der.js";
14
- import { TlsHandshakeError } from "../errors.js";
14
+ import { TlsHandshakeError, TlsMalformedExtensionError } from "../errors.js";
15
+ import { parseGeneralNames } from "./general-names.js";
16
+ import { parseNameConstraints } from "./name-constraints.js";
17
+ import { parsePathLenConstraint } from "./ca-constraints.js";
18
+ import { BASIC_CONSTRAINTS_OID, EXTENDED_KEY_USAGE_OID, KEY_USAGE_OID, SUBJECT_ALT_NAME_OID } from "./extension-policy.js";
19
+ // ONE-definition plumbing (code-standards §22): certificates.ts keeps its
20
+ // import budget by reaching the name-constraint engine through this module
21
+ // (the extension-parsing module it already depends on) instead of adding a
22
+ // direct dependency.
23
+ export { parseGeneralNames, parseNameConstraints };
24
+ export { BASIC_CONSTRAINTS_OID, EXTENDED_KEY_USAGE_OID, KEY_USAGE_OID, SUBJECT_ALT_NAME_OID };
15
25
  /**
16
26
  * Parse the subject Name and return a readable DN string (RFC 2253-ish).
17
27
  * Used only for the `issuer` field and debug-friendliness.
@@ -202,18 +212,14 @@ export function parseExtensionsBlock(buf, start, _end) {
202
212
  export function parseExtendedKeyUsage(value) {
203
213
  const seq = readTlv(value, 0);
204
214
  if (seq.tag !== 0x30) {
205
- throw new TlsHandshakeError("certificate", {
206
- cause: new Error(`expected extendedKeyUsage SEQUENCE, got tag 0x${seq.tag.toString(16)}`),
207
- });
215
+ throw new TlsMalformedExtensionError(EXTENDED_KEY_USAGE_OID, `expected extendedKeyUsage SEQUENCE, got tag 0x${seq.tag.toString(16)}`);
208
216
  }
209
217
  const oids = [];
210
218
  let o = seq.valueStart;
211
219
  while (o < seq.end) {
212
220
  const oidTlv = readTlv(value, o);
213
221
  if (oidTlv.tag !== 0x06) {
214
- throw new TlsHandshakeError("certificate", {
215
- cause: new Error(`expected KeyPurposeId OBJECT IDENTIFIER in extendedKeyUsage, got tag 0x${oidTlv.tag.toString(16)}`),
216
- });
222
+ throw new TlsMalformedExtensionError(EXTENDED_KEY_USAGE_OID, `expected KeyPurposeId OBJECT IDENTIFIER in extendedKeyUsage, got tag 0x${oidTlv.tag.toString(16)}`);
217
223
  }
218
224
  oids.push(parseOid(value, oidTlv.valueStart, oidTlv.end));
219
225
  o = oidTlv.end;
@@ -221,56 +227,63 @@ export function parseExtendedKeyUsage(value) {
221
227
  return Object.freeze(oids);
222
228
  }
223
229
  /**
224
- * Parse the SAN extension value (already unwrapped from its OCTET STRING).
225
- * The value is a SEQUENCE OF GeneralName; we only extract dNSName entries
226
- * (context tag [2]).
230
+ * Parse the SAN extension value (already unwrapped from its OCTET STRING) —
231
+ * the STRICT GeneralNames::Create twin (see general-names.ts for the exact
232
+ * fault list): BoringSSL parses the SAN value for EVERY certificate carrying
233
+ * the extension, critical or not, and a fault rejects the whole certificate
234
+ * (kFailedParsingSubjectAltName). Returns the full parsed name set (the DNS
235
+ * names the hostname check uses, plus the rfc822 / iPAddress / directoryName
236
+ * forms the name-constraint engine consumes).
227
237
  */
228
238
  export function parseSubjectAltNames(value) {
229
- const seq = readTlv(value, 0);
230
- if (seq.tag !== 0x30) {
231
- return Object.freeze([]);
232
- }
233
- const names = [];
234
- const textDecoder = new TextDecoder();
235
- let o = seq.valueStart;
236
- while (o < seq.end) {
237
- const tlv = readTlv(value, o);
238
- // GeneralName: context-specific tag. dNSName is [2] (0x82), iPAddress [7].
239
- const tag = tlv.tag;
240
- const tagClass = tag & 0xc0;
241
- const tagNumber = tag & 0x1f;
242
- if (tagClass === 0x80 && tagNumber === 2) {
243
- names.push(textDecoder.decode(value.subarray(tlv.valueStart, tlv.end)));
244
- }
245
- o = tlv.end;
246
- }
247
- return Object.freeze(names);
239
+ return parseGeneralNames(value, SUBJECT_ALT_NAME_OID);
248
240
  }
249
241
  /**
250
242
  * Parse the KeyUsage extension value (unwrapped OCTET STRING holding a BIT
251
- * STRING). Returns the digitalSignature (bit 0) and keyEncipherment (bit 2)
252
- * flags.
243
+ * STRING) — the STRICT ParseKeyUsage twin (pki/parse_certificate.cc:794):
244
+ * BoringSSL runs this for every keyUsage extension, critical or not, and a
245
+ * fault rejects the certificate (kFailedParsingKeyUsage):
246
+ *
247
+ * - the value must be exactly one BIT STRING (nothing before or after —
248
+ * "By definition the input was a single BIT STRING");
249
+ * - the unused-bits byte must be < 8 and a BIT STRING with no data bytes
250
+ * must declare 0 unused bits (CBS_asn1_bitstring rules);
251
+ * - "When the keyUsage extension appears in a certificate, at least one of
252
+ * the bits MUST be set to 1" (RFC 5280 §4.2.1.3) — an all-zero BIT STRING
253
+ * is the parse failure (`if (BitStringIsAllZeros(...)) { return false; }`).
254
+ *
255
+ * Returns the digitalSignature (bit 0) and keyEncipherment (bit 2) flags.
253
256
  */
254
257
  export function parseKeyUsage(value) {
255
258
  const bitString = readTlv(value, 0);
256
259
  if (bitString.tag !== 0x03) {
257
- return { digitalSignature: false, keyEncipherment: false };
260
+ throw new TlsMalformedExtensionError(KEY_USAGE_OID, "expected a single BIT STRING");
261
+ }
262
+ if (bitString.end !== value.length) {
263
+ throw new TlsMalformedExtensionError(KEY_USAGE_OID, "trailing data after the BIT STRING");
258
264
  }
259
- // BIT STRING content: first byte = number of unused bits; then the bits.
260
265
  const content = value.subarray(bitString.valueStart, bitString.end);
261
- if (content.length < 2) {
262
- return { digitalSignature: false, keyEncipherment: false };
266
+ const unusedBits = content[0];
267
+ if (unusedBits === undefined) {
268
+ throw new TlsMalformedExtensionError(KEY_USAGE_OID, "BIT STRING without an unused-bits byte");
263
269
  }
264
- // Pack the used bits into an integer (big-endian bit order).
265
- const usedBytes = content.subarray(1); // skip the unused-bits count.
266
- let bits = 0;
270
+ if (unusedBits > 7 || (content.length === 1 && unusedBits !== 0)) {
271
+ throw new TlsMalformedExtensionError(KEY_USAGE_OID, "BIT STRING unused-bits byte must be 0..7 (and 0 when there is no data byte)");
272
+ }
273
+ const usedBytes = content.subarray(1);
274
+ let allZero = true;
267
275
  for (const byte of usedBytes) {
268
- bits = (bits << 8) | byte;
276
+ if (byte !== 0) {
277
+ allZero = false;
278
+ break;
279
+ }
280
+ }
281
+ if (allZero) {
282
+ // RFC 5280 §4.2.1.3 — "at least one of the bits MUST be set to 1".
283
+ throw new TlsMalformedExtensionError(KEY_USAGE_OID, "BIT STRING is all zero — RFC 5280 §4.2.1.3 requires at least one asserted bit (BoringSSL ParseKeyUsage fails the certificate)");
269
284
  }
270
285
  // The bits are left-aligned; the real bit 0 is the most significant bit of
271
286
  // the first used byte. digitalSignature = bit 0, keyEncipherment = bit 2.
272
- // bitIndex therefore maps directly to a big-endian bit position (0 = MSB of
273
- // the first byte), so no reversal is applied.
274
287
  const getBit = (index) => {
275
288
  const byteIndex = Math.floor(index / 8);
276
289
  const bitInByte = index % 8;
@@ -286,19 +299,60 @@ export function parseKeyUsage(value) {
286
299
  };
287
300
  }
288
301
  /**
289
- * Parse the BasicConstraints extension value (unwrapped OCTET STRING holding a
290
- * SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER? }).
302
+ * Parse the BasicConstraints extension value (unwrapped OCTET STRING holding
303
+ * SEQUENCE { cA BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER? }) — the
304
+ * STRICT ParseBasicConstraints twin (pki/parse_certificate.cc:735): BoringSSL
305
+ * runs this for every basicConstraints extension, critical or not, and a
306
+ * fault rejects the certificate (kFailedParsingBasicConstraints):
307
+ *
308
+ * - the value must be exactly one SEQUENCE (nothing trailing);
309
+ * - the cA BOOLEAN, when present, is der::ParseBool — one byte, 0x00 or
310
+ * 0xFF (X.690 §11.1); an explicitly-encoded FALSE is TOLERATED
311
+ * (BoringSSL's own TODO: "Should reject if CA was set to false… In
312
+ * practice however there are a lot of certificates that use the broken
313
+ * encoding");
314
+ * - the pathLenConstraint INTEGER, when present, must decode as uint8 —
315
+ * non-negative, minimally encoded, value ≤ 255 (der::ParseUint8; a larger
316
+ * constraint cannot appear in a certificate Chrome accepts);
317
+ * - nothing may follow inside the SEQUENCE.
318
+ *
319
+ * An empty SEQUENCE parses fine with cA = FALSE (the DEFAULT applies).
291
320
  */
292
321
  export function parseBasicConstraints(value) {
293
322
  const seq = readTlv(value, 0);
294
- if (seq.tag !== 0x30 || seq.valueStart >= seq.end) {
295
- return false;
323
+ if (seq.tag !== 0x30) {
324
+ throw new TlsMalformedExtensionError(BASIC_CONSTRAINTS_OID, "expected a single SEQUENCE");
325
+ }
326
+ if (seq.end !== value.length) {
327
+ throw new TlsMalformedExtensionError(BASIC_CONSTRAINTS_OID, "trailing data after the SEQUENCE");
328
+ }
329
+ let o = seq.valueStart;
330
+ let isCa = false;
331
+ if (o < seq.end) {
332
+ const boolTlv = readTlv(value, o);
333
+ if (boolTlv.tag === 0x01) {
334
+ const content = value.subarray(boolTlv.valueStart, boolTlv.end);
335
+ // der::ParseBool: exactly one byte; FALSE is 0x00, DER TRUE is 0xFF.
336
+ const byte = content[0];
337
+ if (content.length !== 1 || (byte !== 0x00 && byte !== 0xff)) {
338
+ throw new TlsMalformedExtensionError(BASIC_CONSTRAINTS_OID, "cA BOOLEAN must be exactly one byte, 0x00 or 0xFF (der::ParseBool)");
339
+ }
340
+ isCa = byte === 0xff;
341
+ o = boolTlv.end;
342
+ }
343
+ }
344
+ let pathLenConstraint = null;
345
+ if (o < seq.end) {
346
+ const intTlv = readTlv(value, o);
347
+ if (intTlv.tag === 0x02) {
348
+ pathLenConstraint = parsePathLenConstraint(value, intTlv, BASIC_CONSTRAINTS_OID);
349
+ o = intTlv.end;
350
+ }
296
351
  }
297
- if (peekTag(value, seq.valueStart) !== 0x01) {
298
- return false;
352
+ if (o !== seq.end) {
353
+ // "There shouldn't be any unconsumed data in the extension."
354
+ throw new TlsMalformedExtensionError(BASIC_CONSTRAINTS_OID, "unexpected element after cA/pathLenConstraint");
299
355
  }
300
- const boolTlv = readTlv(value, seq.valueStart);
301
- const boolByte = value[boolTlv.valueStart];
302
- return boolByte !== undefined && boolByte !== 0;
356
+ return { isCa, pathLenConstraint };
303
357
  }
304
358
  //# sourceMappingURL=cert-extensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cert-extensions.js","sourceRoot":"","sources":["../../src/certificates/cert-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAe,EAAE,KA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CAAC,qBAAqB,EAAE,+CAA+C,CAAC,CAAC;IACjH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;AACvC,CAAC"}
@@ -53,6 +53,8 @@
53
53
  */
54
54
  import type { Certificate, CryptoProvider } from "@browsercore/contracts";
55
55
  import { type CertificateFailureReason } from "../errors.js";
56
+ import type { GeneralNames } from "./general-names.js";
57
+ import { type NameConstraints } from "./name-constraints.js";
56
58
  /**
57
59
  * One entry of the ordered extension inventory of a parsed certificate
58
60
  * (RFC 5280 §4.1.2.9): the dotted extnID, the critical flag (DEFAULT FALSE per
@@ -111,6 +113,31 @@ export interface ParsedCertificate extends Certificate {
111
113
  readonly extendedKeyUsagePresent: boolean;
112
114
  /** The parsed EKU OID list (dotted, in order); empty when the extension is absent or empty. */
113
115
  readonly extendedKeyUsage: readonly string[];
116
+ /**
117
+ * The parsed subjectAltName (RFC 5280 §4.2.1.6 GeneralNames) — null when
118
+ * the extension is absent. The name-constraint engine checks these names
119
+ * (BoringSSL IsPermittedCert's subject_alt_names operand); the presence
120
+ * of the EXTENSION (not the count of names) also decides whether the
121
+ * subject's emailAddress attributes fall under rfc822Name constraints.
122
+ */
123
+ readonly sanNames: GeneralNames | null;
124
+ /**
125
+ * The parsed nameConstraints extension (RFC 5280 §4.2.1.10) — null when
126
+ * absent. Its value is parsed for EVERY certificate carrying the
127
+ * extension (a malformed value is a rejected certificate, critical or
128
+ * not — kFailedParsingNameConstraints); its CONSTRAINTS apply to the
129
+ * certificates BELOW it on the path, never to itself.
130
+ */
131
+ readonly nameConstraints: NameConstraints | null;
132
+ /**
133
+ * The subject Name's RDNSequence VALUE bytes (outer SEQUENCE tag
134
+ * stripped) — the DN-matching operand for directoryName constraints and
135
+ * the self-issued test (BoringSSL's normalized_subject() operand, with
136
+ * the per-attribute normalization done inside the matcher).
137
+ */
138
+ readonly subjectNameValue: Uint8Array;
139
+ /** The issuer Name's RDNSequence VALUE bytes (tag stripped) — the self-issued test operand. */
140
+ readonly issuerNameValue: Uint8Array;
114
141
  }
115
142
  /**
116
143
  * The server-sent certificate list: the leaf first, then every following
@@ -163,6 +190,8 @@ export type CertificatePath = {
163
190
  readonly reason: CertificatePathFailureReason;
164
191
  /** Diagnostic for the reported (deepest) failure; names the offender. */
165
192
  readonly message: string;
193
+ /** Structured outcome payload of the deepest failure, if it has one. */
194
+ readonly details?: Record<string, unknown> | undefined;
166
195
  /** The certificate the failure is attributed to. */
167
196
  readonly certificate: ParsedCertificate;
168
197
  /** Wire index of `certificate` in the server-sent list (leaf is 0). */
@@ -173,13 +202,17 @@ export type CertificatePath = {
173
202
  /**
174
203
  * A structured path-check failure: the discriminated reason plus the fully
175
204
  * rendered diagnostic (narrowed to the path-check reasons — the cores never
176
- * produce "no-anchors", which verifyChain raises before building). Exported
177
- * because the extension-policy path checks live beside the other checks here
178
- * and share the shape with their throwing wrappers.
205
+ * produce "no-anchors", which verifyChain raises before building). `details`
206
+ * carries the structured outcome payload where one exists (the name-constraint
207
+ * check puts the discriminated BoringSSL outcome under `nameConstraint`);
208
+ * undefined otherwise. Exported because the extension-policy path checks live
209
+ * beside the other checks here and share the shape with their throwing
210
+ * wrappers.
179
211
  */
180
212
  export interface PathCheckFailure {
181
213
  readonly reason: CertificatePathFailureReason;
182
214
  readonly message: string;
215
+ readonly details?: Record<string, unknown> | undefined;
183
216
  }
184
217
  /**
185
218
  * Build the certification path from the leaf to a trust anchor.
@@ -239,6 +272,32 @@ export declare function checkPathCaConstraints(path: readonly ParsedCertificate[
239
272
  export declare function pathLengthConstraintsError(path: readonly ParsedCertificate[], anchor: TrustAnchor): PathCheckFailure | undefined;
240
273
  /** Throwing wrapper around {@link pathLengthConstraintsError} (see it for the WHY). */
241
274
  export declare function checkPathLengthConstraints(path: readonly ParsedCertificate[], anchor: TrustAnchor): void;
275
+ /**
276
+ * nameConstraints enforcement along the built path (RFC 5280 §4.2.1.10,
277
+ * BoringSSL `NameConstraints::IsPermittedCert` driven from
278
+ * verify_certificate_chain.cc): the constraints of every certificate ABOVE a
279
+ * path certificate apply to it — the trust anchor's included, because this
280
+ * verifier's anchors are caller-supplied, exactly Chrome's
281
+ * `additional_trust_anchors_with_constraints` which Chromium's
282
+ * net/cert/cert_verify_proc_builtin.cc arms with
283
+ * `WithEnforceAnchorConstraints` —
284
+ * and NEVER the constraints of the certificate itself (BoringSSL accumulates
285
+ * `name_constraints_list_` in PrepareForNextCertificate and checks the NEXT
286
+ * certificates against it; the root's own name is never checked — "Don't do
287
+ * any other checks for root certificates"). A SELF-ISSUED non-target
288
+ * certificate skips the check ("If certificate i is self-issued and it is
289
+ * not the final certificate in the path, skip this step for certificate i" —
290
+ * verify_certificate_chain.cc:1176-1178; self-issued = normalized subject
291
+ * equals normalized issuer, IsSelfIssued at :132-134).
292
+ *
293
+ * Checking order mirrors BoringSSL's list: the anchor's constraints first
294
+ * (ApplyTrustAnchorConstraints pushes them at the root step), then the
295
+ * intermediates top-down. Runs ONLY from the anchor-supplied path builder —
296
+ * hostname-only mode never sees it.
297
+ */
298
+ export declare function pathNameConstraintsError(path: readonly ParsedCertificate[], anchor: TrustAnchor): PathCheckFailure | undefined;
299
+ /** Throwing wrapper around {@link pathNameConstraintsError} (see it for the WHY). */
300
+ export declare function checkPathNameConstraints(path: readonly ParsedCertificate[], anchor: TrustAnchor): void;
242
301
  /**
243
302
  * extendedKeyUsage as Chrome 140 enforces it (RFC 5280 §4.2.1.12, BoringSSL
244
303
  * `VerifyExtendedKeyUsage` with KeyPurpose::SERVER_AUTH — the value
@@ -271,10 +330,10 @@ export declare function checkPathServerAuthEku(path: readonly ParsedCertificate[
271
330
  * only checked when trust-anchor CONSTRAINT enforcement is enabled, which
272
331
  * Chrome does not do by default) — hence the {@link isAnchorOnPath} exemption.
273
332
  * The recognized set is decided by extension-policy.ts
274
- * ({@link isCriticalExtensionHandled}); a critical nameConstraints is
275
- * deliberately rejected there until the name-constraints subset lands (this
276
- * verifier does not process name constraints, and RFC 5280 §4.2 requires
277
- * rejecting unprocessed critical extensions).
333
+ * ({@link isCriticalExtensionHandled}); nameConstraints (2.5.29.30) is in the
334
+ * recognized set because its constraints are now PROCESSED (see
335
+ * {@link pathNameConstraintsError}) — BoringSSL's IsHandledCriticalExtension
336
+ * accepts it for the same reason.
278
337
  */
279
338
  export declare function pathCriticalExtensionsError(path: readonly ParsedCertificate[], anchor: TrustAnchor): PathCheckFailure | undefined;
280
339
  /** Throwing wrapper around {@link pathCriticalExtensionsError} (see it for the WHY). */
@@ -1 +1 @@
1
- {"version":3,"file":"certificate-path.d.ts","sourceRoot":"","sources":["../../src/certificates/certificate-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAelF;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACjC,2DAA2D;IAC3D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IAClD,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C;;;;OAIG;IACH,QAAQ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,EAAE,WAAW,GACpB,gBAAgB,GAAG,SAAS,CA8B9B;AAED,uFAAuF;AACvF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAKxG;AAkDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAClC,MAAM,EAAE,WAAW,GACpB,gBAAgB,GAAG,SAAS,CAqD9B;AAED,qFAAqF;AACrF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAKtG;AAuBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAClC,MAAM,EAAE,WAAW,GACpB,gBAAgB,GAAG,SAAS,CAoB9B;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAKpG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAClC,MAAM,EAAE,WAAW,GACpB,gBAAgB,GAAG,SAAS,CA0B9B;AAED,wFAAwF;AACxF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAKzG"}
@@ -52,8 +52,10 @@
52
52
  * an identity match with a pinned anchor).
53
53
  */
54
54
  import { TlsCertificateError } from "../errors.js";
55
- import { constantTimeEqual } from "../utils.js";
56
- import { isCriticalExtensionHandled, serverAuthEkuAcceptable, CERTIFICATE_POLICIES_OID, NAME_CONSTRAINTS_OID, } from "./extension-policy.js";
55
+ import { assertNever, constantTimeEqual } from "../utils.js";
56
+ import { nameMatchesExact } from "./name-match.js";
57
+ import { nameConstraintViolation, } from "./name-constraints.js";
58
+ import { isCriticalExtensionHandled, serverAuthEkuAcceptable, CERTIFICATE_POLICIES_OID, } from "./extension-policy.js";
57
59
  /**
58
60
  * Maximum intermediates between the leaf and the anchor. Chrome caps path
59
61
  * length the same way; without a limit a degenerate chain (or a hostile
@@ -101,6 +103,7 @@ function validateBuiltPath(path, anchor, now) {
101
103
  return (pathValidityWindowError(path, now) ??
102
104
  pathCaConstraintsError(path) ??
103
105
  pathLengthConstraintsError(path, anchor) ??
106
+ pathNameConstraintsError(path, anchor) ??
104
107
  pathServerAuthEkuError(path, anchor) ??
105
108
  pathCriticalExtensionsError(path, anchor));
106
109
  }
@@ -142,6 +145,7 @@ export function buildCertificatePath(chain, trustAnchors, provider, now) {
142
145
  note({
143
146
  reason: invalid.reason,
144
147
  message: invalid.message,
148
+ details: invalid.details,
145
149
  depth: path.length + 1,
146
150
  certificate: current,
147
151
  certificateIndex: path.length - 1,
@@ -169,6 +173,7 @@ export function buildCertificatePath(chain, trustAnchors, provider, now) {
169
173
  note({
170
174
  reason: invalid.reason,
171
175
  message: invalid.message,
176
+ details: invalid.details,
172
177
  depth: path.length + 1,
173
178
  certificate: current,
174
179
  certificateIndex: path.length - 1,
@@ -250,6 +255,7 @@ export function buildCertificatePath(chain, trustAnchors, provider, now) {
250
255
  kind: "unanchored",
251
256
  reason: failure.reason,
252
257
  message: failure.message,
258
+ details: failure.details,
253
259
  certificate: failure.certificate,
254
260
  certificateIndex: failure.certificateIndex,
255
261
  candidateCount: failure.candidateCount,
@@ -383,6 +389,116 @@ export function checkPathLengthConstraints(path, anchor) {
383
389
  throw new TlsCertificateError(failure.reason, failure.message);
384
390
  }
385
391
  }
392
+ /**
393
+ * Render a BoringSSL name-constraint outcome into the diagnostic that names
394
+ * the constrained certificate, the constraint holder and the offending name,
395
+ * with the excluded / not-permitted distinction carried verbatim (BoringSSL
396
+ * reports both through kNotPermittedByNameConstraints / kTooManyName
397
+ * ConstraintChecks; the sub-kind is this verifier's added detail).
398
+ */
399
+ function nameConstraintViolationMessage(subjectIndex, subject, holderDescription, violation) {
400
+ const subjectName = `certificate at index ${subjectIndex} (issuer DN "${subject.issuer}")`;
401
+ switch (violation.kind) {
402
+ case "excluded":
403
+ return (`${subjectName} violates the name constraints of ${holderDescription}: ` +
404
+ `${violation.form} "${violation.name}" matches an excludedSubtrees entry`);
405
+ case "not-permitted":
406
+ return (`${subjectName} violates the name constraints of ${holderDescription}: ` +
407
+ `${violation.form} "${violation.name}" matches no permittedSubtrees entry`);
408
+ case "unsupported-name-form":
409
+ return (`${subjectName} violates the name constraints of ${holderDescription}: ` +
410
+ `its subjectAltName carries a ${violation.form} constrained by a CRITICAL nameConstraints extension — ` +
411
+ "RFC 5280 §4.2.1.10 requires processing the constraint or rejecting the certificate");
412
+ case "subject-email-unreadable":
413
+ return (`${subjectName} violates the name constraints of ${holderDescription}: ` +
414
+ "its subject (no subjectAltName present) carries an emailAddress attribute that cannot be parsed under an rfc822Name constraint");
415
+ case "too-many-checks":
416
+ return (`${subjectName} violates the name constraints of ${holderDescription}: ` +
417
+ "the name × constraint combinations exceed the 2^20 DoS limit (kTooManyNameConstraintChecks)");
418
+ default:
419
+ // The union is exhausted; assertNever keeps it that way at
420
+ // compile time (code-standards §15).
421
+ return assertNever(violation);
422
+ }
423
+ }
424
+ /**
425
+ * nameConstraints enforcement along the built path (RFC 5280 §4.2.1.10,
426
+ * BoringSSL `NameConstraints::IsPermittedCert` driven from
427
+ * verify_certificate_chain.cc): the constraints of every certificate ABOVE a
428
+ * path certificate apply to it — the trust anchor's included, because this
429
+ * verifier's anchors are caller-supplied, exactly Chrome's
430
+ * `additional_trust_anchors_with_constraints` which Chromium's
431
+ * net/cert/cert_verify_proc_builtin.cc arms with
432
+ * `WithEnforceAnchorConstraints` —
433
+ * and NEVER the constraints of the certificate itself (BoringSSL accumulates
434
+ * `name_constraints_list_` in PrepareForNextCertificate and checks the NEXT
435
+ * certificates against it; the root's own name is never checked — "Don't do
436
+ * any other checks for root certificates"). A SELF-ISSUED non-target
437
+ * certificate skips the check ("If certificate i is self-issued and it is
438
+ * not the final certificate in the path, skip this step for certificate i" —
439
+ * verify_certificate_chain.cc:1176-1178; self-issued = normalized subject
440
+ * equals normalized issuer, IsSelfIssued at :132-134).
441
+ *
442
+ * Checking order mirrors BoringSSL's list: the anchor's constraints first
443
+ * (ApplyTrustAnchorConstraints pushes them at the root step), then the
444
+ * intermediates top-down. Runs ONLY from the anchor-supplied path builder —
445
+ * hostname-only mode never sees it.
446
+ */
447
+ export function pathNameConstraintsError(path, anchor) {
448
+ for (const [subjectIndex, subject] of path.entries()) {
449
+ // The anchor certificate is exempt from being CHECKED (trusted a
450
+ // priori; BoringSSL's verification loop `continue`s past the root) —
451
+ // including when it sits ON the path as a pinned identity match.
452
+ if (isAnchorOnPath(subject, anchor)) {
453
+ continue;
454
+ }
455
+ const subjectIsTarget = subjectIndex === 0;
456
+ // IsSelfIssued (verify_certificate_chain.cc:132-134): normalized
457
+ // subject == normalized issuer. The exact-match name comparator is
458
+ // that test (see name-match.ts for the equivalence argument).
459
+ const selfIssued = nameMatchesExact(subject.subjectNameValue, subject.issuerNameValue);
460
+ // Constraint holders ABOVE the subject, in BoringSSL's list order:
461
+ // the anchor (when it is not itself the pinned top-of-path entry —
462
+ // that entry is covered by the path sweep below), then the path
463
+ // certificates from the top down to the one just above the subject.
464
+ const anchorIsOnPath = path.some((cert) => isAnchorOnPath(cert, anchor));
465
+ const holders = [
466
+ ...(anchorIsOnPath || anchor.nameConstraints === null
467
+ ? []
468
+ : [{ description: `the trust anchor (issuer DN "${anchor.issuer}")`, constraints: anchor.nameConstraints }]),
469
+ ...path
470
+ .slice(subjectIndex + 1)
471
+ .toReversed()
472
+ .filter((holder) => holder.nameConstraints !== null)
473
+ .map((holder) => ({
474
+ description: `certificate at index ${path.indexOf(holder)} (issuer DN "${holder.issuer}")`,
475
+ constraints: holder.nameConstraints,
476
+ })),
477
+ ];
478
+ for (const holder of holders) {
479
+ const violation = nameConstraintViolation(holder.constraints, subject.sanNames, subject.subjectNameValue, subjectIsTarget, selfIssued);
480
+ if (violation !== undefined) {
481
+ return {
482
+ reason: "name-constraint-violation",
483
+ message: nameConstraintViolationMessage(subjectIndex, subject, holder.description, violation),
484
+ // The discriminated BoringSSL outcome rides in the thrown
485
+ // error's `details.nameConstraint` (see
486
+ // TlsCertificateError) — the caller-matchable form of the
487
+ // message text.
488
+ details: { nameConstraint: violation },
489
+ };
490
+ }
491
+ }
492
+ }
493
+ return undefined;
494
+ }
495
+ /** Throwing wrapper around {@link pathNameConstraintsError} (see it for the WHY). */
496
+ export function checkPathNameConstraints(path, anchor) {
497
+ const failure = pathNameConstraintsError(path, anchor);
498
+ if (failure !== undefined) {
499
+ throw new TlsCertificateError(failure.reason, failure.message, failure.details === undefined ? undefined : { details: failure.details });
500
+ }
501
+ }
386
502
  /**
387
503
  * Whether `cert` IS the trust anchor on a completed path — the pinned identity
388
504
  * match (self-signed, subject DN bytes AND SPKI bytes equal to the anchor's),
@@ -457,10 +573,10 @@ export function checkPathServerAuthEku(path, anchor) {
457
573
  * only checked when trust-anchor CONSTRAINT enforcement is enabled, which
458
574
  * Chrome does not do by default) — hence the {@link isAnchorOnPath} exemption.
459
575
  * The recognized set is decided by extension-policy.ts
460
- * ({@link isCriticalExtensionHandled}); a critical nameConstraints is
461
- * deliberately rejected there until the name-constraints subset lands (this
462
- * verifier does not process name constraints, and RFC 5280 §4.2 requires
463
- * rejecting unprocessed critical extensions).
576
+ * ({@link isCriticalExtensionHandled}); nameConstraints (2.5.29.30) is in the
577
+ * recognized set because its constraints are now PROCESSED (see
578
+ * {@link pathNameConstraintsError}) — BoringSSL's IsHandledCriticalExtension
579
+ * accepts it for the same reason.
464
580
  */
465
581
  export function pathCriticalExtensionsError(path, anchor) {
466
582
  for (const [index, cert] of path.entries()) {
@@ -474,11 +590,9 @@ export function pathCriticalExtensionsError(path, anchor) {
474
590
  if (isCriticalExtensionHandled(ext.oid, ext.value, cert.extendedKeyUsagePresent)) {
475
591
  continue;
476
592
  }
477
- const note = ext.oid === NAME_CONSTRAINTS_OID
478
- ? " (name constraints are not processed yet — RFC 5280 §4.2 requires rejecting an unprocessed critical extension)"
479
- : ext.oid === CERTIFICATE_POLICIES_OID
480
- ? " (critical certificatePolicies must parse with only CPS or userNotice qualifiers — BoringSSL IsHandledCriticalExtension)"
481
- : "";
593
+ const note = ext.oid === CERTIFICATE_POLICIES_OID
594
+ ? " (critical certificatePolicies must parse with only CPS or userNotice qualifiers — BoringSSL IsHandledCriticalExtension)"
595
+ : "";
482
596
  return {
483
597
  reason: "unsupported-critical-extension",
484
598
  message: `certificate at index ${index} (issuer DN "${cert.issuer}") carries an unrecognized ` +