fix(ssh): pin tunnel listener to loopback

This commit is contained in:
Peter Steinberger
2026-06-19 17:56:25 +01:00
parent 2d899689a5
commit 6798b718de
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -70,7 +70,7 @@ describe("startSshPortForward", () => {
function spawnFakeSshListening() {
mocks.spawn.mockImplementation((_cmd: string, args: string[]) => {
const forwardSpec = args[args.indexOf("-L") + 1] ?? "";
const localPort = Number(forwardSpec.split(":")[0]);
const localPort = Number(forwardSpec.split(":")[1]);
const server = net.createServer();
server.on("error", () => {});
openServers.push(server);
@@ -146,7 +146,7 @@ describe("startSshPortForward", () => {
expect(tunnel.localPort).toBeGreaterThan(0);
expect(mocks.spawn).toHaveBeenCalledWith(
"/usr/bin/ssh",
expect.arrayContaining(["-L", `${tunnel.localPort}:127.0.0.1:18789`]),
expect.arrayContaining(["-L", `127.0.0.1:${tunnel.localPort}:127.0.0.1:18789`]),
expect.anything(),
);
+1 -1
View File
@@ -132,7 +132,7 @@ export async function startSshPortForward(opts: {
const args = [
"-N",
"-L",
`${localPort}:127.0.0.1:${opts.remotePort}`,
`127.0.0.1:${localPort}:127.0.0.1:${opts.remotePort}`,
"-p",
String(parsed.port),
"-o",