fix: reject unsafe bash env integers · openclaw/openclaw@a2595f1
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -35,6 +35,12 @@ describe("resolveSandboxWorkdir", () => {
|
35 | 35 | expect(readEnvInt("OPENCLAW_BASH_YIELD_MS", "PI_BASH_YIELD_MS")).toBeUndefined(); |
36 | 36 | }); |
37 | 37 | |
| 38 | +it("ignores unsafe environment integers", () => { |
| 39 | +vi.stubEnv("OPENCLAW_BASH_YIELD_MS", "9007199254740993"); |
| 40 | + |
| 41 | +expect(readEnvInt("OPENCLAW_BASH_YIELD_MS", "PI_BASH_YIELD_MS")).toBeUndefined(); |
| 42 | +}); |
| 43 | + |
38 | 44 | it("maps container root workdir to host workspace", async () => { |
39 | 45 | await withTempDir(async (workspaceDir) => { |
40 | 46 | const warnings: string[] = []; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -214,7 +214,7 @@ export function readEnvInt(key: string, legacyKey?: string) {
|
214 | 214 | return undefined; |
215 | 215 | } |
216 | 216 | const parsed = Number(trimmed); |
217 | | -return Number.isFinite(parsed) ? parsed : undefined; |
| 217 | +return Number.isSafeInteger(parsed) ? parsed : undefined; |
218 | 218 | } |
219 | 219 | |
220 | 220 | export function chunkString(input: string, limit = CHUNK_LIMIT) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。