tunnelfetch 1.1.1 → 1.1.2
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/package.json +1 -1
- package/src/trust/path.js +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tunnelfetch",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A fetch-shaped HTTP client that can route through HTTP CONNECT / HTTPS / SOCKS5 proxies on runtimes with only raw TCP, such as Cloudflare Workers. Implements TLS in userland because the runtime cannot verify a tunnelled peer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
package/src/trust/path.js
CHANGED
|
@@ -568,6 +568,27 @@ export async function validatePath(
|
|
|
568
568
|
addConstraints(state, cert.nameConstraints, subject,
|
|
569
569
|
cert.extensions.get(OID.nameConstraints)?.critical ?? false);
|
|
570
570
|
}
|
|
571
|
+
// EKU chaining. RFC 5280 s6.1 does NOT process extendedKeyUsage during path validation, so
|
|
572
|
+
// this is deliberately beyond the RFC floor — it is the CA/Browser Forum rule and what
|
|
573
|
+
// mozilla::pkix, Chrome and Safari all do, and it is the entire mechanism that makes a
|
|
574
|
+
// "technically constrained" sub-CA constrained. A real CA may delegate a sub-CA restricted
|
|
575
|
+
// to id-kp-clientAuth or id-kp-emailProtection instead of putting it through a full audit,
|
|
576
|
+
// relying on this rule so that compromising that key cannot mint TLS server certificates.
|
|
577
|
+
// Checking only the leaf, as this did, meant such a sub-CA could issue a serverAuth leaf for
|
|
578
|
+
// any hostname and be believed — by this client and by nothing else.
|
|
579
|
+
//
|
|
580
|
+
// An ABSENT extendedKeyUsage is unconstrained and stays accepted; that is both the RFC
|
|
581
|
+
// reading and what browsers do. Only a stated purpose list that excludes serverAuth is a
|
|
582
|
+
// refusal.
|
|
583
|
+
if (cert.extendedKeyUsage &&
|
|
584
|
+
!cert.extendedKeyUsage.includes(OID.serverAuth) &&
|
|
585
|
+
!cert.extendedKeyUsage.includes(OID.anyExtendedKeyUsage)) {
|
|
586
|
+
throw constraintError(
|
|
587
|
+
`intermediate "${subject}" has an extendedKeyUsage (${cert.extendedKeyUsage.join(', ')}) ` +
|
|
588
|
+
'that does not include serverAuth or anyExtendedKeyUsage, so it may not issue a ' +
|
|
589
|
+
'certificate used for TLS server authentication',
|
|
590
|
+
{ subject, eku: [...cert.extendedKeyUsage] });
|
|
591
|
+
}
|
|
571
592
|
} else {
|
|
572
593
|
// End-entity role checks. A leaf that is also a CA is legal (s6.1 has no prohibition);
|
|
573
594
|
// what matters is that its stated purposes include TLS server authentication.
|