Skip to content

feat(services/cloudwalker): add socks5 proxy support - #559

Merged
Daemonceltics merged 3 commits into
chaitin:mainfrom
Daemonceltics:pr/cloudwalker-cnapp
Nov 5, 2026
Merged

Daemonceltics merged 3 commits into
chaitin:mainfrom
Daemonceltics:pr/cloudwalker-cnapp

Conversation

@Daemonceltics

@Daemonceltics Daemonceltics commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Add optional socks5 proxy support to the CloudWalker service.

  • route requests through a socks5h proxy via socks-proxy-agent
  • add skipTlsVerify config for self-signed deployments
  • accept proxy_url / proxyUrl bindings

No directory or service-id rename.

@monkeyscan

monkeyscan Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

PR Title: refactor(services/cloudwalker): rename to cloudwal...

Commit: eb1aaa7

整体评估

本次变更将 CloudWalker 服务重命名为 cloudwalker-cnapp,并同步更新入口、服务描述与注册清单,同时为配置新增代理和跳过 TLS 校验能力。重命名与注册链路整体一致,新增代理请求逻辑存在需要在合入前处理的风险。

总结

重命名部分是自洽的,可以保留;但新增代理能力有三个问题需修复:配置声明的 HTTP 代理实际不可用、skipTlsVerify 在直连场景不生效、代理响应流错误会导致请求挂起或进程异常。建议修复后再合入。

Findings (3)

  • 🟠 [HIGH] services/chaitin__cloudwalker-cnapp/src/cloudwalker.js:395 — HTTP 代理配置无法工作:代理请求只用 SOCKS 代理实现
  • 🟡 [MEDIUM] services/chaitin__cloudwalker-cnapp/src/cloudwalker.js:420 — 代理响应流缺少错误处理,可能导致请求挂起或进程崩溃
  • 🟡 [MEDIUM] services/chaitin__cloudwalker-cnapp/src/cloudwalker.js:468 — skipTlsVerify 在未配置代理时完全不生效
Prompt To Fix All With AI
# Review 1

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker-cnapp/src/cloudwalker.js
Line: 392-395

Comment:
HTTP 代理配置无法工作:代理请求只用 SOCKS 代理实现

config.schema.json 把 proxy_url 描述为可用的 HTTP/SOCKS 代理,但 proxiedFetch 无论代理协议如何都直接 new SocksProxyAgent(proxyUrl);当用户配置 http:// 或 https:// 代理时 socks-proxy-agent 会因未知协议报错。该错误会被映射为 UNAVAILABLE,导致配置 HTTP 代理后所有 CloudWalker 请求全部失败。

# Review 2

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker-cnapp/src/cloudwalker.js
Line: 402-420

Comment:
代理响应流缺少错误处理,可能导致请求挂起或进程崩溃

proxiedFetch 只监听响应流的 data 和 end 事件,没有 res.on('error') 或 aborted 处理;当代理或上游在返回响应头后断开连接时,该错误无人接手,Promise 不会 settle,甚至可能触发未捕获异常。这会使单次上游异常演变为请求挂起或服务进程异常退出。

# Review 3

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker-cnapp/src/cloudwalker.js
Line: 462-468

Comment:
skipTlsVerify 在未配置代理时完全不生效

skipTlsVerify 只在 proxyUrl 存在的分支里传给 proxiedFetch 作为 rejectUnauthorized,未配置 proxyUrl 时请求仍走 this.fetchImpl(全局 fetch),该选项被完全忽略。因此自签名证书的 CloudWalker 部署在直连场景下即使设置 skipTlsVerify=true 仍会 TLS 校验失败,而配置描述并未说明它仅对代理生效。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@monkeyscan

monkeyscan Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

PR Title: refactor(services/cloudwalker): rename to cloudwal...

Commit: 30f88f9

整体评估

本次变更在 chaitin__cloudwalker 服务中引入代理与跳过 TLS 校验的配置项,并新增一条基于 socks-proxy-agent 的请求路径。整体实现方向合理,但新增传输路径在配置语义和异常处理上仍需完善。

总结

当前实现存在必须修复的功能与稳定性问题,最关键是 skipTlsVerify 仅在配置代理时才生效,非代理场景会静默失效;建议修复相关项后再合入。

Findings (3)

  • 🟡 [MEDIUM] services/chaitin__cloudwalker/src/cloudwalker.js:401 — 配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理
  • 🟡 [MEDIUM] services/chaitin__cloudwalker/src/cloudwalker.js:419 — 代理请求缺少响应流错误处理,连接中断时可能挂起或触发未处理异常
  • 🟡 [MEDIUM] services/chaitin__cloudwalker/src/cloudwalker.js:484 — skipTlsVerify 在未配置代理时完全不生效
Prompt To Fix All With AI
# Review 1

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 390-401

Comment:
配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理

config.schema.json 把 proxy_url 描述为支持 HTTP/SOCKS 代理,但 cloudwalker.js 第 395 行对所有 proxyUrl 一律使用 SocksProxyAgent,而 socks-proxy-agent 只接受 socks/socks5/socks5h/socks4 协议。用户按文档填写 http:// 或 https:// 代理时会直接抛错,并被包装成笼统的 upstream unreachable,代理功能实际不可用。

# Review 2

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 402-419

Comment:
代理请求缺少响应流错误处理,连接中断时可能挂起或触发未处理异常

proxiedFetch 只监听 res 的 data 和 end,没有监听 error/aborted;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,还可能在 IncomingMessage 上产生未处理的 error 事件。此时 socket 已断开,req.setTimeout 也不会再触发,调用方可能无限期挂起或导致进程异常。

# Review 3

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 477-484

Comment:
skipTlsVerify 在未配置代理时完全不生效

cloudwalker.js 的 get() 只在 proxyUrl 分支把 skipTlsVerify 传给 proxiedFetch,非代理分支(第 479 行)仍直接调用 this.fetchImpl,没有任何跳过证书校验的参数。用户按 config.schema.json 为自签名部署开启 skipTlsVerify 但没有配置代理时,请求仍会因证书校验失败而报错,该配置被静默忽略。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@Daemonceltics Daemonceltics changed the title refactor(services/cloudwalker): rename to cloudwalker-cnapp and add socks5 proxy support feat(services/cloudwalker): add socks5 proxy support Nov 5, 2026
text: async () => bodyText,
});
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 代理请求缺少响应流错误处理,连接中断时可能挂起或触发未处理异常

Category: 稳定性与可用性

proxiedFetch 只监听 res 的 data 和 end,没有监听 error/aborted;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,还可能在 IncomingMessage 上产生未处理的 error 事件。此时 socket 已断开,req.setTimeout 也不会再触发,调用方可能无限期挂起或导致进程异常。

Problem code:

}, (res) => {
const chunks = [];
res.on('data', (chunk) => chunks.push(chunk));
res.on('end', () => {
const bodyText = Buffer.concat(chunks).toString('utf8');
const headerMap = {};
for (const [name, value] of Object.entries(res.headers)) {
const key = name.toLowerCase();
if (!(key in headerMap)) headerMap[key] = Array.isArray(value) ? value.join(', ') : value;
}
resolve({
ok: res.statusCode >= 200 && res.statusCode < 300,
status: res.statusCode,
headers: { get: (name) => headerMap[String(name).toLowerCase()] ?? null },
text: async () => bodyText,
});
});
});

Recommendation:
为 res 增加 error/aborted 处理并 reject 该 Promise,同时在异常路径清理请求,并考虑用整体超时(如 AbortSignal)替代仅基于 socket 空闲的 setTimeout。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 402-419

Comment:
代理请求缺少响应流错误处理,连接中断时可能挂起或触发未处理异常

proxiedFetch 只监听 res 的 data 和 end,没有监听 error/aborted;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,还可能在 IncomingMessage 上产生未处理的 error 事件。此时 socket 已断开,req.setTimeout 也不会再触发,调用方可能无限期挂起或导致进程异常。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

headers,
redirect: 'manual',
signal: AbortSignal.timeout(30000),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 skipTlsVerify 在未配置代理时完全不生效

Category: 功能正确性

cloudwalker.js 的 get() 只在 proxyUrl 分支把 skipTlsVerify 传给 proxiedFetch,非代理分支(第 479 行)仍直接调用 this.fetchImpl,没有任何跳过证书校验的参数。用户按 config.schema.json 为自签名部署开启 skipTlsVerify 但没有配置代理时,请求仍会因证书校验失败而报错,该配置被静默忽略。

