Skip to content

Commit 39a4f21

Browse files
authored
Merge pull request #89 from hackolade/master
Upgrade ssh2 to v1.4.0 to fix vulnurability warning
2 parents f88fc8e + e3dec10 commit 39a4f21

File tree

3 files changed

+2042
-252
lines changed

3 files changed

+2042
-252
lines changed

index.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var net = require('net');
22
var debug = require('debug')('tunnel-ssh');
3-
var Connection = require('ssh2');
3+
var Connection = require('ssh2').Client;
44
var createConfig = require('./lib/config');
55
var events = require('events');
66
var noop = function () {
@@ -29,6 +29,13 @@ function bindSSHConnection(config, netConnection) {
2929
return sshConnection;
3030
}
3131

32+
function omit(obj, keys) {
33+
return keys.reduce(function (copyObj, key) {
34+
delete copyObj[key];
35+
return copyObj;
36+
}, Object.assign({}, obj));
37+
}
38+
3239
function createServer(config) {
3340
var server;
3441
var connections = [];
@@ -62,11 +69,9 @@ function createServer(config) {
6269
});
6370

6471
connections.push(sshConnection, netConnection);
65-
try
66-
{
67-
sshConnection.connect(config);
68-
}catch(error)
69-
{
72+
try {
73+
sshConnection.connect(omit(config, ['localPort', 'localHost']));
74+
} catch (error) {
7075
server.emit('error', error);
7176
}
7277
});

0 commit comments

Comments
 (0)