惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
S
SegmentFault 最新的问题
T
Tailwind CSS Blog
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI
量子位
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
The Cloudflare Blog
小众软件
小众软件
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ssh): bound config probe output · openclaw/openclaw@3...
vincentkoc · 2026-05-28 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -56,10 +56,12 @@ function requireSpawnArgs(index: number): string[] {

5656
5757

let parseSshConfigOutput: typeof import("./ssh-config.js").parseSshConfigOutput;

5858

let resolveSshConfig: typeof import("./ssh-config.js").resolveSshConfig;

59+

let appendSshConfigOutput: typeof import("./ssh-config.js").appendSshConfigOutput;

5960
6061

describe("ssh-config", () => {

6162

beforeAll(async () => {

62-

({ parseSshConfigOutput, resolveSshConfig } = await import("./ssh-config.js"));

63+

({ appendSshConfigOutput, parseSshConfigOutput, resolveSshConfig } =

64+

await import("./ssh-config.js"));

6365

});

6466
6567

it("parses ssh -G output", () => {

@@ -130,4 +132,15 @@ describe("ssh-config", () => {

130132
131133

await expect(resolveSshConfig({ user: "me", host: "bad-host", port: 22 })).resolves.toBeNull();

132134

});

135+
136+

it("rejects oversized ssh -G output while preserving the parser contract", () => {

137+

expect(appendSshConfigOutput("user bob", "\nhostname example.com", 128)).toEqual({

138+

ok: true,

139+

value: "user bob\nhostname example.com",

140+

});

141+

expect(appendSshConfigOutput("x".repeat(8), "y".repeat(8), 12)).toEqual({

142+

ok: false,

143+

reason: "too-large",

144+

});

145+

});

133146

});

Original file line numberDiff line numberDiff line change

@@ -1,13 +1,17 @@

11

import { spawn } from "node:child_process";

22

import type { SshParsedTarget } from "./ssh-tunnel.js";

33
4+

export const SSH_CONFIG_OUTPUT_MAX_CHARS = 64 * 1024;

5+
46

export type SshResolvedConfig = {

57

user?: string;

68

host?: string;

79

port?: number;

810

identityFiles: string[];

911

};

1012
13+

type AppendSshConfigOutputResult = { ok: true; value: string } | { ok: false; reason: "too-large" };

14+
1115

function parsePort(value: string | undefined): number | undefined {

1216

if (!value) {

1317

return undefined;

@@ -54,6 +58,18 @@ export function parseSshConfigOutput(output: string): SshResolvedConfig {

5458

return result;

5559

}

5660
61+

export function appendSshConfigOutput(

62+

current: string,

63+

chunk: unknown,

64+

maxChars = SSH_CONFIG_OUTPUT_MAX_CHARS,

65+

): AppendSshConfigOutputResult {

66+

const next = current + String(chunk);

67+

if (next.length > maxChars) {

68+

return { ok: false, reason: "too-large" };

69+

}

70+

return { ok: true, value: next };

71+

}

72+
5773

export async function resolveSshConfig(

5874

target: SshParsedTarget,

5975

opts: { identity?: string; timeoutMs?: number } = {},

@@ -75,9 +91,16 @@ export async function resolveSshConfig(

7591

stdio: ["ignore", "pipe", "ignore"],

7692

});

7793

let stdout = "";

94+

let outputTooLarge = false;

7895

child.stdout?.setEncoding("utf8");

7996

child.stdout?.on("data", (chunk) => {

80-

stdout += String(chunk);

97+

const appended = appendSshConfigOutput(stdout, chunk);

98+

if (!appended.ok) {

99+

outputTooLarge = true;

100+

child.kill("SIGKILL");

101+

return;

102+

}

103+

stdout = appended.value;

81104

});

82105
83106

const timeoutMs = Math.max(200, opts.timeoutMs ?? 800);

@@ -95,7 +118,7 @@ export async function resolveSshConfig(

95118

});

96119

child.once("exit", (code) => {

97120

clearTimeout(timer);

98-

if (code !== 0 || !stdout.trim()) {

121+

if (outputTooLarge || code !== 0 || !stdout.trim()) {

99122

resolve(null);

100123

return;

101124

}