Skip to content

fix: reject glob characters in the SSH hostname prefix (#32570) - #32630

Merged
denisra merged 1 commit into
release/2.29from
backport/32570-to-2.29
Nov 24, 2026
Merged

denisra merged 1 commit into
release/2.29from
backport/32570-to-2.29

Conversation

@coder-backporter-app

Copy link
Copy Markdown

Backport of #32570

Original PR: #32570 — fix: reject glob characters in the SSH hostname prefix
Merge commit: f45d527
Requested by: @fioan89

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

(cherry picked from commit f45d527)
@coder-backporter-app coder-backporter-app Bot added the backport/v2.29 Backport PR targeting release/2.29 label Nov 23, 2026
@denisra
denisra merged commit 26d9cae into release/2.29 Nov 24, 2026
73 of 77 checks passed
@denisra
denisra deleted the backport/32570-to-2.29 branch November 24, 2026 17:38

This branch had an error being deployed

1 failed deployment
docs-preview — 8012ef6e Deployed Nov 24, 2026 by denisra via cleanup #435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v2.29 Backport PR targeting release/2.29

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants