fix(e2e): reject unsafe bundled runtime limits

This commit is contained in:
Vincent Koc
2026-06-18 20:51:10 +02:00
parent a2f5ac82d5
commit 9ab9469d04
2 changed files with 9 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ function readPositiveInt(raw, fallback, name) {
throw new Error(`invalid ${name}: ${text}`);
}
const parsed = Number(text);
if (!Number.isInteger(parsed) || parsed <= 0) {
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
throw new Error(`invalid ${name}: ${text}`);
}
return parsed;

View File

@@ -266,6 +266,14 @@ describe("bundled plugin install/uninstall probe", () => {
expect(result.stderr).toContain("invalid bundled plugin runtime index: 1e3");
});
it("rejects unsafe bundled plugin runtime limit env values", async () => {
await expect(
importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS: String(Number.MAX_SAFE_INTEGER + 1),
}),
).rejects.toThrow("invalid OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS: 9007199254740992");
});
it("rejects bundled plugin runtime ports outside the TCP range", async () => {
const runtimeSmoke = await import(pathToFileURL(runtimeSmokePath).href);
const env = {