SH Command: add support for local port forwarding #37
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.
This PR introduces support for port forwarding to our SSH command. Yargs does not expose an "example" parameter that can be used to show the optimal format for the -L argument, so instead I added a small example in the description portion of the option.
Example usage:
p0 ssh <instance> -L <local_socket>:<remote_socket>
An empty -L argument such as
p0 ssh <instance> -L
is treated as an error. An incorrectly formatted argument returns an error:A separate ticket was created to support using an interactive command and port forwarding at the same time:
Currently an error message is displayed: https://linear.app/p0-security/issue/ENG-1653/p0-cli-ssh-support-executing-commands-with-port-forwarding
A separate ticket was created to display an error if the user attempts to open a port that is not allowed locally: https://linear.app/p0-security/issue/ENG-1654/show-an-error-if-invalid-local-port-is-selected-when-port-forwarding