fix(browser): reject unknown Electron input fields

This commit is contained in:
morluto
2026-09-29 11:38:09 +08:00
parent bedd55a4b4
commit 1860d4f0e5
2 changed files with 24 additions and 4 deletions
@@ -179,6 +179,26 @@ describe("CdpElectronProvider target access", () => {
});
});
describe("Electron request schemas", () => {
it("rejects unknown fields and misspelled inspection limits", () => {
expect(
listElectronTargetsInputSchema.safeParse({
cdp_endpoint: "http://127.0.0.1:9223",
allowed_file_roots: ["/tmp/app"],
allowed_file_root: "/tmp/app",
}).success,
).toBe(false);
expect(
inspectElectronPageInputSchema.safeParse({
cdp_endpoint: "http://127.0.0.1:9223",
allowed_file_roots: ["/tmp/app"],
target_id: "page-1",
limits: { max_dom_nodes: 20, max_dom_node: 20 },
}).success,
).toBe(false);
});
});
describe("CdpElectronProvider capture", () => {
it("captures Electron script source only after separate approval", async () => {
const root = await electronFixture();