Skip to content

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

Merged
fioan89 merged 1 commit into
release/2.39from
backport/32570-to-2.39
Nov 23, 2026
Merged

fioan89 merged 1 commit into
release/2.39from
backport/32570-to-2.39

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.39 Backport PR targeting release/2.39 label Nov 23, 2026
@fioan89
fioan89 merged commit 81506a0 into release/2.39 Nov 23, 2026
63 checks passed
@fioan89
fioan89 deleted the backport/32570-to-2.39 branch November 23, 2026 21:22

This branch had an error being deployed

1 failed deployment
docs-preview — 9b856f62 Deployed Nov 23, 2026 by fioan89 via cleanup #366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v2.39 Backport PR targeting release/2.39

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant