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

Bug: Using public setTimeout creates invalid SSH commands #86

Closed
iPwnPancakes opened this issue Jun 17, 2023 · 1 comment
Closed

Bug: Using public setTimeout creates invalid SSH commands #86

iPwnPancakes opened this issue Jun 17, 2023 · 1 comment

Comments

@iPwnPancakes
Copy link
Contributor

iPwnPancakes commented Jun 17, 2023

Hello!

I noticed when using this package in production that using the setTimeout function actually causes the resulting SSH command to be invalid. If you add this test:

it('setting timeout does not alter ssh command', function () {
    $command = $this->ssh->setTimeout(10)->getExecuteCommand('whoami');

    assertMatchesSnapshot($command);
});

You will see this result:

ssh 10 [email protected] 'bash -se' << \EOF-SPATIE-SSH
whoami
EOF-SPATIE-SSH

When checking the ssh man page, it seems that the correct usage is to pass it in as an option as -o ConnectTimeout=10. But instead it is serialized as an integer due to the way getExecuteCommand turns everything in the $this->extraOptions array to a string.

Though I do see that this option is intended to merely pass the integer to Symfony's Process class.

@freekmurze
Copy link
Member

Thanks for the PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants