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

@@ -1,3 +1,4 @@
import { ACT_MAX_VIEWPORT_DIMENSION } from "../browser/act-policy.js";
import { callBrowserResize, type BrowserParentOpts } from "./browser-cli-shared.js";
import { danger, defaultRuntime } from "./core-api.js";
@@ -16,6 +17,13 @@ export async function runBrowserResizeWithOutput(params: {
defaultRuntime.exit(1);
return;
}
if (width > ACT_MAX_VIEWPORT_DIMENSION || height > ACT_MAX_VIEWPORT_DIMENSION) {
defaultRuntime.error(
danger(`width and height must not exceed ${ACT_MAX_VIEWPORT_DIMENSION}`),
);
defaultRuntime.exit(1);
return;
}
const result = await callBrowserResize(
params.parent,