fix(e2e): reject unsafe bundled runtime limits · openclaw/openclaw@9ab9469
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
File tree
scripts/e2e/lib/bundled-plugin-install-uninstall
| Original file line number | Diff line number | Diff line change |
|---|
@@ -68,7 +68,7 @@ function readPositiveInt(raw, fallback, name) {
|
68 | 68 | throw new Error(`invalid ${name}: ${text}`); |
69 | 69 | } |
70 | 70 | const parsed = Number(text); |
71 | | -if (!Number.isInteger(parsed) || parsed <= 0) { |
| 71 | +if (!Number.isSafeInteger(parsed) || parsed <= 0) { |
72 | 72 | throw new Error(`invalid ${name}: ${text}`); |
73 | 73 | } |
74 | 74 | return parsed; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -266,6 +266,14 @@ describe("bundled plugin install/uninstall probe", () => {
|
266 | 266 | expect(result.stderr).toContain("invalid bundled plugin runtime index: 1e3"); |
267 | 267 | }); |
268 | 268 | |
| 269 | +it("rejects unsafe bundled plugin runtime limit env values", async () => { |
| 270 | +await expect( |
| 271 | +importRuntimeSmokeWithEnv({ |
| 272 | +OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS: String(Number.MAX_SAFE_INTEGER + 1), |
| 273 | +}), |
| 274 | +).rejects.toThrow("invalid OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS: 9007199254740992"); |
| 275 | +}); |
| 276 | + |
269 | 277 | it("rejects bundled plugin runtime ports outside the TCP range", async () => { |
270 | 278 | const runtimeSmoke = await import(pathToFileURL(runtimeSmokePath).href); |
271 | 279 | const env = { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。