Problem code:

} else {
try {
response = await this.fetchImpl(url, {
method: 'GET',
headers,
redirect: 'manual',
signal: AbortSignal.timeout(30000),
});

Recommendation:
让 skipTlsVerify 对代理和非代理两条路径都生效(例如非代理路径改用可自定义 TLS Agent 的 undici/native 请求),或在 schema 与启动校验中明确要求必须同时配置代理。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 477-484

Comment:
skipTlsVerify 在未配置代理时完全不生效

cloudwalker.js 的 get() 只在 proxyUrl 分支把 skipTlsVerify 传给 proxiedFetch,非代理分支(第 479 行)仍直接调用 this.fetchImpl,没有任何跳过证书校验的参数。用户按 config.schema.json 为自签名部署开启 skipTlsVerify 但没有配置代理时,请求仍会因证书校验失败而报错,该配置被静默忽略。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

@monkeyscan

monkeyscan Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

PR Title: feat(services/cloudwalker): add socks5 proxy suppo...

Commit: 4eb8db4

整体评估

本轮延续上一轮的 socks5 代理支持,主要为代理传输与内部 helper 补充单元测试,并新增 _test 导出。整体方向合理,但新增测试对关键失败路径的覆盖仍不完整。

总结

本轮测试可以验证正常代理请求和错误码映射,但未覆盖真实超时回调与响应流中断,稳定性保障有限。上一轮指出的三个问题仍需在合入前处理:skipTlsVerify 在未配置代理时不生效、proxiedFetch 缺少响应流错误处理可能导致请求挂起、配置声明支持 HTTP 代理但实现仅支持 SOCKS。

Findings (2)

  • 🟡 [MEDIUM] services/chaitin__cloudwalker/test/cloudwalker.test.js:351 — 代理传输用例没有模拟响应流中断,proxiedFetch 的挂起缺陷无法被测试发现
  • 🟢 [LOW] services/chaitin__cloudwalker/test/cloudwalker.test.js:396 — 超时用例没有触发 setTimeout 回调,代理请求的真实超时路径未被覆盖
Prompt To Fix All With AI
# Review 1

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/test/cloudwalker.test.js
Line: 333-351

Comment:
代理传输用例没有模拟响应流中断,proxiedFetch 的挂起缺陷无法被测试发现

fakeHttpResponse 只实现 data 和 end 事件,新增的代理传输用例无法模拟响应体传输中连接被重置的情况。当 proxiedFetch 缺少 res 的 error/aborted 处理时请求会一直挂起,但现有用例仍会全部通过,测试给出了代理路径已被充分覆盖的错误信号。

# Review 2

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/test/cloudwalker.test.js
Line: 389-396

Comment:
超时用例没有触发 setTimeout 回调,代理请求的真实超时路径未被覆盖

fakeHttpRequest 的 setTimeout 直接返回 req、从不调用回调,而“timeouts”用例只是让请求触发一个 ETIMEDOUT 的 error 事件。proxiedFetch 中由 req.setTimeout 调用 req.destroy 的真实超时分支因此完全没有被执行,该分支出现回归时用例仍会通过。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

- route requests through an optional socks5h proxy via socks-proxy-agent
- add skipTlsVerify config for self-signed deployments
- accept proxy_url / proxyUrl bindings
- exercise proxiedFetch via mocked http request (success, network error, timeout)
- unit-test toBoolean/normalize*/isJsonContentType/binding resolvers through _test
@monkeyscan

monkeyscan Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

PR Title: feat(services/cloudwalker): add socks5 proxy suppo...

Commit: 22be7a0

整体评估

本次变更给 CloudWalker 客户端新增 SOCKS 代理传输、skipTlsVerify 开关以及对应的配置 schema 和测试,整体方向合理,但代理实现的功能边界与异常处理仍不完整,尚不具备安全合入的条件。

总结

代理与自签名部署相关的配置存在多处会导致功能失效或请求挂起的问题:skipTlsVerify 在未配置代理时完全不生效,配置声明的 HTTP 代理实际不受支持,代理路径的超时与响应流异常也可能使调用无限挂起。建议合入前修复这些关键项。

Findings (4)

  • 🟠 [HIGH] services/chaitin__cloudwalker/src/cloudwalker.js:395 — 配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理
  • 🟠 [HIGH] services/chaitin__cloudwalker/src/cloudwalker.js:419 — 代理响应流缺少错误/中断处理,连接中断时请求会挂起或抛出未处理异常
  • 🟠 [HIGH] services/chaitin__cloudwalker/src/cloudwalker.js:484 — 未配置代理时 skipTlsVerify 完全不生效
  • 🟡 [MEDIUM] services/chaitin__cloudwalker/src/cloudwalker.js:421 — 代理请求的 30 秒超时只覆盖已连接 socket 的空闲时间,无法限制整次请求
Prompt To Fix All With AI
# Review 1

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 392-395

Comment:
配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理

config.schema.json 将 proxy_url 描述为支持 HTTP/SOCKS 代理,但 proxiedFetch 对所有 proxyUrl 一律构造 SocksProxyAgent,而 socks-proxy-agent 只接受 socks、socks4、socks5、socks5h 协议。用户按文档填写 http:// 或 https:// 代理时会在构造阶段抛错,并被包装成笼统的 upstream unreachable,代理功能实际不可用。

# Review 2

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 402-419

Comment:
代理响应流缺少错误/中断处理,连接中断时请求会挂起或抛出未处理异常

proxiedFetch 只为响应流注册了 data 和 end 处理器,没有监听 error/aborted/close;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,IncomingMessage 上的 error 事件还可能因无监听而抛出未处理异常。调用方会无限挂起或导致进程异常。

# Review 3

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 421

Comment:
代理请求的 30 秒超时只覆盖已连接 socket 的空闲时间,无法限制整次请求

proxiedFetch 使用 req.setTimeout(30000, ...) 实现超时,但 Node 的 request.setTimeout 只有在 socket 已分配并连接后才设置空闲超时,既不覆盖 SocksProxyAgent 的 SOCKS 建连阶段,也会被持续到达的数据不断重置。代理不可达或响应缓慢时请求可能远超 30 秒甚至无限挂起,而非代理路径的 AbortSignal.timeout(30000) 是整次请求的硬性截止时间。

# Review 4

This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 477-484

Comment:
未配置代理时 skipTlsVerify 完全不生效

新增的 skipTlsVerify 配置只在 proxyUrl 分支传给 proxiedFetch,非代理分支仍然原样调用 this.fetchImpl,没有把该选项传给 fetch 的 TLS 层。用户在自签名部署中按 config.schema.json 开启 skipTlsVerify 但未配置代理时,请求仍会因证书校验失败而报错,该选项被静默忽略。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

const proxiedFetch = (url, { headers = {} } = {}, { proxyUrl, skipTlsVerify, timeoutMs = 30000 } = {}) => new Promise((resolve, reject) => {
const target = new URL(url);
const mod = target.protocol === 'https:' ? https : http;
const agent = new SocksProxyAgent(proxyUrl);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理

Category: 功能正确性

config.schema.json 将 proxy_url 描述为支持 HTTP/SOCKS 代理,但 proxiedFetch 对所有 proxyUrl 一律构造 SocksProxyAgent,而 socks-proxy-agent 只接受 socks、socks4、socks5、socks5h 协议。用户按文档填写 http:// 或 https:// 代理时会在构造阶段抛错,并被包装成笼统的 upstream unreachable,代理功能实际不可用。

Problem code:

const proxiedFetch = (url, { headers = {} } = {}, { proxyUrl, skipTlsVerify, timeoutMs = 30000 } = {}) => new Promise((resolve, reject) => {
const target = new URL(url);
const mod = target.protocol === 'https:' ? https : http;
const agent = new SocksProxyAgent(proxyUrl);

Recommendation:
根据代理 URL 的协议选择传输:socks 协议用 SocksProxyAgent,http/https 代理用 HttpProxyAgent/HttpsProxyAgent;或者修正 schema 描述只声明支持 SOCKS。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 392-395

Comment:
配置声明支持 HTTP 代理,但实现只支持 SOCKS 代理

config.schema.json 将 proxy_url 描述为支持 HTTP/SOCKS 代理,但 proxiedFetch 对所有 proxyUrl 一律构造 SocksProxyAgent,而 socks-proxy-agent 只接受 socks、socks4、socks5、socks5h 协议。用户按文档填写 http:// 或 https:// 代理时会在构造阶段抛错,并被包装成笼统的 upstream unreachable,代理功能实际不可用。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

text: async () => bodyText,
});
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 代理响应流缺少错误/中断处理,连接中断时请求会挂起或抛出未处理异常

Category: 稳定性与可用性

proxiedFetch 只为响应流注册了 data 和 end 处理器,没有监听 error/aborted/close;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,IncomingMessage 上的 error 事件还可能因无监听而抛出未处理异常。调用方会无限挂起或导致进程异常。

Problem code:

}, (res) => {
const chunks = [];
res.on('data', (chunk) => chunks.push(chunk));
res.on('end', () => {
const bodyText = Buffer.concat(chunks).toString('utf8');
const headerMap = {};
for (const [name, value] of Object.entries(res.headers)) {
const key = name.toLowerCase();
if (!(key in headerMap)) headerMap[key] = Array.isArray(value) ? value.join(', ') : value;
}
resolve({
ok: res.statusCode >= 200 && res.statusCode < 300,
status: res.statusCode,
headers: { get: (name) => headerMap[String(name).toLowerCase()] ?? null },
text: async () => bodyText,
});
});
});

Recommendation:
同时监听 res 的 error、aborted 和 close 事件,在未正常结束时 reject,并在 settle 后清理请求/定时器。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 402-419

Comment:
代理响应流缺少错误/中断处理,连接中断时请求会挂起或抛出未处理异常

proxiedFetch 只为响应流注册了 data 和 end 处理器,没有监听 error/aborted/close;当响应体传输过程中连接被重置时 end 不会触发,Promise 既不 resolve 也不 reject,IncomingMessage 上的 error 事件还可能因无监听而抛出未处理异常。调用方会无限挂起或导致进程异常。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

});
});

