fix(ssh): make POSIX relay wrapper survive csh/tcsh login shells (#8709)
Reconstruct remote POSIX commands with bounded printf arguments so non-POSIX SSH login shells can forward them without requiring remote base64. Preserve relay and system-SSH stdin, and centralize login-shell flag selection for csh/tcsh compatibility.\n\nValidated against real csh and tcsh OpenSSH targets with built-in and system SSH, including cold relay deployment, stdin upload, PTY I/O, file mutation, and reconnect.
This commit is contained in:
@@ -441,9 +441,18 @@ describe('spawnSystemSsh', () => {
|
||||
it('spawns a remote command through the system ssh target', () => {
|
||||
spawnSystemSshCommand(createTarget({ configHost: 'fdpass-host' }), 'echo hello')
|
||||
|
||||
// Why: the remote command stays on one line so csh/tcsh login shells cannot
|
||||
// split it before /bin/sh receives it.
|
||||
const args = spawnMock.mock.calls[0][1] as string[]
|
||||
expect(args).toContain('--')
|
||||
expect(args).toContain('deploy@fdpass-host')
|
||||
const wrapped = args.at(-1)!
|
||||
expect(wrapped).not.toContain('\n')
|
||||
expect(wrapped).toContain('printf %b "$@"')
|
||||
expect(wrapped).not.toContain('base64')
|
||||
expect(spawnMock).toHaveBeenCalledWith(
|
||||
SYSTEM_SSH_PATH,
|
||||
expect.arrayContaining(['--', 'deploy@fdpass-host', "exec /bin/sh -c 'echo hello'"]),
|
||||
expect.any(Array),
|
||||
expect.objectContaining({ stdio: ['pipe', 'pipe', 'pipe'] })
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user