CVE-2020-26301 - Upgrade ssh2 to 1.5.0 #74
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @MCluck90 ,
ssh2
versions below 1.4 have a security vulnerability (CVE-2020-26301) where someone could inject some commands via theAgent
name.As I'm using
simple-ssh
and find it great, I took the liberty to upgrade all its dependencies (including Dev ones) and to adapt the code to work with the latest version ofssh2
.It passes the whole set of tests successfully:
(do not mind the super long times for the test to run, I'm working remotely and my test SSH server was far away and slow)
It looks like a lot of changes have been done to the code, but most of them are just reformatting due to the Lint and VSCode beautifying the code on Saves.
In reality, only a few changes were necessary:
ssh2.Client
as the constructor for the SSH object, as well as in a couple of other places in the code_queueCommand
before thethis._c.exec
command, asssh2
seems to behave slightly differently than its old versions, and would throw a "Not connected" error/exception on the last test of the batch as it tries to execute one command after having killed the sessionDo let me know if you have any questions.
Thanks for your work on this module,
Tony