Repository navigation
fix: reject glob characters in the SSH hostname prefix (#32570) - #32631
Merged
Merged
Conversation
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)
fioan89
approved these changes
Nov 23, 2026
fioan89
had a problem deploying
to
docs-preview
November 23, 2026 21:32 — with
GitHub Actions
Failure
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #32570
Original PR: #32570 — fix: reject glob characters in the SSH hostname prefix
Merge commit: f45d527
Requested by: @fioan89