diff options
| author | 2023-07-28 19:43:15 -0300 | |
|---|---|---|
| committer | 2023-07-28 15:43:15 -0700 | |
| commit | e7c80b90b81847be158a6e87d0200a8df4121a37 (patch) | |
| tree | e784c2311f88206ce9832447a113d81aea87afbf /src/js | |
| parent | e110ccf84d8d9034e82a79bf7abf1fa92b2370be (diff) | |
| download | bun-e7c80b90b81847be158a6e87d0200a8df4121a37.tar.gz bun-e7c80b90b81847be158a6e87d0200a8df4121a37.tar.zst bun-e7c80b90b81847be158a6e87d0200a8df4121a37.zip | |
fix(tls) exposes native canonicalizeIP and fix rootCertificates (#3866)
* exposes native canonicalizeIP
* remove unintended duplicate
* add tests
* add tests for debug builds
* add rootCertificates test and fix len
* just randomize test ids on prisma
* remove work around and bump usockets with the actual fix
* fix case
* bump uws
Diffstat (limited to 'src/js')
| -rw-r--r-- | src/js/node/tls.js | 10 | ||||
| -rw-r--r-- | src/js/out/modules/node/tls.js | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/js/node/tls.js b/src/js/node/tls.js index aa3601311..567baddc1 100644 --- a/src/js/node/tls.js +++ b/src/js/node/tls.js @@ -5,6 +5,9 @@ const InternalTCPSocket = net[Symbol.for("::bunternal::")]; const bunSocketInternal = Symbol.for("::bunnetsocketinternal::"); const { RegExp, Array, String } = $lazy("primordials"); + +const { rootCertificates, canonicalizeIP } = $lazy("internal/tls"); + const SymbolReplace = Symbol.replace; const RegExpPrototypeSymbolReplace = RegExp.prototype[SymbolReplace]; const RegExpPrototypeExec = RegExp.prototype.exec; @@ -146,11 +149,6 @@ function splitEscapedAltNames(altNames) { return result; } -// TODO: -function canonicalizeIP(ip) { - return ip; -} - function checkServerIdentity(hostname, cert) { const subject = cert.subject; const altNames = cert.subjectaltname; @@ -683,7 +681,7 @@ function convertALPNProtocols(protocols, out) { out.ALPNProtocols = protocols; } } -var rootCertificates = $lazy("rootCertificates"); + var exports = { [Symbol.for("CommonJS")]: 0, CLIENT_RENEG_LIMIT, diff --git a/src/js/out/modules/node/tls.js b/src/js/out/modules/node/tls.js index 1888b4703..245699578 100644 --- a/src/js/out/modules/node/tls.js +++ b/src/js/out/modules/node/tls.js @@ -67,8 +67,6 @@ var parseCertString = function() { currentToken += StringPrototypeSubstring.call(altNames, offset), offset = altNames.length; } return ArrayPrototypePush.call(result, currentToken), result; -}, canonicalizeIP = function(ip) { - return ip; }, checkServerIdentity = function(hostname, cert) { const { subject, subjectaltname: altNames } = cert, dnsNames = [], ips = []; if (hostname = "" + hostname, altNames) { @@ -151,7 +149,7 @@ var parseCertString = function() { out.ALPNProtocols = Buffer.from(protocols.buffer.slice(protocols.byteOffset, protocols.byteOffset + protocols.byteLength)); else if (Buffer.isBuffer(protocols)) out.ALPNProtocols = protocols; -}, InternalTCPSocket = net[Symbol.for("::bunternal::")], bunSocketInternal = Symbol.for("::bunnetsocketinternal::"), { RegExp, Array, String } = globalThis[Symbol.for("Bun.lazy")]("primordials"), SymbolReplace = Symbol.replace, RegExpPrototypeSymbolReplace = RegExp.prototype[SymbolReplace], RegExpPrototypeExec = RegExp.prototype.exec, StringPrototypeStartsWith = String.prototype.startsWith, StringPrototypeSlice = String.prototype.slice, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSplit = String.prototype.split, StringPrototypeIndexOf = String.prototype.indexOf, StringPrototypeSubstring = String.prototype.substring, StringPrototypeEndsWith = String.prototype.endsWith, StringFromCharCode = String.fromCharCode, StringPrototypeCharCodeAt = String.prototype.charCodeAt, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeForEach = Array.prototype.forEach, ArrayPrototypePush = Array.prototype.push, ArrayPrototypeSome = Array.prototype.some, ArrayPrototypeReduce = Array.prototype.reduce, jsonStringPattern = /^"(?:[^"\\\u0000-\u001f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"/, InternalSecureContext = class SecureContext2 { +}, InternalTCPSocket = net[Symbol.for("::bunternal::")], bunSocketInternal = Symbol.for("::bunnetsocketinternal::"), { RegExp, Array, String } = globalThis[Symbol.for("Bun.lazy")]("primordials"), { rootCertificates, canonicalizeIP } = globalThis[Symbol.for("Bun.lazy")]("internal/tls"), SymbolReplace = Symbol.replace, RegExpPrototypeSymbolReplace = RegExp.prototype[SymbolReplace], RegExpPrototypeExec = RegExp.prototype.exec, StringPrototypeStartsWith = String.prototype.startsWith, StringPrototypeSlice = String.prototype.slice, StringPrototypeIncludes = String.prototype.includes, StringPrototypeSplit = String.prototype.split, StringPrototypeIndexOf = String.prototype.indexOf, StringPrototypeSubstring = String.prototype.substring, StringPrototypeEndsWith = String.prototype.endsWith, StringFromCharCode = String.fromCharCode, StringPrototypeCharCodeAt = String.prototype.charCodeAt, ArrayPrototypeIncludes = Array.prototype.includes, ArrayPrototypeJoin = Array.prototype.join, ArrayPrototypeForEach = Array.prototype.forEach, ArrayPrototypePush = Array.prototype.push, ArrayPrototypeSome = Array.prototype.some, ArrayPrototypeReduce = Array.prototype.reduce, jsonStringPattern = /^"(?:[^"\\\u0000-\u001f]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4}))*"/, InternalSecureContext = class SecureContext2 { context; constructor(options) { const context = {}; @@ -416,7 +414,7 @@ var CLIENT_RENEG_LIMIT = 3, CLIENT_RENEG_WINDOW = 600, DEFAULT_ECDH_CURVE = "aut return new TLSSocket(port).connect(port, host2, connectListener); } return new TLSSocket().connect(port, host2, connectListener); -}, connect = createConnection, rootCertificates = globalThis[Symbol.for("Bun.lazy")]("rootCertificates"), exports = { +}, connect = createConnection, exports = { [Symbol.for("CommonJS")]: 0, CLIENT_RENEG_LIMIT, CLIENT_RENEG_WINDOW, |
