Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
tls: do not crash on STARTTLS when OCSP requested#10706
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: nodejs#10704
indutny commented Jan 9, 2017
cc @nodejs/crypto |
indutny commented Jan 9, 2017
cc @nodejs/collaborators |
jasnell commented Jan 9, 2017
this looks like semver-patch but just to be safe, is there any possibility that this could break anything? (I highly doubt it but given the removal of the requirement there's always a slight possibility) |
| }), | ||
| SNICallback: common.mustCall((hostname,callback)=>{ | ||
| assert.equal(hostname,'test.test'); |
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.
Can you change this to assert.strictEqual().
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.
Fixed, and removed that console.log() below.
indutny commented Jan 9, 2017
@jasnell no possibility, everything that hit that code path was broken until this patch |
| }; | ||
| constclient=tls.connect(opts,function(){ | ||
| client.end(); |
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.
can just use this, and delete the const client =
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.
Ack.
| return; | ||
| } | ||
| constassert=require('assert'); |
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.
sort requires
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.
Ack
| SNICallback: common.mustCall((hostname,callback)=>{ | ||
| assert.deepEqual(hostname,'test.test'); | ||
| callback(null,null); |
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.
SNICallback should invoke cb(null, ctx), where ctx is a SecureContext instance.
Is (null, null) valid? Should it be valid?
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.
Yes, it is valid and it should be valid.
| @@ -0,0 +1,49 @@ | |||
| 'use strict'; | |||
| constcommon=require('../common'); | |||
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.
https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure
A test should start with a comment containing a brief description of what it is designed to test.
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.
Ack
sam-github left a comment
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.
One suggested tweek to in-source comment, otherwise LGTM
lib/_tls_wrap.js Outdated
| if(!ctx) | ||
| ctx=self.server._sharedCreds; | ||
| // Running on non-TLS server |
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.
This comment confused me when I read it, and I only understood when reading the unit test and PR history. Can I suggest:
TLS socket is using a net.Server, instead of a tls.TLSServer, so some TLS properties will not be present.
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.
ping
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.
Agreed this comment is rather cryptic.
webertrlz commented Feb 1, 2017
Do you have any information on when this will be merged and released? |
sam-github commented Feb 1, 2017
@nodejs/crypto a review from one of you is required, I believe. |
bnoordhuis left a comment
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.
LGTM if you clarify the comment.
lib/_tls_wrap.js Outdated
| if(!ctx) | ||
| ctx=self.server._sharedCreds; | ||
| // Running on non-TLS server |
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.
Agreed this comment is rather cryptic.
webertrlz commented Feb 3, 2017
Is it possible to catch this crash as an exception? I didn't succeed so far. This would be a good workaround until this is packaged. |
indutny commented Feb 3, 2017
Pushed the fix to the comment, PTAL. Landing if the wording is fine. |
bnoordhuis left a comment
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.
LGTM with a suggestion.
lib/_tls_wrap.js Outdated
| // Running on non-TLS server | ||
| // TLS socket is using a `net.Server` instead of a tls.TLSServer. | ||
| // Some TLS properties will not be present. |
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.
Consider giving one or two examples of properties that won't be there.
indutny commented Feb 3, 2017
@bnoordhuis ACK |
addaleax commented Feb 22, 2017
webertrlz commented Feb 22, 2017
hello, sorry for asking this but I'd like to know if there is any planning on merging+packaging this PR. Thanks. |
jasnell commented Feb 22, 2017
@webertrlz Yes, this should land assuming that CI comes back good. |
sam-github commented Feb 22, 2017
Landed in a1802e6 |
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
sam-github commented Feb 22, 2017
Won't show up packaged until the next 7.x release, which will be a couple weeks at least. |
webertrlz commented Feb 22, 2017
The post above means that it won't go packaged for 6.XX LTS? |
addaleax commented Feb 22, 2017
@webertrlz The rules are that changes first have to live an a Current release for two weeks before they are applied to the LTS branches. This change will almost certainly be available in the next one or two v6.x releases, and probably v4.x as well. |
webertrlz commented Feb 22, 2017
@addaleax understood! Thanks! |
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
`TLSSocket` should not have a hard dependency on `tls.Server`, since it may be running without it in cases like `STARTTLS`. Fix: #10704 PR-URL: #10706 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
tls
TLSSocketshould not have a hard dependency ontls.Server, since itmay be running without it in cases like
STARTTLS.Fix: #10704