@browsercore/tls 0.4.18 → 0.4.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 +291 -6
- package/dist/certificates/ca-constraints.d.ts +43 -0
- package/dist/certificates/ca-constraints.d.ts.map +1 -0
- package/dist/certificates/ca-constraints.js +89 -0
- package/dist/certificates/ca-constraints.js.map +1 -0
- package/dist/certificates/cert-extensions.d.ts +106 -19
- package/dist/certificates/cert-extensions.d.ts.map +1 -1
- package/dist/certificates/cert-extensions.js +203 -48
- package/dist/certificates/cert-extensions.js.map +1 -1
- package/dist/certificates/certificate-path.d.ts +341 -0
- package/dist/certificates/certificate-path.d.ts.map +1 -0
- package/dist/certificates/certificate-path.js +613 -0
- package/dist/certificates/certificate-path.js.map +1 -0
- package/dist/certificates/certificates.d.ts +66 -47
- package/dist/certificates/certificates.d.ts.map +1 -1
- package/dist/certificates/certificates.js +251 -92
- package/dist/certificates/certificates.js.map +1 -1
- package/dist/certificates/der.d.ts +0 -8
- package/dist/certificates/der.d.ts.map +1 -1
- package/dist/certificates/der.js +0 -42
- package/dist/certificates/der.js.map +1 -1
- package/dist/certificates/extension-policy.d.ts +205 -0
- package/dist/certificates/extension-policy.d.ts.map +1 -0
- package/dist/certificates/extension-policy.js +357 -0
- package/dist/certificates/extension-policy.js.map +1 -0
- package/dist/certificates/extension-values.d.ts +131 -0
- package/dist/certificates/extension-values.d.ts.map +1 -0
- package/dist/certificates/extension-values.js +443 -0
- package/dist/certificates/extension-values.js.map +1 -0
- package/dist/certificates/general-names.d.ts +142 -0
- package/dist/certificates/general-names.d.ts.map +1 -0
- package/dist/certificates/general-names.js +354 -0
- package/dist/certificates/general-names.js.map +1 -0
- package/dist/certificates/name-constraints.d.ts +245 -0
- package/dist/certificates/name-constraints.d.ts.map +1 -0
- package/dist/certificates/name-constraints.js +692 -0
- package/dist/certificates/name-constraints.js.map +1 -0
- package/dist/certificates/name-match.d.ts +59 -0
- package/dist/certificates/name-match.d.ts.map +1 -0
- package/dist/certificates/name-match.js +271 -0
- package/dist/certificates/name-match.js.map +1 -0
- package/dist/certificates/signature-algorithm.d.ts +54 -0
- package/dist/certificates/signature-algorithm.d.ts.map +1 -0
- package/dist/certificates/signature-algorithm.js +359 -0
- package/dist/certificates/signature-algorithm.js.map +1 -0
- package/dist/connection/handshake-driver.d.ts +9 -6
- package/dist/connection/handshake-driver.d.ts.map +1 -1
- package/dist/connection/handshake-driver.js.map +1 -1
- package/dist/connection/handshake-messages.d.ts +9 -2
- package/dist/connection/handshake-messages.d.ts.map +1 -1
- package/dist/connection/handshake-messages.js +57 -23
- package/dist/connection/handshake-messages.js.map +1 -1
- package/dist/errors.d.ts +100 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/tls.d.ts +4 -3
- package/dist/tls.d.ts.map +1 -1
- package/dist/tls.js +4 -3
- package/dist/tls.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension policy decisions (RFC 5280 §4.2, BoringSSL pki verify_certificate_chain.cc).
|
|
3
|
+
*
|
|
4
|
+
* Pure deciders over extension bytes — no path knowledge, no I/O. They answer
|
|
5
|
+
* the two questions path validation asks about every certificate on a built
|
|
6
|
+
* path:
|
|
7
|
+
*
|
|
8
|
+
* 1. May this CRITICAL extension be consumed (or must the certificate be
|
|
9
|
+
* rejected)? — mirrors BoringSSL's `IsHandledCriticalExtension` plus the
|
|
10
|
+
* special cases in `VerifyNoUnconsumedCriticalExtensions`, evaluated for
|
|
11
|
+
* Chrome's TLS-server-auth verification (KeyPurpose::SERVER_AUTH,
|
|
12
|
+
* allow_precertificate=false — SimplePathBuilderDelegate::AcceptPreCertificates
|
|
13
|
+
* returns false and cert_verify_proc_builtin.cc does not override it).
|
|
14
|
+
* 2. Is this certificate's EKU usable for TLS server authentication? —
|
|
15
|
+
* mirrors BoringSSL's `VerifyExtendedKeyUsage` SERVER_AUTH ("Legacy
|
|
16
|
+
* compatible") branch, the policy Chromium 140's built-in verifier runs
|
|
17
|
+
* (cert_verify_proc_builtin.cc passes `bssl::KeyPurpose::SERVER_AUTH` to
|
|
18
|
+
* the CertPathBuilder).
|
|
19
|
+
*
|
|
20
|
+
* RFC 5280 §4.2 mandates the backdrop for (1): "A certificate-using system
|
|
21
|
+
* MUST reject the certificate if it encounters a critical extension it does
|
|
22
|
+
* not recognize or a critical extension that contains information that it
|
|
23
|
+
* cannot process." The recognized set below is EXACTLY BoringSSL's — neither
|
|
24
|
+
* stricter nor looser — so this verifier behaves like Chrome.
|
|
25
|
+
*
|
|
26
|
+
* Extension STRUCTURE parsing (the Extensions SEQUENCE, the critical BOOLEAN,
|
|
27
|
+
* the EKU value itself) lives in cert-extensions.ts; this module only decides
|
|
28
|
+
* about already-decoded records and extension values.
|
|
29
|
+
*/
|
|
30
|
+
import { parseOid, readTlv } from "./der.js";
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Named OID constants (RFC 5280 arcs — never write a dotted OID inline; every
|
|
33
|
+
// consumer imports the named constant).
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
/** id-ce-basicConstraints (RFC 5280 §4.2.1.9). */
|
|
36
|
+
export const BASIC_CONSTRAINTS_OID = "2.5.29.19";
|
|
37
|
+
/** id-ce-keyUsage (RFC 5280 §4.2.1.3). */
|
|
38
|
+
export const KEY_USAGE_OID = "2.5.29.15";
|
|
39
|
+
/** id-ce-subjectAltName (RFC 5280 §4.2.1.6). */
|
|
40
|
+
export const SUBJECT_ALT_NAME_OID = "2.5.29.17";
|
|
41
|
+
/** id-ce-nameConstraints (RFC 5280 §4.2.1.10). */
|
|
42
|
+
export const NAME_CONSTRAINTS_OID = "2.5.29.30";
|
|
43
|
+
/** id-ce-cRLDistributionPoints (RFC 5280 §4.2.1.13) — NOT parsed at parse time (see README). */
|
|
44
|
+
export const CRL_DISTRIBUTION_POINTS_OID = "2.5.29.31";
|
|
45
|
+
/** id-ce-subjectKeyIdentifier (RFC 5280 §4.2.1.2). */
|
|
46
|
+
export const SUBJECT_KEY_IDENTIFIER_OID = "2.5.29.14";
|
|
47
|
+
/** id-ce-authorityKeyIdentifier (RFC 5280 §4.2.1.1). */
|
|
48
|
+
export const AUTHORITY_KEY_IDENTIFIER_OID = "2.5.29.35";
|
|
49
|
+
/** id-pe-authorityInfoAccess (RFC 5280 §4.2.2.1). */
|
|
50
|
+
export const AUTHORITY_INFO_ACCESS_OID = "1.3.6.1.5.5.7.1.1";
|
|
51
|
+
/** id-ce-certificatePolicies (RFC 5280 §4.2.1.4). */
|
|
52
|
+
export const CERTIFICATE_POLICIES_OID = "2.5.29.32";
|
|
53
|
+
/** id-ce-inhibitAnyPolicy (RFC 5280 §4.2.1.5). */
|
|
54
|
+
export const INHIBIT_ANY_POLICY_OID = "2.5.29.54";
|
|
55
|
+
/** id-ce-extKeyUsage (RFC 5280 §4.2.1.12). */
|
|
56
|
+
export const EXTENDED_KEY_USAGE_OID = "2.5.29.37";
|
|
57
|
+
/** id-kp-serverAuth (RFC 5280 §4.2.1.12). */
|
|
58
|
+
export const SERVER_AUTH_EKU_OID = "1.3.6.1.5.5.7.3.1";
|
|
59
|
+
/** id-kp-clientAuth (RFC 5280 §4.2.1.12) — NOT sufficient for this client's role. */
|
|
60
|
+
export const CLIENT_AUTH_EKU_OID = "1.3.6.1.5.5.7.3.2";
|
|
61
|
+
/** anyExtendedKeyUsage (RFC 5280 §4.2.1.12: `{ id-ce-extKeyUsage 0 }`). */
|
|
62
|
+
export const ANY_EKU_OID = "2.5.29.37.0";
|
|
63
|
+
/** anyPolicy (RFC 5280 §4.2.1.4: `{ id-ce-certificatePolicies 0 }`). */
|
|
64
|
+
export const ANY_POLICY_OID = "2.5.29.32.0";
|
|
65
|
+
/** id-ce-policyMappings (RFC 5280 §4.2.1.5). */
|
|
66
|
+
export const POLICY_MAPPINGS_OID = "2.5.29.33";
|
|
67
|
+
/** id-ce-policyConstraints (RFC 5280 §4.2.1.5). */
|
|
68
|
+
export const POLICY_CONSTRAINTS_OID = "2.5.29.36";
|
|
69
|
+
/** XCN_OID_APPLICATION_CERT_POLICIES (MSApplicationPolicies), Windows-enrolled. */
|
|
70
|
+
export const MS_APPLICATION_POLICIES_OID = "1.3.6.1.4.1.311.21.10";
|
|
71
|
+
/** id-qt-cps (RFC 5280 §4.2.1.4: CPSuri qualifier). */
|
|
72
|
+
export const CPS_QUALIFIER_OID = "1.3.6.1.5.5.7.2.1";
|
|
73
|
+
/** id-qt-unotice (RFC 5280 §4.2.1.4: userNotice qualifier). */
|
|
74
|
+
export const USER_NOTICE_QUALIFIER_OID = "1.3.6.1.5.5.7.2.2";
|
|
75
|
+
/**
|
|
76
|
+
* The OIDs this verifier HANDLES when a certificate marks them critical.
|
|
77
|
+
*
|
|
78
|
+
* This is BoringSSL's `IsHandledCriticalExtension` (pki/verify_certificate_chain.cc
|
|
79
|
+
* at the revision Chromium 140 pins, boringssl 0a0009998fa180695f3e2071805dc03c9a5f3124)
|
|
80
|
+
* with exactly one deliberate removal — nameConstraints, whose handling is
|
|
81
|
+
* described at {@link NAME_CONSTRAINTS_OID} below. Conditional entries are NOT
|
|
82
|
+
* in this list; they are decided by {@link isCriticalExtensionHandled}:
|
|
83
|
+
*
|
|
84
|
+
* - certificatePolicies: BoringSSL accepts a critical certificatePolicies
|
|
85
|
+
* only if the value parses with `fail_parsing_unknown_qualifier_oids=true`
|
|
86
|
+
* (the quoted RFC 5280 §4.2.1.4 condition in its source) — see
|
|
87
|
+
* {@link criticalCertificatePoliciesProcessable}.
|
|
88
|
+
* - MSApplicationPolicies: ignored as critical only when the certificate
|
|
89
|
+
* also carries an EKU extension (`VerifyNoUnconsumedCriticalExtensions`,
|
|
90
|
+
* per crbug.com/1439638).
|
|
91
|
+
*
|
|
92
|
+
* Per-OID WHY (each entry: what Chrome does with it, and why accepting it
|
|
93
|
+
* critical cannot accept a chain Chrome would reject):
|
|
94
|
+
*
|
|
95
|
+
* - basicConstraints 2.5.29.19: PROCESSED — isCa/pathLenConstraint feed the
|
|
96
|
+
* issuer-authorization and path-length checks.
|
|
97
|
+
* - keyUsage 2.5.29.15: PROCESSED (keyCertSign on issuers). BoringSSL's own
|
|
98
|
+
* comment: "Key Usage is NOT processed for end-entity certificates (this
|
|
99
|
+
* is the responsibility of callers), however it is considered 'handled'
|
|
100
|
+
* here in order to allow being marked as critical."
|
|
101
|
+
* - extKeyUsage 2.5.29.37: PROCESSED — the SERVER_AUTH EKU rule of this
|
|
102
|
+
* subset.
|
|
103
|
+
* - subjectAltName 2.5.29.17: PROCESSED — the hostname check consumes it.
|
|
104
|
+
* - policyMappings 2.5.29.33 / policyConstraints 2.5.29.36 /
|
|
105
|
+
* inhibitAnyPolicy 2.5.29.54: BoringSSL returns true for all three (`if
|
|
106
|
+
* (extension.oid == der::Input(kPolicyMappingsOid)) { return true; }` etc.)
|
|
107
|
+
* and enforces them inside its policy graph. This verifier performs no
|
|
108
|
+
* policy processing (documented limitation); under Chrome's SERVER_AUTH
|
|
109
|
+
* verification the initial policy set is {anyPolicy}, so these constraints
|
|
110
|
+
* cannot make Chrome reject a path this verifier would accept — accepting
|
|
111
|
+
* them critical matches Chrome exactly for the purposes of this verifier.
|
|
112
|
+
* - nameConstraints 2.5.29.30: PROCESSED (the name-constraints subset) —
|
|
113
|
+
* BoringSSL marks it handled BECAUSE IT PROCESSES name constraints
|
|
114
|
+
* (`NameConstraints::Create` + `IsPermittedCert`; its
|
|
115
|
+
* IsHandledCriticalExtension branch is `if (extension.oid ==
|
|
116
|
+
* der::Input(kNameConstraintsOid)) { return true; }`); the constraints
|
|
117
|
+
* are enforced by certificate-path.ts, and the extension VALUE is
|
|
118
|
+
* strictly parsed at certificate-parse time (critical or not) by
|
|
119
|
+
* name-constraints.ts.
|
|
120
|
+
*/
|
|
121
|
+
export const RECOGNIZED_CRITICAL_EXTENSION_OIDS = Object.freeze([
|
|
122
|
+
BASIC_CONSTRAINTS_OID,
|
|
123
|
+
KEY_USAGE_OID,
|
|
124
|
+
EXTENDED_KEY_USAGE_OID,
|
|
125
|
+
SUBJECT_ALT_NAME_OID,
|
|
126
|
+
POLICY_MAPPINGS_OID,
|
|
127
|
+
POLICY_CONSTRAINTS_OID,
|
|
128
|
+
INHIBIT_ANY_POLICY_OID,
|
|
129
|
+
NAME_CONSTRAINTS_OID,
|
|
130
|
+
]);
|
|
131
|
+
/**
|
|
132
|
+
* Decide whether a CRITICAL extension with the given OID and (unwrapped,
|
|
133
|
+
* extnValue-content) `value` may be consumed by this verifier, or must fail
|
|
134
|
+
* with `unsupported-critical-extension`.
|
|
135
|
+
*
|
|
136
|
+
* Mirrors BoringSSL `VerifyNoUnconsumedCriticalExtensions` +
|
|
137
|
+
* `IsHandledCriticalExtension` in SERVER_AUTH mode with
|
|
138
|
+
* allow_precertificate=false:
|
|
139
|
+
*
|
|
140
|
+
* - RCS MLS participant-information OIDs (2.23.146.2.1.4 / 2.23.146.2.1.5)
|
|
141
|
+
* are exempt only for KeyPurpose::RCS_MLS_CLIENT_AUTH — not this purpose —
|
|
142
|
+
* so a critical one is rejected here, exactly as BoringSSL does for server
|
|
143
|
+
* auth.
|
|
144
|
+
* - The CT poison OID (RFC 6962 §3.1, 1.3.6.1.4.1.11129.2.4.3) is exempt
|
|
145
|
+
* only when the delegate accepts pre-certificates
|
|
146
|
+
* (`allow_precertificate && extension.oid == kCtPoisonOid`); Chrome's
|
|
147
|
+
* verifier never does (`SimplePathBuilderDelegate::AcceptPreCertificates()
|
|
148
|
+
* { return false; }`, not overridden by cert_verify_proc_builtin.cc), so a
|
|
149
|
+
* critical poison extension is rejected — the same holds for a critical
|
|
150
|
+
* embedded SCT list (1.3.6.1.4.1.11129.2.4.2), which appears in no
|
|
151
|
+
* exemption branch at all.
|
|
152
|
+
*
|
|
153
|
+
* `certificateHasEku` gates the MSApplicationPolicies special case.
|
|
154
|
+
*/
|
|
155
|
+
export function isCriticalExtensionHandled(oid, value, certificateHasEku) {
|
|
156
|
+
if (RECOGNIZED_CRITICAL_EXTENSION_OIDS.includes(oid)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
// Conditional BoringSSL case 1 — critical certificatePolicies. Its source:
|
|
160
|
+
//
|
|
161
|
+
// "Policy qualifiers are skipped during processing, so if the
|
|
162
|
+
// extension is marked critical need to ensure there weren't any
|
|
163
|
+
// qualifiers other than User Notice / CPS.
|
|
164
|
+
// ...
|
|
165
|
+
// This follows from RFC 5280 section 4.2.1.4:
|
|
166
|
+
// If this extension is critical, the path validation software MUST
|
|
167
|
+
// be able to interpret this extension (including the optional
|
|
168
|
+
// qualifier), or MUST reject the certificate."
|
|
169
|
+
//
|
|
170
|
+
// Decided by parsing the value strictly: an unknown qualifier OID or any
|
|
171
|
+
// structural fault means NOT handled → rejected (the
|
|
172
|
+
// kUnconsumedCriticalExtension outcome).
|
|
173
|
+
if (oid === CERTIFICATE_POLICIES_OID) {
|
|
174
|
+
return criticalCertificatePoliciesProcessable(value);
|
|
175
|
+
}
|
|
176
|
+
// Conditional BoringSSL case 2 — MSApplicationPolicies may be ignored when
|
|
177
|
+
// an EKU extension is also present ("The MSApplicationPolicies extension
|
|
178
|
+
// may be ignored if the extendedKeyUsage extension is also present",
|
|
179
|
+
// crbug.com/1439638); without EKU it stays an unconsumed critical
|
|
180
|
+
// extension.
|
|
181
|
+
if (oid === MS_APPLICATION_POLICIES_OID && certificateHasEku) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Whether a critical certificatePolicies value is processable, mirroring
|
|
188
|
+
* BoringSSL `ParseCertificatePoliciesExtensionOids(value,
|
|
189
|
+
* fail_parsing_unknown_qualifier_oids=true, …)` exactly
|
|
190
|
+
* (pki/certificate_policies.cc):
|
|
191
|
+
*
|
|
192
|
+
* - the value is one SEQUENCE covering all its bytes, with at least one
|
|
193
|
+
* element ("The certificatePolicies sequence should have at least 1
|
|
194
|
+
* element" — kPoliciesEmptySequence otherwise);
|
|
195
|
+
* - each PolicyInformation is SEQUENCE { policyIdentifier OID, optional
|
|
196
|
+
* policyQualifiers SEQUENCE (≥ 1 element) }, no trailing data
|
|
197
|
+
* (kPolicyInformationTrailingData otherwise);
|
|
198
|
+
* - each PolicyQualifierInfo is SEQUENCE { policyQualifierId OID, qualifier
|
|
199
|
+
* ANY }, no trailing data (kPolicyQualifierInfoTrailingData), and the
|
|
200
|
+
* qualifier OID must be id-qt-cps or id-qt-unotice
|
|
201
|
+
* (`if (restrict_to_known_qualifiers && qualifier_oid != kCpsPointerId &&
|
|
202
|
+
* qualifier_oid != kUserNoticeId)` → kUnknownPolicyQualifierOid); the
|
|
203
|
+
* qualifier ANY must be present (kMissingQualifier);
|
|
204
|
+
* - no policy OID appears twice ("A certificate policy OID MUST NOT appear
|
|
205
|
+
* more than once in a certificate policies extension" — kPoliciesDuplicateOid).
|
|
206
|
+
*
|
|
207
|
+
* Returns false (never throws) for any malformation: a failed parse makes
|
|
208
|
+
* IsHandledCriticalExtension return false, i.e. the certificate is rejected as
|
|
209
|
+
* carrying an unrecognized critical extension — never a parse error.
|
|
210
|
+
*/
|
|
211
|
+
export function criticalCertificatePoliciesProcessable(value) {
|
|
212
|
+
try {
|
|
213
|
+
// certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation.
|
|
214
|
+
const seq = readTlv(value, 0);
|
|
215
|
+
if (seq.tag !== 0x30 || seq.end !== value.length || seq.valueStart >= seq.end) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const seenPolicyOids = new Set();
|
|
219
|
+
let o = seq.valueStart;
|
|
220
|
+
while (o < seq.end) {
|
|
221
|
+
const policyInformation = readTlv(value, o);
|
|
222
|
+
if (policyInformation.tag !== 0x30 || policyInformation.end > seq.end) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
if (!policyInformationProcessable(value, policyInformation, seenPolicyOids)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
o = policyInformation.end;
|
|
229
|
+
}
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Truncated/garbled DER — readTlv/parseOid throw TlsHandshakeError;
|
|
234
|
+
// the BoringSSL equivalent returns false (a value-parse failure only
|
|
235
|
+
// means "not handled as critical extension", never a crash).
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* One PolicyInformation ::= SEQUENCE { policyIdentifier OID, policyQualifiers
|
|
241
|
+
* SEQUENCE OF PolicyQualifierInfo OPTIONAL }: OID first, no trailing data, and
|
|
242
|
+
* (for the duplicate check — kPoliciesDuplicateOid) a policy OID that has not
|
|
243
|
+
* been seen before. Returns false instead of throwing.
|
|
244
|
+
*/
|
|
245
|
+
function policyInformationProcessable(value, policyInformation, seenPolicyOids) {
|
|
246
|
+
let p = policyInformation.valueStart;
|
|
247
|
+
// policyIdentifier CertPolicyId (an OBJECT IDENTIFIER).
|
|
248
|
+
const oidTlv = readTlv(value, p);
|
|
249
|
+
if (oidTlv.tag !== 0x06) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const policyOid = parseOid(value, oidTlv.valueStart, oidTlv.end);
|
|
253
|
+
p = oidTlv.end;
|
|
254
|
+
if (seenPolicyOids.has(policyOid)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
seenPolicyOids.add(policyOid);
|
|
258
|
+
// Optional policyQualifiers SEQUENCE SIZE (1..MAX) OF PolicyQualifierInfo.
|
|
259
|
+
if (p < policyInformation.end) {
|
|
260
|
+
const qualifiers = readTlv(value, p);
|
|
261
|
+
p = qualifiers.end;
|
|
262
|
+
if (qualifiers.tag !== 0x30 || qualifiers.valueStart >= qualifiers.end) {
|
|
263
|
+
// An empty qualifiers SEQUENCE fails ("If it is present, the
|
|
264
|
+
// policyQualifiers sequence should have at least 1 element" —
|
|
265
|
+
// kPolicyQualifiersEmptySequence).
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
if (!policyQualifiersProcessable(value, qualifiers)) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (p !== policyInformation.end) {
|
|
273
|
+
// kPolicyInformationTrailingData.
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* One policyQualifiers SEQUENCE: every PolicyQualifierInfo must be
|
|
280
|
+
* SEQUENCE { policyQualifierId OID, qualifier ANY } with no trailing data, and
|
|
281
|
+
* the qualifier OID must be id-qt-cps or id-qt-unotice
|
|
282
|
+
* (`if (restrict_to_known_qualifiers && qualifier_oid != kCpsPointerId &&
|
|
283
|
+
* qualifier_oid != kUserNoticeId)` → kUnknownPolicyQualifierOid — restricted
|
|
284
|
+
* mode is always on here, fail_parsing_unknown_qualifier_oids = true;
|
|
285
|
+
* BoringSSL additionally restricts when the policy OID is anyPolicy, which is
|
|
286
|
+
* subsumed). Returns false instead of throwing.
|
|
287
|
+
*/
|
|
288
|
+
function policyQualifiersProcessable(value, qualifiers) {
|
|
289
|
+
let q = qualifiers.valueStart;
|
|
290
|
+
while (q < qualifiers.end) {
|
|
291
|
+
const qualifierInfo = readTlv(value, q);
|
|
292
|
+
if (qualifierInfo.tag !== 0x30 || qualifierInfo.end > qualifiers.end) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
let qi = qualifierInfo.valueStart;
|
|
296
|
+
const qualifierOidTlv = readTlv(value, qi);
|
|
297
|
+
if (qualifierOidTlv.tag !== 0x06) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
const qualifierOid = parseOid(value, qualifierOidTlv.valueStart, qualifierOidTlv.end);
|
|
301
|
+
qi = qualifierOidTlv.end;
|
|
302
|
+
if (qualifierOid !== CPS_QUALIFIER_OID && qualifierOid !== USER_NOTICE_QUALIFIER_OID) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
// qualifier ANY DEFINED BY policyQualifierId must be present
|
|
306
|
+
// (kMissingQualifier) — readTlv throws, caught by the caller, if it is
|
|
307
|
+
// truncated.
|
|
308
|
+
const qualifierTlv = readTlv(value, qi);
|
|
309
|
+
qi = qualifierTlv.end;
|
|
310
|
+
if (qi !== qualifierInfo.end) {
|
|
311
|
+
// kPolicyQualifierInfoTrailingData.
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
q = qualifierInfo.end;
|
|
315
|
+
}
|
|
316
|
+
return q === qualifiers.end;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Whether a parsed EKU OID list makes a certificate usable for TLS server
|
|
320
|
+
* authentication, mirroring BoringSSL `VerifyExtendedKeyUsage` SERVER_AUTH
|
|
321
|
+
* ("Legacy compatible") — the policy Chromium 140 runs
|
|
322
|
+
* (cert_verify_proc_builtin.cc: `bssl::KeyPurpose::SERVER_AUTH`):
|
|
323
|
+
*
|
|
324
|
+
* ```
|
|
325
|
+
* if (required_key_purpose == KeyPurpose::SERVER_AUTH) {
|
|
326
|
+
* // Legacy compatible.
|
|
327
|
+
* if (cert.has_extended_key_usage() && !has_server_auth_eku &&
|
|
328
|
+
* !has_any_eku) {
|
|
329
|
+
* errors->AddError(cert_errors::kEkuLacksServerAuth);
|
|
330
|
+
* }
|
|
331
|
+
* }
|
|
332
|
+
* ```
|
|
333
|
+
*
|
|
334
|
+
* This branch runs for the target certificate AND for every issuer (the
|
|
335
|
+
* enclosing `is_target_cert` / `is_target_cert_issuer` code paths only add
|
|
336
|
+
* WARNINGS in non-strict SERVER_AUTH mode: a missing EKU extension is only a
|
|
337
|
+
* warning — BoringSSL's comment: "At this time (until at least 2023) some
|
|
338
|
+
* intermediates are lacking EKU in the world at large from common CA's, so we
|
|
339
|
+
* allow the noEKU case to permit everything." — and codeSigning /
|
|
340
|
+
* timeStamping / OCSPSigning presence goes through `add_error_if_strict`,
|
|
341
|
+
* i.e. warnings). The deciding error is therefore uniform for every
|
|
342
|
+
* non-anchor certificate on the path:
|
|
343
|
+
*
|
|
344
|
+
* - NO EKU extension → acceptable (accepted; on a leaf only the
|
|
345
|
+
* kEkuNotPresent warning).
|
|
346
|
+
* - EKU present → it must contain id-kp-serverAuth or anyExtendedKeyUsage;
|
|
347
|
+
* anything else (clientAuth-only, codeSigning-only, or the EMPTY SEQUENCE
|
|
348
|
+
* — "present" with zero OIDs) is the kEkuLacksServerAuth error.
|
|
349
|
+
*
|
|
350
|
+
* `ekuOids` is the parsed EKU OID list (dotted); whether the extension is
|
|
351
|
+
* present at all is decided by the caller (absent → acceptable without
|
|
352
|
+
* consulting this function).
|
|
353
|
+
*/
|
|
354
|
+
export function serverAuthEkuAcceptable(ekuOids) {
|
|
355
|
+
return ekuOids.includes(SERVER_AUTH_EKU_OID) || ekuOids.includes(ANY_EKU_OID);
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=extension-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-policy.js","sourceRoot":"","sources":["../../src/certificates/extension-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE7C,8EAA8E;AAC9E,8EAA8E;AAC9E,wCAAwC;AACxC,8EAA8E;AAE9E,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AACjD,0CAA0C;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AAC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AI,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;QACtF,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC;QACzB,IAAI,YAAY,KAAK,iBAAiB,IAAI,YAAY,KAAK,yBAAyB,EAAE,CAAC;YACnF,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,6DAA6D;QAC7D,uEAAuE;QACvE,aAAa;QACb,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC;QACtB,IAAI,EAAE,KAAK,aAAa,CAAC,GAAG,EAAE,CAAC;YAC3B,oCAAoC;YACpC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC;IAC1B,CAAC;IACD,OAAO,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA0B;IAC9D,OAAO,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension VALUE parsing at certificate-parse time (Part B parity).
|
|
3
|
+
*
|
|
4
|
+
* BoringSSL's ParsedCertificate::Initialize (pki/parsed_certificate.cc at the
|
|
5
|
+
* revision Chromium 140 pins, 0a0009998fa180695f3e2071805dc03c9a5f3124) parses
|
|
6
|
+
* the VALUE of every extension below — critical or NOT — and rejects the whole
|
|
7
|
+
* certificate when the parse fails (`errors->AddError(kFailedParsing…);
|
|
8
|
+
* return nullptr;`). This module carries the strict value parsers for the
|
|
9
|
+
* extensions whose values this package previously ignored when non-critical;
|
|
10
|
+
* the reviewers' finding was exactly that gap: the package accepted
|
|
11
|
+
* certificates Chrome rejects because their NON-critical extension values
|
|
12
|
+
* were malformed.
|
|
13
|
+
*
|
|
14
|
+
* The complete BoringSSL parse-time value set (parsed_certificate.cc:154-288):
|
|
15
|
+
* basicConstraints, keyUsage, extendedKeyUsage, subjectAltName,
|
|
16
|
+
* nameConstraints, authorityInfoAccess, certificatePolicies,
|
|
17
|
+
* policyConstraints, policyMappings, inhibitAnyPolicy,
|
|
18
|
+
* subjectKeyIdentifier, authorityKeyIdentifier. The first five already have
|
|
19
|
+
* strict parsers (cert-extensions.ts / general-names.ts /
|
|
20
|
+
* name-constraints.ts); THIS module owns the rest:
|
|
21
|
+
*
|
|
22
|
+
* - authorityInfoAccess — ParseAuthorityInfoAccessURIs: SEQUENCE SIZE
|
|
23
|
+
* (1..MAX) OF AccessDescription { accessMethod OID, accessLocation
|
|
24
|
+
* GeneralName }, nothing trailing. The accessLocation is read with
|
|
25
|
+
* ReadRawTLV — ANY well-formed TLV tag is accepted (parse_certificate.cc
|
|
26
|
+
* 851-852); only a uniformResourceIdentifier [6] location gets the ASCII
|
|
27
|
+
* check (:886-891), and other tags are simply never retained.
|
|
28
|
+
* - certificatePolicies — ParseCertificatePoliciesExtensionOids with
|
|
29
|
+
* fail_parsing_unknown_qualifier_oids = FALSE (the parse-time call):
|
|
30
|
+
* structure must be exact (≥1 PolicyInformation, each { policyIdentifier
|
|
31
|
+
* OID, qualifiers SEQUENCE(1..MAX) OF PolicyQualifierInfo { qualifierId
|
|
32
|
+
* OID, qualifier ANY } } optional-but-nonempty-when-present, no trailing
|
|
33
|
+
* data, no duplicate policy OID) but ANY qualifier OID is tolerated
|
|
34
|
+
* EXCEPT under the anyPolicy identifier — "When qualifiers are used with
|
|
35
|
+
* the special policy anyPolicy, they MUST be limited to the qualifiers
|
|
36
|
+
* identified in this section" (RFC 5280 §4.2.1.4): id-qt-cps or
|
|
37
|
+
* id-qt-unotice only. (The spec assumption that unknown qualifier OIDs
|
|
38
|
+
* fail at parse time is BoringSSL's CRITICAL-handling mode, not its
|
|
39
|
+
* parse-time mode; critical acceptance is decided separately by
|
|
40
|
+
* extension-policy.ts.)
|
|
41
|
+
* - policyConstraints — ParsePolicyConstraints: SEQUENCE with at least one
|
|
42
|
+
* of requireExplicitPolicy [0] / inhibitPolicyMapping [1], each an
|
|
43
|
+
* implicitly-tagged INTEGER that must decode as a uint8 (ParseUint8:
|
|
44
|
+
* minimal, non-negative), nothing trailing — RFC 5280: "Conforming CAs
|
|
45
|
+
* MUST NOT issue certificates where policy constraints is an empty
|
|
46
|
+
* sequence".
|
|
47
|
+
* - policyMappings — ParsePolicyMappings: SEQUENCE SIZE (1..MAX) OF
|
|
48
|
+
* SEQUENCE { issuerDomainPolicy OID, subjectDomainPolicy OID }, nothing
|
|
49
|
+
* trailing.
|
|
50
|
+
* - inhibitAnyPolicy — ParseInhibitAnyPolicy: exactly one INTEGER decoding
|
|
51
|
+
* as uint8 (SkipCerts ::= INTEGER (0..MAX)), nothing trailing.
|
|
52
|
+
* - subjectKeyIdentifier — ParseSubjectKeyIdentifier: exactly one OCTET
|
|
53
|
+
* STRING.
|
|
54
|
+
* - authorityKeyIdentifier — ParseAuthorityKeyIdentifier: SEQUENCE {
|
|
55
|
+
* keyIdentifier [0] OCTET STRING OPTIONAL, authorityCertIssuer [1]
|
|
56
|
+
* GeneralNames OPTIONAL, authorityCertSerialNumber [2] INTEGER OPTIONAL }
|
|
57
|
+
* where "authorityCertIssuer and authorityCertSerialNumber MUST both be
|
|
58
|
+
* present or both be absent", nothing trailing (an empty SEQUENCE is
|
|
59
|
+
* tolerated — BoringSSL's TODO notes RFC 5280 doesn't forbid it).
|
|
60
|
+
*
|
|
61
|
+
* cRLDistributionPoints (2.5.29.31) is deliberately NOT parsed: at the
|
|
62
|
+
* pinned revision `ParseCrlDistributionPoints` has NO caller in
|
|
63
|
+
* ParsedCertificate::Create (parsed_certificate.h carries no crl field; the
|
|
64
|
+
* function is exported for Chromium's revocation layer, which tolerates
|
|
65
|
+
* malformed values) — parsing it here would reject certificates Chrome
|
|
66
|
+
* accepts.
|
|
67
|
+
*/
|
|
68
|
+
import { ANY_POLICY_OID, AUTHORITY_INFO_ACCESS_OID, AUTHORITY_KEY_IDENTIFIER_OID, CERTIFICATE_POLICIES_OID, CRL_DISTRIBUTION_POINTS_OID, CPS_QUALIFIER_OID, INHIBIT_ANY_POLICY_OID, NAME_CONSTRAINTS_OID, POLICY_CONSTRAINTS_OID, POLICY_MAPPINGS_OID, SUBJECT_KEY_IDENTIFIER_OID, USER_NOTICE_QUALIFIER_OID } from "./extension-policy.js";
|
|
69
|
+
export { ANY_POLICY_OID, AUTHORITY_INFO_ACCESS_OID, AUTHORITY_KEY_IDENTIFIER_OID, CERTIFICATE_POLICIES_OID, CRL_DISTRIBUTION_POINTS_OID, CPS_QUALIFIER_OID, INHIBIT_ANY_POLICY_OID, NAME_CONSTRAINTS_OID, POLICY_CONSTRAINTS_OID, POLICY_MAPPINGS_OID, SUBJECT_KEY_IDENTIFIER_OID, USER_NOTICE_QUALIFIER_OID, };
|
|
70
|
+
/** id-ad-ocsp (RFC 5280 §4.2.2.1). */
|
|
71
|
+
export declare const AD_OCSP_OID = "1.3.6.1.5.5.7.48.1";
|
|
72
|
+
/** id-ad-caIssuers (RFC 5280 §4.2.2.1). */
|
|
73
|
+
export declare const AD_CA_ISSUERS_OID = "1.3.6.1.5.5.7.48.2";
|
|
74
|
+
/**
|
|
75
|
+
* ParseAuthorityInfoAccessURIs twin: SEQUENCE SIZE (1..MAX) OF
|
|
76
|
+
* AccessDescription { accessMethod OBJECT IDENTIFIER, accessLocation
|
|
77
|
+
* GeneralName } — each AccessDescription exactly two elements; the
|
|
78
|
+
* accessLocation is read with ReadRawTLV, so ANY well-formed TLV tag is
|
|
79
|
+
* accepted (parse_certificate.cc:851-852 — ParseAuthorityInfoAccess retains the
|
|
80
|
+
* raw TLV and ParseAuthorityInfoAccessURIs only inspects it when the tag is
|
|
81
|
+
* uniformResourceIdentifier [6], which must be ASCII, :886-891).
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseAuthorityInfoAccess(value: Uint8Array, oid: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* ParseCertificatePoliciesExtensionOids(value,
|
|
86
|
+
* fail_parsing_unknown_qualifier_oids = false) twin — see the module comment
|
|
87
|
+
* for the exact fault list. Unknown qualifier OIDs are tolerated EXCEPT under
|
|
88
|
+
* anyPolicy (kUnknownPolicyQualifierOid fires there even in parse mode,
|
|
89
|
+
* certificate_policies.cc: `fail_parsing_unknown_qualifier_oids ||
|
|
90
|
+
* policy_oid == der::Input(kAnyPolicyOid)`).
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseCertificatePolicies(value: Uint8Array, oid: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* ParsePolicyConstraints twin: SEQUENCE { requireExplicitPolicy [0] IMPLICIT
|
|
95
|
+
* INTEGER OPTIONAL, inhibitPolicyMapping [1] IMPLICIT INTEGER OPTIONAL } with
|
|
96
|
+
* at least one field present (RFC 5280: "Conforming CAs MUST NOT issue
|
|
97
|
+
* certificates where policy constraints is an empty sequence"), each field a
|
|
98
|
+
* uint8 (ParseUint8), nothing trailing. The fields are read POSITIONALLY —
|
|
99
|
+
* ReadOptionalTag([0]) then ReadOptionalTag([1]) then HasMore() — so a
|
|
100
|
+
* repeated or out-of-order field is a fault.
|
|
101
|
+
*/
|
|
102
|
+
export declare function parsePolicyConstraints(value: Uint8Array, oid: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* ParsePolicyMappings twin: SEQUENCE SIZE (1..MAX) OF SEQUENCE {
|
|
105
|
+
* issuerDomainPolicy CertPolicyId, subjectDomainPolicy CertPolicyId } — each
|
|
106
|
+
* mapping exactly two OIDs, at least one mapping, nothing trailing.
|
|
107
|
+
*/
|
|
108
|
+
export declare function parsePolicyMappings(value: Uint8Array, oid: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* ParseInhibitAnyPolicy twin: exactly one INTEGER (SkipCerts ::= INTEGER
|
|
111
|
+
* (0..MAX)) decoding as uint8 — the whole value IS the INTEGER, so a
|
|
112
|
+
* SEQUENCE wrapper or any trailing element is the fault.
|
|
113
|
+
*/
|
|
114
|
+
export declare function parseInhibitAnyPolicy(value: Uint8Array, oid: string): void;
|
|
115
|
+
/**
|
|
116
|
+
* ParseSubjectKeyIdentifier twin: exactly one OCTET STRING (KeyIdentifier ::=
|
|
117
|
+
* OCTET STRING), nothing trailing.
|
|
118
|
+
*/
|
|
119
|
+
export declare function parseSubjectKeyIdentifier(value: Uint8Array, oid: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* ParseAuthorityKeyIdentifier twin: SEQUENCE { keyIdentifier [0] OCTET STRING
|
|
122
|
+
* OPTIONAL, authorityCertIssuer [1] GeneralNames OPTIONAL,
|
|
123
|
+
* authorityCertSerialNumber [2] INTEGER OPTIONAL } where [1] and [2] are
|
|
124
|
+
* both-present-or-both-absent ("authorityCertIssuer and
|
|
125
|
+
* authorityCertSerialNumber MUST both be present or both be absent"), nothing
|
|
126
|
+
* trailing. An EMPTY SEQUENCE is tolerated (BoringSSL's TODO: "Should having
|
|
127
|
+
* an empty AuthorityKeyIdentifier SEQUENCE be an error? RFC 5280 doesn't
|
|
128
|
+
* explicitly say it" — the parse succeeds there, so it succeeds here).
|
|
129
|
+
*/
|
|
130
|
+
export declare function parseAuthorityKeyIdentifier(value: Uint8Array, oid: string): void;
|
|
131
|
+
//# sourceMappingURL=extension-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-values.d.ts","sourceRoot":"","sources":["../../src/certificates/extension-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAIH,OAAO,EACH,cAAc,EACd,yBAAyB,EACzB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