@devries-cameron20 / t3code-1 / commits / d26375ed8a
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(ssh): include hosts from wildcard filenames with line separators (#35479)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Simone committed Nov 14, 2026 at 18:33 UTC d26375ed8a90a11b9d13b4285246e6771086695b
2 files changed +16 -2
packages/ssh/src/config.test.ts
+15 -1
@@ -81,9 +81,21 @@ describe("ssh config", () => {
81 const sshDir = path.join(homeDir, ".ssh");
82 yield* fs.makeDirectory(path.join(sshDir, "config.d", "ignored"), { recursive: true });
83 yield* fs.makeDirectory(path.join(sshDir, "explicit-directory"));
84 + yield* fs.makeDirectory(path.join(sshDir, "single.d"));
85 yield* fs.writeFileString(
86 path.join(sshDir, "config"),
86 - "Include config.d/*\nInclude config.d/.literal.conf\nInclude config.d/.enabled-*.conf\nInclude explicit-directory\nHost real\n HostName real.example.com\n",
87 + "Include config.d/*\nInclude config.d/.literal.conf\nInclude config.d/.enabled-*.conf\nInclude explicit-directory\nInclude single.d/team?one.conf\nHost real\n HostName real.example.com\n",
88 + );
89 + for (const [index, separator] of ["\u2028", "\u2029"].entries()) {
90 + yield* fs.writeFileString(
91 + path.join(sshDir, "config.d", `team${separator}one.conf`),
92 + `Host unicode-${index}\n HostName unicode-${index}.example.com\n`,
93 + );
94 + }
95 + // OpenSSH's `?` matches one byte, so it never matches a multi-byte line separator.
96 + yield* fs.writeFileString(
97 + path.join(sshDir, "single.d", "team\u2028one.conf"),
98 + "Host single-byte\n HostName single-byte.example.com\n",
99 );
100 yield* fs.writeFileString(
101 path.join(sshDir, "config.d", "team.conf"),
@@ -115,6 +127,8 @@ describe("ssh config", () => {
127 ["literal", "literal.example.com", "ssh-config"],
128 ["real", "real.example.com", "ssh-config"],
129 ["team", "team.example.com", "ssh-config"],
130 + ["unicode-0", "unicode-0.example.com", "ssh-config"],
131 + ["unicode-1", "unicode-1.example.com", "ssh-config"],
132 ],
133 );
134 }).pipe(Effect.provide(NodeServices.layer)),
packages/ssh/src/config.ts
+1 -1
@@ -92,7 +92,7 @@ function escapeRegex(value: string): string {
92
93 function globToRegExp(pattern: string): RegExp {
94 return new RegExp(
95 - `^${escapeRegex(pattern).replace(/\\\*/gu, ".*").replace(/\\\?/gu, ".")}$`,
95 + `^${escapeRegex(pattern).replace(/\\\*/gu, "[^]*").replace(/\\\?/gu, ".")}$`,
96 "u",
97 );
98 }