Files
coder/cli
Faur Ioan-Aurel f45d5275b6 fix: reject glob characters in the SSH hostname prefix (#32570)
Currently, ValidateWorkspaceHostnamePrefix rejects only whitespace and
control characters in the deployment SSH hostname prefix. The coder
config-ssh command writes this prefix as "Host <prefix>*". When an
administrator sets CODER_SSH_HOSTNAME_PREFIX to "*", the user's SSH
config gets a "Host **" block. This block matches every host, so the
Coder SSH options, such as StrictHostKeyChecking=no,
UserKnownHostsFile=/dev/null, and the Coder ProxyCommand, apply to all
SSH connections on the user's machine, not only to Coder workspaces.

ValidateWorkspaceHostnamePrefix now also rejects "*" and "?", the same
as ValidateWorkspaceHostnameSuffix. The glob check runs after the
whitespace and control character check, so an injection payload still
reports the control character error.

Both callers of SSHConfigResponse.Validate apply the new check. The
server now refuses to start when the prefix contains a glob character.
The coder config-ssh command now refuses a server response with such a
prefix and leaves the SSH config file unchanged. New tests cover the
validator, the server startup check, and both client paths.

- resolves
https://linear.app/codercom/issue/CLI-70/security-validate-ssh-hostname-prefix-against-glob-characters
2026-11-23 21:49:44 +02:00
..
…
…
…
…