@raolin2025/claude-code-node 2.3.5 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/query-engine.js +2 -16
package/package.json
CHANGED
package/src/core/query-engine.js
CHANGED
|
@@ -17,7 +17,6 @@ import { parseStream, parseNonStreamResponse } from './streaming.js'
|
|
|
17
17
|
import { autoCompact } from './compact.js'
|
|
18
18
|
import { CostTracker } from './cost-tracker.js'
|
|
19
19
|
import { EnhancedPermissionChecker } from '../security/enhanced-permission.js'
|
|
20
|
-
import { checkHostSafety } from '../security/ssrf-guard.js'
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* 配置选项
|
|
@@ -312,21 +311,8 @@ export class QueryEngine {
|
|
|
312
311
|
|
|
313
312
|
const url = apiBase.replace(/\/+$/, '') + '/chat/completions'
|
|
314
313
|
|
|
315
|
-
//
|
|
316
|
-
|
|
317
|
-
const parsedUrl = new URL(url)
|
|
318
|
-
const hostResult = await checkHostSafety(parsedUrl.hostname)
|
|
319
|
-
if (!hostResult.allowed) {
|
|
320
|
-
throw new Error(`SSRF blocked: ${hostResult.reason}`)
|
|
321
|
-
}
|
|
322
|
-
} catch (err) {
|
|
323
|
-
if (err.message.startsWith('SSRF blocked:')) {
|
|
324
|
-
throw err
|
|
325
|
-
}
|
|
326
|
-
// URL 解析错误忽略,让 fetch 自己处理
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// 带重试的 fetch
|
|
314
|
+
// apiBase 是用户显式指定的配置(--api-base),不是外部输入,跳过 SSRF 检查
|
|
315
|
+
// SSRF 防护仅适用于 web-fetch/web-search 等工具发起的请求
|
|
330
316
|
const maxRetries = 3
|
|
331
317
|
// Jitter 退避 — 指数退避 + 随机 ±50%,防止惊群效应
|
|
332
318
|
const retryDelay = (baseMs, attempt) => {
|