Skip to content

Commit ad809ab

Browse files
mcollinaMikeMcC399
authored andcommitted
tls: route callback exceptions through error handlers
Wrap pskCallback and ALPNCallback invocations in try-catch blocks to route exceptions through owner.destroy() instead of letting them become uncaught exceptions. This prevents remote attackers from crashing TLS servers or causing resource exhaustion. Fixes: https://hackerone.com/reports/3473882 PR-URL: https://github.com/nodejs-private/node-private/pull/782 PR-URL: https://github.com/nodejs-private/node-private/pull/790 CVE-ID: CVE-2026-21637
1 parent f98986c commit ad809ab

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

test/parallel/test-tls-psk-alpn-callback-exception-handling.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ describe('TLS callback exception handling', () => {
9090
}
9191
}));
9292

93-
server.on('secureConnection', common.mustNotCall(() => {
94-
reject(new Error('secureConnection should not fire'));
95-
}));
93+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
9694

9795
await new Promise((res) => server.listen(0, res));
9896

@@ -137,9 +135,7 @@ describe('TLS callback exception handling', () => {
137135
}
138136
}));
139137

140-
server.on('secureConnection', common.mustNotCall(() => {
141-
reject(new Error('secureConnection should not fire'));
142-
}));
138+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
143139

144140
await new Promise((res) => server.listen(0, res));
145141

@@ -185,9 +181,7 @@ describe('TLS callback exception handling', () => {
185181
}
186182
}));
187183

188-
server.on('secureConnection', common.mustNotCall(() => {
189-
reject(new Error('secureConnection should not fire'));
190-
}));
184+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
191185

192186
await new Promise((res) => server.listen(0, res));
193187

@@ -228,9 +222,7 @@ describe('TLS callback exception handling', () => {
228222
}
229223
}));
230224

231-
server.on('secureConnection', common.mustNotCall(() => {
232-
reject(new Error('secureConnection should not fire'));
233-
}));
225+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
234226
await new Promise((res) => server.listen(0, res));
235227

236228
const client = tls.connect({
@@ -259,9 +251,7 @@ describe('TLS callback exception handling', () => {
259251

260252
const { promise, resolve, reject } = createTestPromise();
261253

262-
server.on('secureConnection', common.mustNotCall(() => {
263-
reject(new Error('secureConnection should not fire'));
264-
}));
254+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
265255

266256
await new Promise((res) => server.listen(0, res));
267257

@@ -303,9 +293,7 @@ describe('TLS callback exception handling', () => {
303293

304294
const { promise, resolve, reject } = createTestPromise();
305295

306-
server.on('secureConnection', common.mustNotCall(() => {
307-
reject(new Error('secureConnection should not fire'));
308-
}));
296+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
309297

310298
await new Promise((res) => server.listen(0, res));
311299

0 commit comments

Comments
 (0)