fix(gateway): trim ssh command prefixes

This commit is contained in:
Ayaan Zaidi
2026-04-20 11:48:59 +05:30
parent 2c53354901
commit 4800d4e1d7
2 changed files with 9 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import {
resolveAuthForTarget,
resolveProbeBudgetMs,
resolveTargets,
sanitizeSshTarget,
} from "./helpers.js";
import { createSecretRefGatewayConfig } from "./test-support.js";
@@ -369,3 +370,10 @@ describe("resolveProbeBudgetMs", () => {
).toBe(2000);
});
});
describe("sanitizeSshTarget", () => {
it("strips a leading ssh command prefix", () => {
expect(sanitizeSshTarget("ssh me@studio")).toBe("me@studio");
expect(sanitizeSshTarget(" ssh me@studio:2222 ")).toBe("me@studio:2222");
});
});

View File

@@ -156,7 +156,7 @@ export function sanitizeSshTarget(value: unknown): string | null {
if (!trimmed) {
return null;
}
return trimmed.replace(/^ssh\\s+/, "");
return trimmed.replace(/^ssh\s+/, "");
}
export async function resolveAuthForTarget(