req.setTimeout(timeoutMs, () => req.destroy(Object.assign(new Error('timeout'), { name: 'TimeoutError', code: 'ETIMEDOUT' })));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 代理请求的 30 秒超时只覆盖已连接 socket 的空闲时间,无法限制整次请求

Category: 稳定性与可用性

proxiedFetch 使用 req.setTimeout(30000, ...) 实现超时,但 Node 的 request.setTimeout 只有在 socket 已分配并连接后才设置空闲超时,既不覆盖 SocksProxyAgent 的 SOCKS 建连阶段,也会被持续到达的数据不断重置。代理不可达或响应缓慢时请求可能远超 30 秒甚至无限挂起,而非代理路径的 AbortSignal.timeout(30000) 是整次请求的硬性截止时间。

Problem code:

req.setTimeout(timeoutMs, () => req.destroy(Object.assign(new Error('timeout'), { name: 'TimeoutError', code: 'ETIMEDOUT' })));

Recommendation:
在 Promise 创建时启动一个独立的整体截止定时器(超时后调用 req.destroy() 并清理),并确保建连阶段也受该定时器约束;请求结束或失败时 clearTimeout。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 421

Comment:
代理请求的 30 秒超时只覆盖已连接 socket 的空闲时间,无法限制整次请求

proxiedFetch 使用 req.setTimeout(30000, ...) 实现超时,但 Node 的 request.setTimeout 只有在 socket 已分配并连接后才设置空闲超时,既不覆盖 SocksProxyAgent 的 SOCKS 建连阶段,也会被持续到达的数据不断重置。代理不可达或响应缓慢时请求可能远超 30 秒甚至无限挂起,而非代理路径的 AbortSignal.timeout(30000) 是整次请求的硬性截止时间。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

