Repository navigation
feat: add --no-wildcard flag to coder config-ssh - #26753
Merged
Merged
Conversation
Add --no-wildcard (CODER_CONFIGSSH_NO_WILDCARD) to coder config-ssh that generates an individual Host entry per workspace instead of a single wildcard block (Host *.coder). The wildcard approach cannot be enumerated by third-party SSH clients, the VS Code Remote-SSH sidebar, or scripts that parse ~/.ssh/config to discover hosts. With --no-wildcard, each workspace gets its own entry so those tools work without Coder-specific extensions. The flag is persisted in the config section header so re-running without it prompts the user about the option change. Workspaces are fetched with pagination before writing so the diff shows actual hostnames.
BobbyHo
marked this pull request as ready for review
June 26, 2026 20:43
Contributor
Documentation CheckUpdates Needed
Automated review via Coder Agents |
Contributor
Docs preview📖 View docs preview for |
johnstcn
approved these changes
Jun 30, 2026
johnstcn
left a comment
Member
There was a problem hiding this comment.
Tried it out, and it works a treat. Some non-blocking comments below.
Pre-seed workspace and agent names in reverse lexical order so the test proves entries are sorted by name rather than by creation order. Also run the command a second time and verify the host-entry order is stable across runs.
Replace scattered require.Contains and index comparisons with a single cmp.Diff assertion against the complete, ordered list of expected Host entries. With stable workspace names the full list is predictable, so this gives a clearer failure diff when something changes. Apply the same cmp.Diff style to the stability (second-run) check.
…uffer The function has grown complex enough with manual buf.WriteString and fmt.Fprintf calls that a text/template rewrite would improve readability.
Collaborator
Author
|
Thank you @johnstcn for reviewing this PR. I’ve updated configssh_test.go based on your suggestions. Would you mind taking another quick look when you have a moment? Thanks! |
Move go-cmp into the same import group as testify and align inline comments in the wantHosts slice to satisfy goimports formatting.
johnstcn
approved these changes
Jun 30, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Add
--no-wildcard(CODER_CONFIGSSH_NO_WILDCARD) tocoder config-sshthat generates an individualHostentry per workspace instead of a single wildcard block (Host *.coder).The wildcard approach cannot be enumerated by third-party SSH clients, the VS Code Remote-SSH sidebar, or scripts that parse
~/.ssh/configto discover hosts. With--no-wildcard, each workspace gets its own entry so those tools work without Coder-specific extensions.The flag is persisted in the config section header so re-running without it prompts the user about the option change. Workspaces are fetched with pagination before writing so the diff shows actual hostnames.
Manual testing
Unit tests (no server needed):
End-to-end with a dev server:
go build -o ./coder ../scripts/develop.sh./coder login http://localhost:3000Output:
--no-wildcardOutput: wildcard (default)
diff wildcard → --no-wildcard
Closes #17153 (Phase 1: CLI flag)