Skip to content
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

tls: TLSSocket emits 'error' on handshake failure #9742

Closed

Conversation

bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Nov 22, 2016

Note that 'tlsClientError' does not exist in the v4.x branch so this back-port emits 'clientError' instead. See also pull request #4557.

Original pull request: #8805
CI: https://ci.nodejs.org/job/node-test-pull-request/4942/

Removes branch that would make TLSSocket emit '_tlsError' event if
error occured on handshake and control was not released, as it was
never happening.  Added test for tls.Server to ensure it still emits
'tlsClientError' as expected.

Note that 'tlsClientError' does not exist in the v4.x branch so this
back-port emits 'clientError' instead.  See also pull request nodejs#4557.

Fixes: nodejs#8803
PR-URL: nodejs#8805
Refs: nodejs#4557
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
@nodejs-github-bot nodejs-github-bot added tls Issues and PRs related to the tls subsystem. v4.x labels Nov 22, 2016
@MylesBorins
Copy link
Member

MylesBorins commented Dec 13, 2016

Running CI one more time: https://ci.nodejs.org/job/node-test-pull-request/5387/

@MylesBorins
Copy link
Member

@bnoordhuis
Copy link
Member Author

@MylesBorins MylesBorins force-pushed the v4.x-staging branch 2 times, most recently from 004f6b0 to dcbc1b4 Compare March 22, 2017 15:54
@@ -0,0 +1,36 @@
'use strict';
const common = require('../common');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
const tls = require('tls');
const net = require('net');
const assert = require('assert');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort requires?

const net = require('net');
const assert = require('assert');

const bonkers = Buffer.alloc(1024, 42);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a comment, "Construct a buffer that is not a valid TLS handshake.", or just change var name -
s/bonkers/invalidTlsHandshake/?

setTimeout(function() {
server.close();

assert.ok(clientErrorEmited, 'clientError should be emited');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"emitted"

@@ -0,0 +1,38 @@
'use strict';
const common = require('../common');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description, etc.


const server = net.createServer(function(c) {
setTimeout(function() {
const s = new tls.TLSSocket(c, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this version of the test exists because the error handling code paths under test differ in behaviour depending on how the server is created, or just to be very thorough?

@bnoordhuis
Copy link
Member Author

@sam-github It's a back-port of an already merged pull request, I'm not going to make big changes to it. If you want those changes in, apply them to master first.

@gibfahn
Copy link
Member

gibfahn commented Mar 24, 2017

@bnoordhuis any chance you could prefix a v4.x Backport - in the PR title? I completely missed that this was a backport the first time I looked.

@bnoordhuis
Copy link
Member Author

I can do that but it's right under the PR title:

bnoordhuis wants to merge 1 commit into nodejs:v4.x-staging from bnoordhuis:backport-pr8805-v4.x

@MylesBorins
Copy link
Member

landed in b6941b0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants