Commit 80fc1eff57b for nodejs
commit 80fc1eff57b03d7cb9180aaf7391885df1dcca72
Author: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Date: Sun Nov 15 01:00:50 2026 -0300
test: deflake test-tls-resume-servername
The PSK server's pskCallback answered every identity, but OpenSSL also
asks it about the resumption ticket, cut at its first NUL byte. When
that prefix is valid UTF-8, about 1% of the time, the ticket was taken
for an external PSK and the handshake failed with decrypt_error. Only
answer for the identity the client sends.
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67450
Refs: https://github.com/nodejs/reliability/issues/1722
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
diff --git a/test/parallel/test-tls-resume-servername.js b/test/parallel/test-tls-resume-servername.js
index 927ee597891..0110739450e 100644
--- a/test/parallel/test-tls-resume-servername.js
+++ b/test/parallel/test-tls-resume-servername.js
@@ -82,7 +82,11 @@ server.listen(0, common.mustCall(async () => {
// TLS1.3 PSK works by pretending to be resumption (but it's not).
const secret = Buffer.alloc(32, 1);
const ciphers = 'TLS_AES_128_GCM_SHA256';
- const psk = tls.createServer({ ciphers, pskCallback: () => secret },
+ // OpenSSL offers resumption tickets to pskCallback as identities too (cut
+ // at their first NUL byte). Answering those would turn a ticket into an
+ // external PSK whose binder can't verify, so only answer for 'client'.
+ const pskCallback = (socket, identity) => (identity === 'client' ? secret : undefined);
+ const psk = tls.createServer({ ciphers, pskCallback },
common.mustCall((socket) => {
assert.strictEqual(socket.servername, 'psk.example');
socket.end();