fix(browser): reject excessive viewport resizes

This commit is contained in:
Vincent Koc
2026-05-29 07:18:35 +02:00
parent cdeafd1895
commit 2e042fbca8
12 changed files with 104 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import {
normalizeOptionalString,
} from "openclaw/plugin-sdk/string-coerce-runtime";
import { runCommandWithRuntime } from "../core-api.js";
import { ACT_MAX_VIEWPORT_DIMENSION } from "../browser/act-policy.js";
import { runBrowserResizeWithOutput } from "./browser-cli-resize.js";
import { callBrowserRequest, type BrowserParentOpts } from "./browser-cli-shared.js";
import { registerBrowserCookiesAndStorageCommands } from "./browser-cli-state.cookies-storage.js";
@@ -22,6 +23,11 @@ function parsePositiveInteger(value: unknown, label: string): number | undefined
defaultRuntime.exit(1);
return undefined;
}
if (parsed > ACT_MAX_VIEWPORT_DIMENSION) {
defaultRuntime.error(danger(`Invalid ${label}: maximum is ${ACT_MAX_VIEWPORT_DIMENSION}`));
defaultRuntime.exit(1);
return undefined;
}
return parsed;
}