From 6f912dc12b0f8b13007c63acbe7be139eee0349d Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 10 Jul 2021 17:51:37 +0200 Subject: [PATCH] make sure ssh ident goes out in a single packet - #4167 --- package.json | 1 + patches/ssh2+1.1.0.patch | 15 +++++++++++++++ scripts/install-deps.js | 25 ++++++++++++++----------- tabby-ssh/package.json | 3 +-- tabby-ssh/yarn.lock | 27 ++------------------------- yarn.lock | 24 +++++++++++++++++++++--- 6 files changed, 54 insertions(+), 41 deletions(-) create mode 100644 patches/ssh2+1.1.0.patch diff --git a/package.json b/package.json index 76907d02..82afdaa5 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "source-code-pro": "^2.38.0", "source-map-loader": "^3.0.0", "source-sans-pro": "3.6.0", + "ssh2": "^1.1.0", "style-loader": "^3.0.0", "svg-inline-loader": "^0.8.2", "ts-loader": "^9.2.3", diff --git a/patches/ssh2+1.1.0.patch b/patches/ssh2+1.1.0.patch new file mode 100644 index 00000000..ecfe3fb3 --- /dev/null +++ b/patches/ssh2+1.1.0.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/ssh2/lib/protocol/Protocol.js b/node_modules/ssh2/lib/protocol/Protocol.js +index b4d1ee0..1e3ac66 100644 +--- a/node_modules/ssh2/lib/protocol/Protocol.js ++++ b/node_modules/ssh2/lib/protocol/Protocol.js +@@ -254,8 +254,8 @@ class Protocol { + ); + if (greeting) + this._onWrite(greeting); +- this._onWrite(this._identRaw); +- this._onWrite(CRLF); ++ this._onWrite(Buffer.concat([this._identRaw, CRLF])); ++ // this._onWrite(CRLF); + }); + } + _destruct(reason) { diff --git a/scripts/install-deps.js b/scripts/install-deps.js index 9074d57c..6547bcf9 100755 --- a/scripts/install-deps.js +++ b/scripts/install-deps.js @@ -4,8 +4,11 @@ const path = require('path') const vars = require('./vars') const log = require('npmlog') -const localBinPath = path.resolve(__dirname, '../node_modules/.bin'); -const npx = `${localBinPath}/npx`; +const localBinPath = path.resolve(__dirname, '../node_modules/.bin') +const npx = `${localBinPath}/npx` + +log.info('patch') +sh.exec(`${npx} patch-package`) log.info('deps', 'app') @@ -18,16 +21,16 @@ sh.exec(`${npx} yarn install --force`) sh.cd('..') vars.builtinPlugins.forEach(plugin => { - log.info('deps', plugin) - sh.cd(plugin) - sh.exec(`${npx} yarn install --force`) - sh.cd('..') + log.info('deps', plugin) + sh.cd(plugin) + sh.exec(`${npx} yarn install --force`) + sh.cd('..') }) if (['darwin', 'linux'].includes(process.platform)) { - sh.cd('node_modules') - for (let x of vars.builtinPlugins) { - sh.ln('-fs', '../' + x, x) - } - sh.cd('..') + sh.cd('node_modules') + for (let x of vars.builtinPlugins) { + sh.ln('-fs', '../' + x, x) + } + sh.cd('..') } diff --git a/tabby-ssh/package.json b/tabby-ssh/package.json index 4a74ca9b..ae59172d 100644 --- a/tabby-ssh/package.json +++ b/tabby-ssh/package.json @@ -12,7 +12,7 @@ "watch": "webpack --progress --color --watch", "postinstall": "run-script-os", "postinstall:darwin:linux": "exit", - "postinstall:win32": "xcopy /i /y node_modules\\ssh2\\util\\pagent.exe util\\" + "postinstall:win32": "xcopy /i /y ..\\node_modules\\ssh2\\util\\pagent.exe util\\" }, "files": [ "dist", @@ -24,7 +24,6 @@ "@types/node": "16.0.1", "@types/ssh2": "^0.5.46", "ansi-colors": "^4.1.1", - "ssh2": "^1.1.0", "sshpk": "Eugeny/node-sshpk#89ed17dfae425a8b629873c8337e77d26838c04f", "strip-ansi": "^7.0.0" }, diff --git a/tabby-ssh/yarn.lock b/tabby-ssh/yarn.lock index 4a211be9..323ffada 100644 --- a/tabby-ssh/yarn.lock +++ b/tabby-ssh/yarn.lock @@ -32,7 +32,7 @@ ansi-regex@^6.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.0.tgz#ecc7f5933cbe5ac7b33e209a5ff409ab1669c6b2" integrity sha512-tAaOSrWCHF+1Ear1Z4wnJCXA9GGox4K6Ic85a5qalES2aeEwQGr7UC93mwef49536PkCYjzkp0zIxfFvexJ6zQ== -asn1@^0.2.4, asn1@~0.2.3: +asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== @@ -54,7 +54,7 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -bcrypt-pbkdf@^1.0.0, bcrypt-pbkdf@^1.0.2: +bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= @@ -100,13 +100,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -cpu-features@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.2.tgz#9f636156f1155fd04bdbaa028bb3c2fbef3cea7a" - integrity sha512-/2yieBqvMcRj8McNzkycjW2v3OIUOibBfd2dLEJ0nWts8NobAxwiyw9phVNS6oDL8x8tz9F7uNVFEVpJncQpeA== - dependencies: - nan "^2.14.1" - cycle@1.0.x: version "1.0.3" resolved "https://registry.yarnpkg.com/cycle/-/cycle-1.0.3.tgz#21e80b2be8580f98b468f379430662b046c34ad2" @@ -195,11 +188,6 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -nan@^2.14.1, nan@^2.14.2: - version "2.14.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" - integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== - once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -239,17 +227,6 @@ sprintf@0.1.x: resolved "https://registry.yarnpkg.com/sprintf/-/sprintf-0.1.5.tgz#8f83e39a9317c1a502cb7db8050e51c679f6edcf" integrity sha1-j4PjmpMXwaUCy324BQ5Rxnn27c8= -ssh2@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.1.0.tgz#43dd24930e15e317687f519d6b40270d9cd00d00" - integrity sha512-CidQLG2ZacoT0Z7O6dOyisj4JdrOrLVJ4KbHjVNz9yI1vO08FAYQPcnkXY9BP8zeYo+J/nBgY6Gg4R7w4WFWtg== - dependencies: - asn1 "^0.2.4" - bcrypt-pbkdf "^1.0.2" - optionalDependencies: - cpu-features "0.0.2" - nan "^2.14.2" - sshpk@Eugeny/node-sshpk#89ed17dfae425a8b629873c8337e77d26838c04f: version "1.16.1" resolved "https://codeload.github.com/Eugeny/node-sshpk/tar.gz/89ed17dfae425a8b629873c8337e77d26838c04f" diff --git a/yarn.lock b/yarn.lock index 1d4f79a4..7d11a285 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1082,7 +1082,7 @@ asar@^3.0.0, asar@^3.0.3: optionalDependencies: "@types/glob" "^7.1.1" -asn1@~0.2.3: +asn1@^0.2.4, asn1@~0.2.3: version "0.2.4" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== @@ -1194,7 +1194,7 @@ base64-js@^1.2.3, base64-js@^1.3.1: resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -bcrypt-pbkdf@^1.0.0: +bcrypt-pbkdf@^1.0.0, bcrypt-pbkdf@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= @@ -1973,6 +1973,13 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= +cpu-features@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.2.tgz#9f636156f1155fd04bdbaa028bb3c2fbef3cea7a" + integrity sha512-/2yieBqvMcRj8McNzkycjW2v3OIUOibBfd2dLEJ0nWts8NobAxwiyw9phVNS6oDL8x8tz9F7uNVFEVpJncQpeA== + dependencies: + nan "^2.14.1" + crc@^3.8.0: version "3.8.0" resolved "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz" @@ -5009,7 +5016,7 @@ mute-stream@~0.0.4: resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -nan@^2.13.2: +nan@^2.13.2, nan@^2.14.1, nan@^2.14.2: version "2.14.2" resolved "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz" integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== @@ -7248,6 +7255,17 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= +ssh2@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.1.0.tgz#43dd24930e15e317687f519d6b40270d9cd00d00" + integrity sha512-CidQLG2ZacoT0Z7O6dOyisj4JdrOrLVJ4KbHjVNz9yI1vO08FAYQPcnkXY9BP8zeYo+J/nBgY6Gg4R7w4WFWtg== + dependencies: + asn1 "^0.2.4" + bcrypt-pbkdf "^1.0.2" + optionalDependencies: + cpu-features "0.0.2" + nan "^2.14.2" + sshpk@^1.7.0: version "1.16.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" -- GitLab