Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
f6022cc
node:tls: sync the test suite to Node v26.3.0 and fix the gaps it sur…
cirospaciari Jun 29, 2026
b93229c
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 7, 2026
100afc9
node:tls: give the exported SecureContext constructor its own SSL_CTX…
cirospaciari Jul 7, 2026
cc40e66
node:net: defer abandoned-socket EOF teardown; keep close(hadError) N…
alii Jul 7, 2026
613f6e8
node:tls: constructor authorizationError=null; build _sharedCreds onc…
alii Jul 7, 2026
da98a0d
tls: auto-chain regardless of user ca; map invalid_crl to ERR_CRYPTO_…
alii Jul 7, 2026
88610f8
node:tls,node:net: block prototype-pollution of TLS verification; mat…
cirospaciari Jul 7, 2026
8c24159
tls: apply SSL_VERIFY_NONE per socket on a !requestCert server adopt
cirospaciari Jul 7, 2026
781ffe4
tls: setMaxSendFragment returns false out of OpenSSL's range instead …
cirospaciari Jul 8, 2026
068eb3c
net: only decrement a server's connection count for sockets it counted
cirospaciari Jul 8, 2026
1445535
ci: re-point the tls SSL_CTX LSan suppression at its post-#29932 symbols
cirospaciari Jul 8, 2026
d9dd85a
ci: rebuild — the darwin-26-aarch64 agent pool recovered, previous bu…
cirospaciari Jul 8, 2026
9d11d99
node:net,node:tls: honor onread's false with the true sentinel; fail …
cirospaciari Jul 8, 2026
ee269da
tls: use BoringSSL's handshake-time auto-chain instead of an eager st…
cirospaciari Jul 8, 2026
b122868
tls: pin the mirrored BoringSSL group table with a test and an upgrad…
cirospaciari Jul 8, 2026
2316052
node:net: read() on a paused onread socket still redelivers the decli…
cirospaciari Jul 8, 2026
3d1e593
node:tls: surface a natively-rejected key from the STARTTLS wrap on t…
cirospaciari Jul 8, 2026
3d3c70f
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 10, 2026
5cb13c4
tls: a bare secureContext server upgrade keeps the context's verify mode
cirospaciari Jul 10, 2026
7c3ede6
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 10, 2026
74d2a9e
node:tls: address review — shared symbols, native CA parsing, minimal…
cirospaciari Jul 11, 2026
9c12148
tls: release the listener's SSL_CTX at close() and drop the LSan supp…
cirospaciari Jul 11, 2026
15a4c4f
Merge commit 'refs/tmp/mainnow' into ciro/tls2630-merge
cirospaciari Jul 11, 2026
893d8aa
test(node/tls): reword three upstream comment markers in vendored v26…
robobun Jul 11, 2026
0dbe84c
Revert "test(node/tls): reword three upstream comment markers in vend…
robobun Jul 11, 2026
19fc7ae
tls: guard setDefaultCACertificates empty-result on snapshot.length
robobun Jul 11, 2026
ae9a524
test(net): widen mongodb-pattern RSS bound to 16MB on release
robobun Jul 11, 2026
a4dcc15
Merge remote-tracking branch 'origin/main' into claude/node-tls-26-co…
cirospaciari Jul 14, 2026
a3ba65e
http: port the InvalidCRL error to the per-crate error enum
cirospaciari Jul 14, 2026
341a92d
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 14, 2026
475e825
src: strip PR-added comments not from Node.js source
robobun Jul 15, 2026
f2ef76f
Merge remote-tracking branch 'origin/main' into claude/node-tls-26-co…
robobun Jul 16, 2026
72ccd5c
net: fix ServerHandlers.error TLS detection (this vs data) exposed by…
robobun Jul 16, 2026
1a82a2d
test(node/tls): reword three upstream comment markers in the vendored…
robobun Jul 16, 2026
96081d6
net: ServerHandlers.error TLS branch now destroys instead of no-op de…
robobun Jul 16, 2026
0dfd2dd
Revert "test(node/tls): reword three upstream comment markers in the …
robobun Jul 16, 2026
4c429d6
net: use ErrnoException for the onread zero-length ENOBUFS
robobun Jul 16, 2026
ed5be06
Revert "net: use ErrnoException for the onread zero-length ENOBUFS"
robobun Jul 16, 2026
5bf4147
net: drop stale 'delegation above is a no-op' sentence from the Plain…
robobun Jul 16, 2026
1eeea8e
net: SocketEmitEndNT delegates to finishSocketEnd for the EOF body
robobun Jul 16, 2026
b65ea59
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 16, 2026
00b8c5f
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 17, 2026
0fc6370
test(net): widen handle-leak RSS margin to 24MB on release
robobun Jul 17, 2026
d7139f8
Merge remote-tracking branch 'origin/main' into claude/node-tls-26-co…
robobun Jul 17, 2026
37e5363
test(tls): bind ssl-ctx-cache servers to 127.0.0.1 explicitly
robobun Jul 17, 2026
f7881db
Merge branch 'main' into claude/node-tls-26-compat
cirospaciari Jul 17, 2026
e4dc6ba
test(net,tls): bind PR-added servers and clients to 127.0.0.1 explicitly
robobun Jul 17, 2026
d4b92a1
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 17, 2026
5856176
test(net): add rationale for the handle-leak RSS margin and fix stale…
robobun Jul 17, 2026
44134b9
test(net): widen connect({path}) reused-handle page-count threshold t…
robobun Jul 17, 2026
8f2235e
tls: vendor test-tls-delayed-attach-error from Node v26.3.0
cirospaciari Jul 18, 2026
d6e2b68
tls: stage duplex bytes that arrive before the TLS engine starts
cirospaciari Jul 18, 2026
4a8b668
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 18, 2026
4fca545
tls: honour requestCert on the duplex path, deliver a pre-engine EOF
cirospaciari Jul 18, 2026
562bfb8
tls: SNICallback on adopted sockets, server-side ALPN on the adopt path
cirospaciari Jul 20, 2026
2c898a8
test: quarantine worker-terminate ASAN crashes, matching main
cirospaciari Jul 20, 2026
f413d61
test: quarantine musl-only onGC timing flakes, matching #34631
cirospaciari Jul 20, 2026
6c35398
test: mark no-orphans flaky on macOS
cirospaciari Jul 20, 2026
e60fd5a
test: quarantine http2 reset-flood ASAN crash
cirospaciari Jul 21, 2026
c4cc821
tls: send close_notify on end() and flush it on the duplex path (+3 t…
cirospaciari Jul 21, 2026
a7d1efe
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 21, 2026
8c733fe
Remove scratch folder
Jarred-Sumner Jul 21, 2026
b3dbbcf
test: drop expectations.txt changes from this branch
Jarred-Sumner Jul 21, 2026
16468e6
test: sync expectations.txt to current main
cirospaciari Jul 21, 2026
dc2078b
jsc: drain queued JIT plans before an explicit synchronous GC
cirospaciari Jul 21, 2026
d78bc17
ci: allow binary size growth for the node-v26 compat stack [allow size]
cirospaciari Jul 21, 2026
c4f0dc5
jsc: sanitize the stack before an explicit synchronous GC
cirospaciari Jul 21, 2026
605c98b
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 21, 2026
8426d12
event loop: scrub callee stack before timer and immediate dispatch
cirospaciari Jul 21, 2026
e838710
event loop: add the missing safety comment on the scrub memset [allow…
cirospaciari Jul 21, 2026
1c05b51
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 21, 2026
273f2e7
timers: keep safety comments adjacent to their unsafe blocks [allow s…
cirospaciari Jul 21, 2026
1991dda
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 21, 2026
7233c65
test harness: expose gc() with Node's synchronous semantics
cirospaciari Jul 22, 2026
89830b3
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 22, 2026
6b3857d
event loop: widen the callee-stack scrub window to 32 KB [allow size]
cirospaciari Jul 22, 2026
ab02c18
timers: scrub the callee stack inside drain_timers, covering all plat…
cirospaciari Jul 22, 2026
9a26b36
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 22, 2026
909eb69
Remove the explicit-GC stack-scrub and JIT-drain experiments
cirospaciari Jul 22, 2026
562ba7d
tls: move the duplex server-verify override into SSLWrapper
cirospaciari Jul 22, 2026
42ee0fb
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 22, 2026
8af2ae5
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 22, 2026
fd590d4
Address review findings: TLS spill-close hang, buffer and guard cleanups
cirospaciari Jul 22, 2026
3555483
tls: fix injected/wrapped-socket upgrades (double TLS, pre-wrap write…
cirospaciari Jul 22, 2026
56f26c7
lint: hoist the handle read above the destroy conditional chain [allo…
cirospaciari Jul 22, 2026
d13336c
net: hoist the adopted-TLS-pair close deferral into named NT helpers
cirospaciari Jul 23, 2026
6e1d618
test: pin the rejected-handshake socket semantics to node v26.3.0
cirospaciari Jul 23, 2026
652900e
Merge branch 'main' into claude/tls-delayed-attach-error
robobun Jul 23, 2026
61c0c4b
Address review: scope abandoned-socket teardown to server sockets; gu…
robobun Jul 23, 2026
9f069ae
tls: fail closed on inline-rejected handshakes
cirospaciari Jul 23, 2026
7404446
test: accumulate chunks before asserting in the late-reader client test
robobun Jul 23, 2026
7b7f602
Merge main into claude/tls-delayed-attach-error
cirospaciari Jul 23, 2026
ff85f01
ci: keep the binary size allowance on the stack tip [allow size]
cirospaciari Jul 23, 2026
445f997
net: emit kUpgradeAttached on the deferred-adoption duplex fallback
robobun Jul 23, 2026
1ee64e0
net: use reportError for a throwing secureConnection listener
robobun Jul 23, 2026
c99b5e7
tls: route handshake-callback throws to uncaughtException, drop the J…
robobun Jul 23, 2026
0c8282e
net: re-run the kReaderInterest check after secureConnection for TLS …
robobun Jul 23, 2026
f87c692
tls: keep call_error_handler for Bun-native; scope the uncaughtExcept…
robobun Jul 23, 2026
464d953
test: revert expectations.txt additions
robobun Jul 23, 2026
3c1508e
tls: report throwing 'secure'/'secureConnect' listeners on the client…
cirospaciari Jul 23, 2026
b69b20b
node:tls: wire ecdhCurve through to SSL_CTX_set1_groups_list
robobun Jul 23, 2026
0ab9c3c
http: make create_bun_socket_error_t match exhaustive in HTTPContext
robobun Jul 23, 2026
c49a526
uws: use BUFFER_SIZE for the close_notify drain; trim comments to <=3…
robobun Jul 23, 2026
a040f5b
ci: retrigger
robobun Jul 23, 2026
5287b6c
test: use module-scope harness imports in the new handshake-throw tests
robobun Jul 23, 2026
c2c02b4
test: also handshake P-384 against an ecdhCurve:'auto' server
robobun Jul 23, 2026
1e87c93
openssl: leave BoringSSL error on queue when ecdh_curve rejects
robobun Jul 23, 2026
29701d3
test: move ecdhCurve coverage to its own file
robobun Jul 23, 2026
55b277b
node:tls: read tls.DEFAULT_ECDH_CURVE as the fallback for omitted ecd…
robobun Jul 23, 2026
d15621a
Merge remote-tracking branch 'origin/farm/782bad99/tls-ecdh-curve' in…
robobun Jul 23, 2026
7b0fcbc
test: createServer rejects an unknown ecdhCurve synchronously, like Node
robobun Jul 23, 2026
adc5aae
tls: match node's user-visible secure/secureConnect contract and _tls…
cirospaciari Jul 23, 2026
8bcd86e
tls: fail closed on every failed handshake flavor, not just policy re…
cirospaciari Jul 23, 2026
859335b
Merge branch 'main' into claude/tls-delayed-attach-error
cirospaciari Jul 23, 2026
b9ca36f
Merge branch 'main' into claude/tls-delayed-attach-error
cirospaciari Jul 23, 2026
a808a55
net: extract onClientHandshakeComplete; note why the ecdhCurve error …
robobun Jul 23, 2026
99609ea
Merge branch 'main' into claude/tls-delayed-attach-error
cirospaciari Jul 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/commands/upgrade-boringssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ In the bun repo:

- `scripts/build/deps/boringssl.ts` — set `BORINGSSL_COMMIT` to `$NEW_SHA`.
- `test/js/node/process/process.test.js` — update the `boringssl:` entry in `expectedVersions` to `$NEW_SHA`.
- `src/js/node/tls.ts` — two hand-maintained mirrors of BoringSSL tables must be re-derived from the new pin (a test pins the current set, but cannot see upstream additions on its own): `_VALID_CIPHERS_SET` ← `ssl/ssl_cipher.cc` `kCiphers`, `CIPHER_LIST_SELECTORS` ← `ssl/ssl_cipher.cc` `kCipherAliases`.
- `src/js/node/tls.ts` — three hand-maintained mirrors of BoringSSL tables must be re-derived from the new pin (a test pins the current set, but cannot see upstream additions on its own): `SUPPORTED_ECDH_GROUPS` ← `ssl/ssl_key_share.cc` `kNamedGroups` (every `name` and non-empty `alias`), `_VALID_CIPHERS_SET` ← `ssl/ssl_cipher.cc` `kCiphers`, `CIPHER_LIST_SELECTORS` ← `ssl/ssl_cipher.cc` `kCipherAliases`.
- Regenerate the source lists (the file's header comment has the exact one-liner). Only `gen/sources.json` is authoritative — diff old vs new and apply the delta:

```sh
Expand Down
266 changes: 222 additions & 44 deletions packages/bun-usockets/src/crypto/openssl.c

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions packages/bun-usockets/src/libusockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ void us_listen_socket_on_server_name(struct us_listen_socket_t *ls,
* after the socket closed (no-op). */
void us_socket_sni_resolve(us_socket_r s, struct ssl_ctx_st *ctx, int error);
void *us_socket_server_name_userdata(us_socket_r s);
/* Socket-level SNI resolver, for a server-side socket adopted into TLS with no
* listen socket behind it. Same contract as the listener resolver: an owned
* SSL_CTX ref or NULL; *abort_handshake 1 = drop silently, 2 = suspend. */
typedef struct ssl_ctx_st *(*us_socket_server_name_cb)(struct us_socket_t *socket,
const char *hostname, int *abort_handshake);
void us_socket_on_server_name(us_socket_r s, us_socket_server_name_cb cb);

/* ── Connect ──────────────────────────────────────────────────────────────
* Returns either us_socket_t* (fast path, *is_connecting=1) or
Expand Down Expand Up @@ -500,6 +506,8 @@ struct us_bun_socket_context_options_t {
/* Colon-separated signature algorithm list applied via
* SSL_CTX_set1_sigalgs_list. */
const char *sigalgs;
/* Colon-separated named-group list applied via SSL_CTX_set1_groups_list. */
const char *ecdh_curve;
};

enum create_bun_socket_error_t {
Expand All @@ -509,6 +517,7 @@ enum create_bun_socket_error_t {
CREATE_BUN_SOCKET_ERROR_INVALID_CA,
CREATE_BUN_SOCKET_ERROR_INVALID_CIPHERS,
CREATE_BUN_SOCKET_ERROR_INVALID_CRL,
CREATE_BUN_SOCKET_ERROR_INVALID_ECDH_CURVE,
};

/* Build an SSL_CTX from options. Returns the BoringSSL SSL_CTX*; caller owns
Expand Down
1 change: 1 addition & 0 deletions packages/bun-uws/src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ namespace uWS {
unsigned int crl_count = 0;
int allow_partial_trust_chain = 0;
const char *sigalgs = nullptr;
const char *ecdh_curve = nullptr;

/* Conversion operator used internally */
operator struct us_bun_socket_context_options_t() const {
Expand Down
6 changes: 5 additions & 1 deletion src/http/HTTPContext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,11 @@ impl<const SSL: bool> HTTPContext<SSL> {
uws::create_bun_socket_error_t::invalid_ca_file => InitError::InvalidCAFile,
uws::create_bun_socket_error_t::invalid_ca => InitError::InvalidCA,
uws::create_bun_socket_error_t::invalid_crl => InitError::InvalidCRL,
_ => InitError::FailedToOpenSocket,
uws::create_bun_socket_error_t::none
| uws::create_bun_socket_error_t::invalid_ciphers
| uws::create_bun_socket_error_t::invalid_ecdh_curve => {
InitError::FailedToOpenSocket
}
});
}
};
Expand Down
9 changes: 9 additions & 0 deletions src/http/ssl_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct SSLConfig {
pub session_timeout: i32,
pub allow_partial_trust_chain: bool,
pub sigalgs: CStrPtr,
pub ecdh_curve: CStrPtr,
/// Minimum/maximum TLS protocol version (TLS1_VERSION..TLS1_3_VERSION); 0 = unset/default.
pub ssl_min_version: i32,
pub ssl_max_version: i32,
Expand Down Expand Up @@ -114,6 +115,7 @@ impl SSLConfig {
session_timeout: 0,
allow_partial_trust_chain: false,
sigalgs: core::ptr::null(),
ecdh_curve: core::ptr::null(),
ssl_min_version: 0,
ssl_max_version: 0,
request_cert: 0,
Expand Down Expand Up @@ -223,6 +225,9 @@ impl SSLConfig {
if !self.sigalgs.is_null() {
ctx_opts.sigalgs = self.sigalgs;
}
if !self.ecdh_curve.is_null() {
ctx_opts.ecdh_curve = self.ecdh_curve;
}
if let Some(crl) = &self.crl {
ctx_opts.crl = crl.as_ptr();
ctx_opts.crl_count = crl.len() as u32;
Expand Down Expand Up @@ -299,6 +304,7 @@ impl SSLConfig {
return false;
}
eq_cstr!(sigalgs);
eq_cstr!(ecdh_curve);
if self.ssl_min_version != other.ssl_min_version {
return false;
}
Expand Down Expand Up @@ -373,6 +379,7 @@ impl SSLConfig {
hasher.update(&self.session_timeout.to_ne_bytes());
hasher.update(&[self.allow_partial_trust_chain as u8]);
hash_cstr!(sigalgs);
hash_cstr!(ecdh_curve);
hasher.update(&self.ssl_min_version.to_ne_bytes());
hasher.update(&self.ssl_max_version.to_ne_bytes());
hasher.update(&self.request_cert.to_ne_bytes());
Expand Down Expand Up @@ -413,6 +420,7 @@ impl SSLConfig {
free_strings(&mut self.ca);
free_strings(&mut self.crl);
free_string(&mut self.sigalgs);
free_string(&mut self.ecdh_curve);
free_string(&mut self.ssl_ciphers);
free_string(&mut self.protos);
}
Expand Down Expand Up @@ -470,6 +478,7 @@ impl Clone for SSLConfig {
session_timeout: self.session_timeout,
allow_partial_trust_chain: self.allow_partial_trust_chain,
sigalgs: clone_string(self.sigalgs),
ecdh_curve: clone_string(self.ecdh_curve),
ssl_min_version: self.ssl_min_version,
ssl_max_version: self.ssl_max_version,
request_cert: self.request_cert,
Expand Down
3 changes: 3 additions & 0 deletions src/js/internal/net/symbols.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default {
kArmHandshakeTimeout: Symbol("kArmHandshakeTimeout"),
// Internal handshake-settled signal: server-side sockets emit no user
// 'secureConnect' (node parity), so internal deferrals park on this instead.
kSecureConnectDone: Symbol("kSecureConnectDone"),
kVerifyError: Symbol("kVerifyError"),
};
4 changes: 4 additions & 0 deletions src/js/internal/test/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ function internalBinding(name: string) {
return { UDP: require("internal/dgram").UDP };
case "tcp_wrap":
return { TCP: TestTCPWrap, constants: { SOCKET: 0, SERVER: 1 } };
case "cares_wrap":
// Only the pure IP-normalizer the vendored tls/dns tests reach for; the
// resolver surface lives in node:dns.
return { canonicalizeIP: require("bun:internal-for-testing").canonicalizeIP };
default:
throw new Error(`internalBinding("${name}") is not implemented in Bun`);
}
Expand Down
8 changes: 8 additions & 0 deletions src/js/node/_tls_common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// Hardcoded module "node:_tls_common"
// Deprecated shim mirroring node's lib/_tls_common.js: re-exports the real
// implementations and warns on load.
// https://github.com/nodejs/node/blob/v26.3.0/lib/_tls_common.js
const { SecureContext, createSecureContext } = require("node:tls");

process.emitWarning("The _tls_common module is deprecated. Use `node:tls` instead.", "DeprecationWarning", "DEP0192");

// Translate some fields from the handle's C-friendly format into more idiomatic
// javascript object representations before passing them back to the user. Can
Expand Down Expand Up @@ -31,5 +37,7 @@ function translatePeerCertificate(c) {
}

export default {
SecureContext,
createSecureContext,
translatePeerCertificate,
};
Loading
Loading