-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.x] tls: fix legacy SecurePair clienthello race window #26452
Conversation
This seems to have been broken ever since its introduction 5 years ago in commit 75ea11f ("tls: introduce asynchronous `newSession`") and no one complained but that's not going to stop me from fixing it anyway because otherwise I can't write a regression test for issue nodejs#26428. Refs: nodejs#26428
There is a time window between the first and the last step of processing the clienthello event and the SecurePair may have been destroyed during that interval. Fixes: nodejs#26428
sessionCb(); | ||
server.close(); | ||
}, 100); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apropos the somewhat uncommon style in this file, it's a mashup of two (fairly old and crufty) tests: test-tls-async-cb-after-socket-end.js and test-tls-securepair-server.js. I didn't want to deviate too much from the style used in those files.
setTimeout(function() { | ||
sessionCb(); | ||
server.close(); | ||
}, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need common.platformTimeout()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not used in test-tls-async-cb-after-socket-end.js either so I'm inclined to say it's not.
CI failures on AIX and Windows appear unrelated. |
This seems to have been broken ever since its introduction 5 years ago in commit 75ea11f ("tls: introduce asynchronous `newSession`") and no one complained but that's not going to stop me from fixing it anyway because otherwise I can't write a regression test for issue #26428. Refs: #26428 PR-URL: #26452 Fixes: #26428 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
There is a time window between the first and the last step of processing the clienthello event and the SecurePair may have been destroyed during that interval. Fixes: #26428 PR-URL: #26452 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Landed on v8.x-staging |
There is a time window between the first and the last step of processing
the clienthello event and the SecurePair may have been destroyed during
that interval.
Fixes: #26428
The first commit fixes a bug that's been around for five years.
CI: https://ci.nodejs.org/job/node-test-pull-request/21215/