headers,
redirect: 'manual',
signal: AbortSignal.timeout(30000),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 未配置代理时 skipTlsVerify 完全不生效

Category: 功能正确性

新增的 skipTlsVerify 配置只在 proxyUrl 分支传给 proxiedFetch,非代理分支仍然原样调用 this.fetchImpl,没有把该选项传给 fetch 的 TLS 层。用户在自签名部署中按 config.schema.json 开启 skipTlsVerify 但未配置代理时,请求仍会因证书校验失败而报错,该选项被静默忽略。

Problem code:

} else {
try {
response = await this.fetchImpl(url, {
method: 'GET',
headers,
redirect: 'manual',
signal: AbortSignal.timeout(30000),
});

Recommendation:
非代理路径使用带 connect: { rejectUnauthorized: false } 的 undici Agent 作为 dispatcher,或在统一的自定义传输层中同时应用该选项。

Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 477-484

Comment:
未配置代理时 skipTlsVerify 完全不生效

新增的 skipTlsVerify 配置只在 proxyUrl 分支传给 proxiedFetch,非代理分支仍然原样调用 this.fetchImpl,没有把该选项传给 fetch 的 TLS 层。用户在自签名部署中按 config.schema.json 开启 skipTlsVerify 但未配置代理时,请求仍会因证书校验失败而报错,该选项被静默忽略。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

…ksProxyAgent

resolveProxyUrl returned any proxy_url value verbatim, so the smoke harness
synthesizing the mock upstream as an http base URL fed SocksProxyAgent a
non-socks URL and every Connect call failed with "A socks protocol must be
specified! Got: http:". Fall back to a direct connection for non-socks URLs.
@monkeyscan

monkeyscan Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

PR Title: feat(services/cloudwalker): add socks5 proxy suppo...

Commit: 9daed46

整体评估

本次变更继续完善 CloudWalker 客户端的 SOCKS 代理支持,修复了非 SOCKS 代理地址导致的调用失败,并顺带补充了代理路径的测试覆盖。整体方向与上轮一致,但代理与 TLS 相关配置的处理仍不完整,尚不具备安全合入的条件。

总结

上轮指出的代理请求超时、响应流中断处理、skipTlsVerify 在未配置代理时不生效等问题本轮未涉及,仍然存在;本轮新增的核心风险是不受支持的代理地址被静默丢弃并退化为直连。合入前应让不支持的代理协议显式报错(或真正支持 HTTP 代理),而不是静默绕过代理。

Findings (1)

  • 🟠 [HIGH] services/chaitin__cloudwalker/src/cloudwalker.js:809 — 非 SOCKS 代理地址被静默丢弃,请求会绕过代理直连
Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 805-809

Comment:
非 SOCKS 代理地址被静默丢弃,请求会绕过代理直连

resolveProxyUrl 现在把任何非 socks 协议的 proxy_url(包括 config.schema.json 仍声明支持的 http/https 代理)直接返回空字符串,调用方据此走直连分支且不会收到任何错误。用户按文档配置 HTTP 代理时流量会绕过代理直接发出,既可能违反网络出口策略,也让代理配置错误完全无法被发现。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

const raw = String(bindings.proxyUrl ?? bindings.proxy_url ?? '').trim();
// Only socks:// schemes are routable through SocksProxyAgent; a plain http(s)
// URL (e.g. the smoke harness synthesizing the mock upstream) is not a proxy.
return /^socks(4a?|5h?)?:\/\//i.test(raw) ? raw : '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 非 SOCKS 代理地址被静默丢弃,请求会绕过代理直连

Category: 安全与隐私

resolveProxyUrl 现在把任何非 socks 协议的 proxy_url(包括 config.schema.json 仍声明支持的 http/https 代理)直接返回空字符串,调用方据此走直连分支且不会收到任何错误。用户按文档配置 HTTP 代理时流量会绕过代理直接发出,既可能违反网络出口策略,也让代理配置错误完全无法被发现。

Problem code:

const resolveProxyUrl = (bindings = {}) => {
const raw = String(bindings.proxyUrl ?? bindings.proxy_url ?? '').trim();
// Only socks:// schemes are routable through SocksProxyAgent; a plain http(s)
// URL (e.g. the smoke harness synthesizing the mock upstream) is not a proxy.
return /^socks(4a?|5h?)?:\/\//i.test(raw) ? raw : '';

Recommendation:
对不支持的代理协议抛出明确的配置错误(或实现 HTTP 代理支持),并同步修正 config.schema.json 中 HTTP/SOCKS 的描述,避免静默降级为直连。

Suggested change
return /^socks(4a?|5h?)?:\/\//i.test(raw) ? raw : '';
const resolveProxyUrl = (bindings = {}) => {
const raw = String(bindings.proxyUrl ?? bindings.proxy_url ?? '').trim();
if (!raw) return '';
if (!/^socks(4a?|5h?)?:\/\//i.test(raw)) {
throw new Error(`Unsupported proxy URL scheme: ${raw}; only socks:// proxies are supported`);
}
return raw;
};
Prompt To Fix All With AI
This is a comment left during a code review.
Repository: https://github.com/chaitin/OctoBus
Path: services/chaitin__cloudwalker/src/cloudwalker.js
Line: 805-809

Comment:
非 SOCKS 代理地址被静默丢弃,请求会绕过代理直连

resolveProxyUrl 现在把任何非 socks 协议的 proxy_url(包括 config.schema.json 仍声明支持的 http/https 代理)直接返回空字符串,调用方据此走直连分支且不会收到任何错误。用户按文档配置 HTTP 代理时流量会绕过代理直接发出,既可能违反网络出口策略,也让代理配置错误完全无法被发现。
---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix with MonkeyCode
Fix with Claude
Fix with Codex

@Daemonceltics
Daemonceltics merged commit d6fcd04 into chaitin:main Nov 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant