@wenathlan/extension 1.1.45 → 1.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/cdpbus.d.ts +104 -0
- package/dist/cdpbus.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +504 -7
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +37 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +17 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +34 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/runtimeline.d.ts +1 -1
- package/dist/runtimeline.d.ts.map +1 -1
- package/dist/types.d.ts +142 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +771 -9
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +235 -3
- package/extension/dist/pagebridge.js.map +3 -3
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +11 -7
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +130 -3
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/dist/style.css +2 -0
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -196,6 +196,143 @@ function annotationplanof(input) {
|
|
|
196
196
|
return plan;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
// cdpbus.ts
|
|
200
|
+
var cdpkinds = ["attachcdp", "detachcdp", "cdpcmd", "watchcdp", "setbreakpoint", "stepcode", "watchexpr", "overridescript"];
|
|
201
|
+
var cdpdomains = ["Runtime", "Log", "Debugger", "DOM", "Network", "Page"];
|
|
202
|
+
function methoddomain(method) {
|
|
203
|
+
const match = /^([A-Z][A-Za-z]*)\.([a-zA-Z][A-Za-z0-9]*)$/.exec(method.trim());
|
|
204
|
+
return match?.[1];
|
|
205
|
+
}
|
|
206
|
+
function cdpallowlistof(value) {
|
|
207
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
208
|
+
const entry = value;
|
|
209
|
+
const domains = Array.isArray(entry.domains) ? entry.domains.filter((domain) => typeof domain === "string" && cdpdomains.includes(domain)) : [];
|
|
210
|
+
if (domains.length === 0) return void 0;
|
|
211
|
+
if (entry.methods === void 0) return { domains };
|
|
212
|
+
const methods = Array.isArray(entry.methods) ? entry.methods.filter((method) => typeof method === "string" && methoddomain(method) !== void 0 && domains.includes(methoddomain(method))) : [];
|
|
213
|
+
if (methods.length === 0) return void 0;
|
|
214
|
+
return { domains, methods };
|
|
215
|
+
}
|
|
216
|
+
function allowlistcovers(allowlist, method) {
|
|
217
|
+
const domain = methoddomain(method);
|
|
218
|
+
if (domain === void 0) return false;
|
|
219
|
+
if (!allowlist.domains.includes(domain)) return false;
|
|
220
|
+
if (allowlist.methods !== void 0 && !allowlist.methods.includes(method)) return false;
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
function attachcdpsession(input) {
|
|
224
|
+
return { id: input.id, runid: input.runid, stepid: input.stepid, tabid: input.tabid, origin: input.origin, attachedat: input.now, domains: [...new Set(input.domains)], debuggerversion: input.debuggerversion };
|
|
225
|
+
}
|
|
226
|
+
function detachcdpsession(session, at, userdetached = false) {
|
|
227
|
+
return { ...session, detachedat: at, ...userdetached ? { userdetached: true } : {} };
|
|
228
|
+
}
|
|
229
|
+
function sendcdpcommand(input) {
|
|
230
|
+
const domain = methoddomain(input.method);
|
|
231
|
+
if (domain === void 0) return { ...input, method: input.method.trim(), domain: "", duration: input.duration, ...input.errorclass !== void 0 ? { errorclass: input.errorclass } : { errorclass: "malformedmethod" }, at: input.at };
|
|
232
|
+
return { ...input, method: input.method.trim(), domain, duration: input.duration, ...input.errorclass !== void 0 ? { errorclass: input.errorclass } : {}, at: input.at };
|
|
233
|
+
}
|
|
234
|
+
function serializecdpcommand(queue, command) {
|
|
235
|
+
return [...queue, command];
|
|
236
|
+
}
|
|
237
|
+
function cdpeventruleof(value) {
|
|
238
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
239
|
+
const entry = value;
|
|
240
|
+
const domain = typeof entry.domain === "string" && cdpdomains.includes(entry.domain) ? entry.domain : void 0;
|
|
241
|
+
const event = typeof entry.event === "string" && entry.event.trim() ? entry.event.trim() : void 0;
|
|
242
|
+
if (domain === void 0 || event === void 0) return void 0;
|
|
243
|
+
const match = typeof entry.match === "string" && entry.match.trim() ? entry.match.trim() : void 0;
|
|
244
|
+
return { domain, event, ...match !== void 0 ? { match } : {} };
|
|
245
|
+
}
|
|
246
|
+
function watchcdpevents(rules, events) {
|
|
247
|
+
const matched = [];
|
|
248
|
+
const counts = {};
|
|
249
|
+
for (const domain of cdpdomains) counts[domain] = 0;
|
|
250
|
+
for (const event of events) {
|
|
251
|
+
for (const rule of rules) {
|
|
252
|
+
if (rule.domain !== event.domain || rule.event !== event.event) continue;
|
|
253
|
+
if (rule.match !== void 0 && !(event.payload ?? "").includes(rule.match)) continue;
|
|
254
|
+
matched.push({ ruleid: rule.id, domain: event.domain, event: event.event, ...event.payload !== void 0 ? { payload: event.payload } : {} });
|
|
255
|
+
counts[event.domain] = (counts[event.domain] ?? 0) + 1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return { matched, counts };
|
|
259
|
+
}
|
|
260
|
+
function breakpointinputof(value) {
|
|
261
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
262
|
+
const entry = value;
|
|
263
|
+
const url = typeof entry.url === "string" && entry.url.trim() ? entry.url.trim() : void 0;
|
|
264
|
+
const line = typeof entry.line === "number" && Number.isInteger(entry.line) && entry.line >= 0 ? entry.line : void 0;
|
|
265
|
+
if (url === void 0 || line === void 0) return void 0;
|
|
266
|
+
const column = typeof entry.column === "number" && Number.isInteger(entry.column) && entry.column >= 0 ? entry.column : void 0;
|
|
267
|
+
const condition = typeof entry.condition === "string" && entry.condition.trim() ? entry.condition.trim() : void 0;
|
|
268
|
+
return { url, line, ...column !== void 0 ? { column } : {}, ...condition !== void 0 ? { condition } : {} };
|
|
269
|
+
}
|
|
270
|
+
function capturepause(input) {
|
|
271
|
+
return { id: input.id, runid: input.runid, stepid: input.stepid, reason: input.reason, callframes: [...input.callframes], ...input.hitbreakpoint !== void 0 ? { hitbreakpoint: input.hitbreakpoint } : {}, ...input.domsnapshotid !== void 0 ? { domsnapshotid: input.domsnapshotid } : {}, at: input.at };
|
|
272
|
+
}
|
|
273
|
+
function stepmodeof(value) {
|
|
274
|
+
const modes = ["stepover", "stepinto", "stepout", "resume"];
|
|
275
|
+
return typeof value === "string" && modes.includes(value) ? value : void 0;
|
|
276
|
+
}
|
|
277
|
+
function watchexpressionof(value) {
|
|
278
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
279
|
+
const entry = value;
|
|
280
|
+
const expression = typeof entry.expression === "string" && entry.expression.trim() ? entry.expression.trim() : void 0;
|
|
281
|
+
if (expression === void 0) return void 0;
|
|
282
|
+
const scope = typeof entry.scope === "string" && entry.scope.trim() ? entry.scope.trim() : "topframe";
|
|
283
|
+
return { expression, scope };
|
|
284
|
+
}
|
|
285
|
+
function recordwatchvalue(expression, pauseid, value, at) {
|
|
286
|
+
return { ...expression, values: [...expression.values, { pauseid, value, at }] };
|
|
287
|
+
}
|
|
288
|
+
function overrideinputof(value) {
|
|
289
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
290
|
+
const entry = value;
|
|
291
|
+
const urlpattern = typeof entry.urlpattern === "string" && entry.urlpattern.trim() ? entry.urlpattern.trim() : void 0;
|
|
292
|
+
const source = typeof entry.source === "string" ? entry.source : void 0;
|
|
293
|
+
if (urlpattern === void 0 || source === void 0 || source.trim().length === 0) return void 0;
|
|
294
|
+
return { urlpattern, source };
|
|
295
|
+
}
|
|
296
|
+
function overridematches(urlpattern, url) {
|
|
297
|
+
const patternmatch = /^(https:\/\/[^/]+)(\/.*)?$/.exec(urlpattern);
|
|
298
|
+
const urlmatch = /^(https:\/\/[^/]+)(\/.*)?$/.exec(url);
|
|
299
|
+
if (!patternmatch || !urlmatch) return false;
|
|
300
|
+
if (patternmatch[1] !== urlmatch[1]) return false;
|
|
301
|
+
const patternpath = (patternmatch[2] ?? "/").split("/").filter((segment) => segment.length > 0);
|
|
302
|
+
const urlpath = (urlmatch[2] ?? "/").split("/").filter((segment) => segment.length > 0);
|
|
303
|
+
const walk = (patternindex, urlindex) => {
|
|
304
|
+
if (patternindex >= patternpath.length) return urlindex >= urlpath.length;
|
|
305
|
+
const segment = patternpath[patternindex];
|
|
306
|
+
if (segment === "**") return walk(patternindex + 1, urlindex) || urlindex < urlpath.length && walk(patternindex, urlindex + 1);
|
|
307
|
+
if (urlindex >= urlpath.length) return false;
|
|
308
|
+
if (segment !== "*" && segment !== urlpath[urlindex]) return false;
|
|
309
|
+
return walk(patternindex + 1, urlindex + 1);
|
|
310
|
+
};
|
|
311
|
+
return walk(0, 0);
|
|
312
|
+
}
|
|
313
|
+
function teardownplanof(value) {
|
|
314
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
315
|
+
const entry = value;
|
|
316
|
+
const revertsteps = Array.isArray(entry.revertsteps) ? entry.revertsteps.filter((step) => typeof step === "string" && step.trim().length > 0) : [];
|
|
317
|
+
const policy = entry.resumepolicy;
|
|
318
|
+
if (revertsteps.length === 0) return void 0;
|
|
319
|
+
if (policy !== void 0 && policy !== "resume" && policy !== "pause" && policy !== "ask") return void 0;
|
|
320
|
+
return { revertsteps, resumepolicy: policy ?? "ask" };
|
|
321
|
+
}
|
|
322
|
+
function teardowncdpsession(input) {
|
|
323
|
+
const revertedbreakpoints = input.breakpoints.filter((spec) => spec.revertedat === void 0).map((spec) => spec.id);
|
|
324
|
+
const revertedoverrides = input.overrides.filter((spec) => spec.revertedat === void 0).map((spec) => spec.id);
|
|
325
|
+
const resumepolicy = input.userdetached ? "pause" : input.plan?.resumepolicy ?? "ask";
|
|
326
|
+
return {
|
|
327
|
+
session: detachcdpsession(input.session, input.at, input.userdetached),
|
|
328
|
+
revertedbreakpoints,
|
|
329
|
+
revertedoverrides,
|
|
330
|
+
resumepolicy,
|
|
331
|
+
paused: input.userdetached || resumepolicy === "pause",
|
|
332
|
+
keepsalive: input.userdetached
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
199
336
|
// httpclient.ts
|
|
200
337
|
var httpkinds = ["fetchurl", "parsejson", "parsehtml", "callrest", "callgraphql"];
|
|
201
338
|
var redirectstatuses = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
@@ -1912,6 +2049,108 @@ var sessionmemory = class {
|
|
|
1912
2049
|
async getconsoleconsents() {
|
|
1913
2050
|
return await this.adapter.get("consoleconsents") ?? [];
|
|
1914
2051
|
}
|
|
2052
|
+
/** Stores one devtools session record with its enabled domains and detach state, replacing the previous record of its id. */
|
|
2053
|
+
async setcdpsession(session) {
|
|
2054
|
+
const records = (await this.adapter.get("cdpsessions") ?? []).filter((item) => item.id !== session.id);
|
|
2055
|
+
await this.adapter.set("cdpsessions", [session, ...records]);
|
|
2056
|
+
}
|
|
2057
|
+
/** Returns every stored devtools session record, newest first. */
|
|
2058
|
+
async getcdpsessions() {
|
|
2059
|
+
return await this.adapter.get("cdpsessions") ?? [];
|
|
2060
|
+
}
|
|
2061
|
+
/** Stores one raw command outcome with its duration and error class. */
|
|
2062
|
+
async addcdpcommand(command) {
|
|
2063
|
+
const records = await this.adapter.get("cdpcommands") ?? [];
|
|
2064
|
+
await this.adapter.set("cdpcommands", [command, ...records]);
|
|
2065
|
+
}
|
|
2066
|
+
/** Returns every stored raw command outcome, newest first. */
|
|
2067
|
+
async getcdpcommands() {
|
|
2068
|
+
return await this.adapter.get("cdpcommands") ?? [];
|
|
2069
|
+
}
|
|
2070
|
+
/** Stores one domain event rule with its match filter, replacing the previous rule of its id. */
|
|
2071
|
+
async setcdpeventrule(rule) {
|
|
2072
|
+
const records = (await this.adapter.get("cdpeventrules") ?? []).filter((item) => item.id !== rule.id);
|
|
2073
|
+
await this.adapter.set("cdpeventrules", [rule, ...records]);
|
|
2074
|
+
}
|
|
2075
|
+
/** Returns every stored domain event rule, newest first. */
|
|
2076
|
+
async getcdpeventrules() {
|
|
2077
|
+
return await this.adapter.get("cdpeventrules") ?? [];
|
|
2078
|
+
}
|
|
2079
|
+
/** Stores one breakpoint record with its condition and hit counter, replacing the previous record of its id. */
|
|
2080
|
+
async addbreakpoint(spec) {
|
|
2081
|
+
const records = (await this.adapter.get("breakpoints") ?? []).filter((item) => item.id !== spec.id);
|
|
2082
|
+
await this.adapter.set("breakpoints", [spec, ...records]);
|
|
2083
|
+
}
|
|
2084
|
+
/** Returns every stored breakpoint record, newest first. */
|
|
2085
|
+
async getbreakpoints() {
|
|
2086
|
+
return await this.adapter.get("breakpoints") ?? [];
|
|
2087
|
+
}
|
|
2088
|
+
/** Stores one pause state capture; the user configured pause retention window expires the call frames and the dom snapshot reference of the oldest captures while the pause reason and hit breakpoint survive. */
|
|
2089
|
+
async addpause(pause) {
|
|
2090
|
+
const records = await this.getpauses();
|
|
2091
|
+
const combined = [pause, ...records.filter((item) => item.id !== pause.id)];
|
|
2092
|
+
const retention = (await this.getsettings())?.pauseretention;
|
|
2093
|
+
if (retention === void 0) {
|
|
2094
|
+
await this.adapter.set("pauses", combined);
|
|
2095
|
+
return;
|
|
2096
|
+
}
|
|
2097
|
+
const kept = combined.slice(0, retention);
|
|
2098
|
+
const expired = combined.slice(retention).map((item) => {
|
|
2099
|
+
if (item.framesexpired === true) return item;
|
|
2100
|
+
const faded = { ...item, callframes: [], framesexpired: true };
|
|
2101
|
+
delete faded.domsnapshotid;
|
|
2102
|
+
return faded;
|
|
2103
|
+
});
|
|
2104
|
+
await this.adapter.set("pauses", [...kept, ...expired]);
|
|
2105
|
+
}
|
|
2106
|
+
/** Returns every stored pause state capture, newest first. */
|
|
2107
|
+
async getpauses() {
|
|
2108
|
+
return await this.adapter.get("pauses") ?? [];
|
|
2109
|
+
}
|
|
2110
|
+
/** Returns the pause state captures of one run, newest first. */
|
|
2111
|
+
async listpauses(runid) {
|
|
2112
|
+
const records = await this.getpauses();
|
|
2113
|
+
return records.filter((item) => item.runid === runid);
|
|
2114
|
+
}
|
|
2115
|
+
/** Stores one watch expression with its per pause values, replacing the previous expression of its id. */
|
|
2116
|
+
async setwatchexpression(expression) {
|
|
2117
|
+
const records = (await this.adapter.get("watchexpressions") ?? []).filter((item) => item.id !== expression.id);
|
|
2118
|
+
await this.adapter.set("watchexpressions", [expression, ...records]);
|
|
2119
|
+
}
|
|
2120
|
+
/** Returns every stored watch expression, newest first. */
|
|
2121
|
+
async getwatchexpressions() {
|
|
2122
|
+
return await this.adapter.get("watchexpressions") ?? [];
|
|
2123
|
+
}
|
|
2124
|
+
/** Stores one script override with its review provenance, replacing the previous override of its id. */
|
|
2125
|
+
async addscriptoverride(spec) {
|
|
2126
|
+
const records = (await this.adapter.get("scriptoverrides") ?? []).filter((item) => item.id !== spec.id);
|
|
2127
|
+
await this.adapter.set("scriptoverrides", [spec, ...records]);
|
|
2128
|
+
}
|
|
2129
|
+
/** Returns every stored script override, newest first. */
|
|
2130
|
+
async getscriptoverrides() {
|
|
2131
|
+
return await this.adapter.get("scriptoverrides") ?? [];
|
|
2132
|
+
}
|
|
2133
|
+
/** Stores one debugger consent decision per origin with the consented domain list, replacing the previous decision of its id. */
|
|
2134
|
+
async setdebuggergrant(grant) {
|
|
2135
|
+
const records = (await this.adapter.get("debuggergrants") ?? []).filter((item) => item.id !== grant.id);
|
|
2136
|
+
await this.adapter.set("debuggergrants", [grant, ...records]);
|
|
2137
|
+
}
|
|
2138
|
+
/** Returns every debugger consent decision, newest first. */
|
|
2139
|
+
async getdebuggergrants() {
|
|
2140
|
+
return await this.adapter.get("debuggergrants") ?? [];
|
|
2141
|
+
}
|
|
2142
|
+
/** Revokes every approved debugger consent of one origin: the revoke time stamps the records so the next attach needs a new reviewed prompt. */
|
|
2143
|
+
async revokedebuggergrants(origin, at) {
|
|
2144
|
+
const records = await this.getdebuggergrants();
|
|
2145
|
+
let revoked = 0;
|
|
2146
|
+
const updated = records.map((grant) => {
|
|
2147
|
+
if (grant.origin !== origin || grant.revokedat !== void 0) return grant;
|
|
2148
|
+
revoked += 1;
|
|
2149
|
+
return { ...grant, revokedat: at };
|
|
2150
|
+
});
|
|
2151
|
+
await this.adapter.set("debuggergrants", updated);
|
|
2152
|
+
return revoked;
|
|
2153
|
+
}
|
|
1915
2154
|
/** Merges expired entry counts into the per run level count summary that survives the retention window. */
|
|
1916
2155
|
async mergelevelsummary(runid, counts, now) {
|
|
1917
2156
|
const records = await this.getlevelsummaries();
|
|
@@ -2464,7 +2703,7 @@ function extractvalues(body, paths) {
|
|
|
2464
2703
|
// runtimeline.ts
|
|
2465
2704
|
var timelinekinds = ["watchconsole", "watcherrors", "watchtasks"];
|
|
2466
2705
|
var loglevels = ["error", "warn", "info", "log", "debug", "trace"];
|
|
2467
|
-
var timelinesources = ["console", "error", "rejection", "resource", "longtask", "network"];
|
|
2706
|
+
var timelinesources = ["console", "error", "rejection", "resource", "longtask", "network", "cdp"];
|
|
2468
2707
|
function levelrank(level) {
|
|
2469
2708
|
return loglevels.indexOf(level);
|
|
2470
2709
|
}
|
|
@@ -2871,9 +3110,9 @@ function polldecision(input) {
|
|
|
2871
3110
|
}
|
|
2872
3111
|
|
|
2873
3112
|
// policy.ts
|
|
2874
|
-
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles"]);
|
|
2875
|
-
var interactionactions = /* @__PURE__ */ new Set(["focus", "scroll", "hover", "clickdeep", "rightclick", "doubleclick", "scrollpage", "scrollby", "scrollend", "scrolltop", "fullscreen", "zoomset", "movepointer", "clicktext", "clickaria", "clickname", "expanddetails", "pierceshadow", "retryaction", "capturebodies"]);
|
|
2876
|
-
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks"]);
|
|
3113
|
+
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles", "attachcdp", "detachcdp", "cdpcmd", "overridescript"]);
|
|
3114
|
+
var interactionactions = /* @__PURE__ */ new Set(["focus", "scroll", "hover", "clickdeep", "rightclick", "doubleclick", "scrollpage", "scrollby", "scrollend", "scrolltop", "fullscreen", "zoomset", "movepointer", "clicktext", "clickaria", "clickname", "expanddetails", "pierceshadow", "retryaction", "capturebodies", "setbreakpoint", "stepcode", "watchexpr"]);
|
|
3115
|
+
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks", "watchcdp"]);
|
|
2877
3116
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
2878
3117
|
var watchactions = /* @__PURE__ */ new Set(["watchmutate", "watchbanner", "watchfocus", "watchtab"]);
|
|
2879
3118
|
var targetactions = /* @__PURE__ */ new Set(["inspect", "focus", "click", "type", "scroll", "select", "hover", "clickdeep", "rightclick", "doubleclick", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "highlight", "setattribute", "removeattribute", "waitfor", "shiftclick", "typetime", "appendtext", "setvalue", "typeedit", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "expanddetails", "verifyvisible", "verifyenabled", "pierceshadow", "deriveselector", "fingerprintsection", "submitform", "retryform", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcode", "consentpassword", "scrapetable", "paginateextract", "shotelement", "captureframe", "shotcanvas"]);
|
|
@@ -2890,6 +3129,7 @@ var socketactions = /* @__PURE__ */ new Set(["opensocket", "sendmessage", "waitm
|
|
|
2890
3129
|
var netwatchactions = /* @__PURE__ */ new Set(["watchrequests", "readheaders", "capturebodies", "mapapi", "extractapi"]);
|
|
2891
3130
|
var controlactions = /* @__PURE__ */ new Set(["blockrequest", "mockresponse", "rewriteheaders", "setcookies", "readcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles"]);
|
|
2892
3131
|
var debugactions = /* @__PURE__ */ new Set(["watchconsole", "watcherrors", "watchtasks"]);
|
|
3132
|
+
var cdpactions = /* @__PURE__ */ new Set(["attachcdp", "detachcdp", "cdpcmd", "watchcdp", "setbreakpoint", "stepcode", "watchexpr", "overridescript"]);
|
|
2893
3133
|
var credentialheaders = /* @__PURE__ */ new Set(["authorization", "proxy-authorization", "cookie", "cookie2", "set-cookie", "api-key", "x-api-key", "x-auth-token", "x-session-token", "proxy-authorization"]);
|
|
2894
3134
|
var fieldkinds = ["text", "email", "phone", "date", "number", "select", "check", "radio", "file", "password", "card", "code"];
|
|
2895
3135
|
var layoutmutationactions = /* @__PURE__ */ new Set(["grouptabs", "colorgroup", "collapsegroup", "savelayout", "restorelayout"]);
|
|
@@ -2911,8 +3151,11 @@ function iswatchkind(kind) {
|
|
|
2911
3151
|
function isdebugkind(kind) {
|
|
2912
3152
|
return debugactions.has(kind);
|
|
2913
3153
|
}
|
|
3154
|
+
function iscdpkind(kind) {
|
|
3155
|
+
return cdpactions.has(kind);
|
|
3156
|
+
}
|
|
2914
3157
|
function observationmodeof(kind) {
|
|
2915
|
-
if (watchactions.has(kind) || debugactions.has(kind) || kind === "waitquiet") return "watching";
|
|
3158
|
+
if (watchactions.has(kind) || debugactions.has(kind) || cdpactions.has(kind) && kind === "watchcdp" || kind === "waitquiet") return "watching";
|
|
2916
3159
|
if (kind === "diffsnapshots") return "diffing";
|
|
2917
3160
|
return "passive";
|
|
2918
3161
|
}
|
|
@@ -4126,6 +4369,130 @@ function rotationruleof(value) {
|
|
|
4126
4369
|
if (maxentries === void 0 || overflowtarget === void 0) return void 0;
|
|
4127
4370
|
return { maxentries, overflowtarget };
|
|
4128
4371
|
}
|
|
4372
|
+
function debuggate(session, tabid, origin, now) {
|
|
4373
|
+
if (!session || session.stoppedat) return { allowed: false, reason: "No active browser session exists for the devtools protocol step." };
|
|
4374
|
+
if (session.expiresat <= now) return { allowed: false, reason: "The browser session has expired and cannot run a devtools protocol step." };
|
|
4375
|
+
if (session.pausedat) return { allowed: false, reason: "The browser session is paused and cannot run a devtools protocol step." };
|
|
4376
|
+
if (session.tabid !== tabid) return { allowed: false, reason: `The devtools protocol step needs the run tab ${session.tabid} and refuses tab ${tabid}.` };
|
|
4377
|
+
if (!origingranted(session, origin)) return { allowed: false, reason: `The devtools protocol step on ${origin} needs the session origin grants first.` };
|
|
4378
|
+
return { allowed: true };
|
|
4379
|
+
}
|
|
4380
|
+
function debuggerconsentcovers(origin, domains, grants) {
|
|
4381
|
+
const needed = [...new Set(domains)];
|
|
4382
|
+
const covering = grants.find((grant) => grant.origin === origin && grant.approved === true && grant.revokedat === void 0 && needed.every((domain) => grant.domains.includes(domain)));
|
|
4383
|
+
if (covering) return { allowed: true };
|
|
4384
|
+
if (grants.some((grant) => grant.origin === origin && grant.revokedat !== void 0)) return { allowed: false, reason: `The debugger consent on ${origin} was revoked; approve a new prompt before the devtools protocol runs again.` };
|
|
4385
|
+
return { allowed: false, reason: `The devtools protocol on ${origin} needs the reviewed debugger consent for ${needed.join(", ")} first; approve the prompt with the domain allowlist shown in the review panel.` };
|
|
4386
|
+
}
|
|
4387
|
+
function validatebreakpointcondition(condition) {
|
|
4388
|
+
const expression = condition.trim();
|
|
4389
|
+
if (expression.length === 0) return { allowed: false, reason: "The breakpoint condition must not be empty." };
|
|
4390
|
+
if (/(?<![=!<>])=(?!=)/.test(expression)) return { allowed: false, reason: "Breakpoint conditions refuse assignment because the reviewed grammar is comparison only." };
|
|
4391
|
+
if (/[A-Za-z_$][\w$]*\s*\(/.test(expression)) return { allowed: false, reason: "Breakpoint conditions refuse calls because the reviewed grammar is comparison only." };
|
|
4392
|
+
const literal = /^(?:-?\d+(?:\.\d+)?|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|true|false|null)$/;
|
|
4393
|
+
const tokens = expression.match(/(?:[A-Za-z_$][\w$]*|-?\d+(?:\.\d+)?|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|===|!==|==|!=|>=|<=|&&|\|\||[!.<>()+\-*\/%])/g);
|
|
4394
|
+
if (tokens === null || tokens.join("") !== expression.replace(/\s+/g, "")) return { allowed: false, reason: "The breakpoint condition must use the reviewed expression grammar of member chains, literals, comparisons, logic operators, negation and parentheses." };
|
|
4395
|
+
const identifierlike = /^(?:true|false|null)$/;
|
|
4396
|
+
for (const token of tokens) {
|
|
4397
|
+
if (literal.test(token) || identifierlike.test(token)) continue;
|
|
4398
|
+
if (["===", "!==", "==", "!=", ">=", "<=", "&&", "||", "!", ".", "(", ")", "<", ">", "+", "-", "*", "/", "%"].includes(token)) continue;
|
|
4399
|
+
if (/^[A-Za-z_$][\w$]*$/.test(token)) continue;
|
|
4400
|
+
return { allowed: false, reason: `The token ${token} of the breakpoint condition stays outside the reviewed expression grammar.` };
|
|
4401
|
+
}
|
|
4402
|
+
return { allowed: true };
|
|
4403
|
+
}
|
|
4404
|
+
function breakpointbudgetallowed(active, ceiling) {
|
|
4405
|
+
if (ceiling === void 0) return { allowed: true };
|
|
4406
|
+
if (typeof ceiling !== "number" || !Number.isInteger(ceiling) || ceiling < 0) return { allowed: false, reason: "The reviewed breakpoint ceiling must be zero or a positive integer of user configured value with no code ceiling." };
|
|
4407
|
+
if (active >= ceiling) return { allowed: false, reason: `The run already holds ${active} active breakpoint${active === 1 ? "" : "s"} and the reviewed breakpoint ceiling is ${ceiling}; revert one or review a wider ceiling.` };
|
|
4408
|
+
return { allowed: true };
|
|
4409
|
+
}
|
|
4410
|
+
function pauseretentionwindow(settings) {
|
|
4411
|
+
return settings?.pauseretention;
|
|
4412
|
+
}
|
|
4413
|
+
function breakpointceilingof(settings) {
|
|
4414
|
+
return settings?.breakpointceiling;
|
|
4415
|
+
}
|
|
4416
|
+
function validatecdpgrammar(step, options) {
|
|
4417
|
+
const kind = step.kind;
|
|
4418
|
+
if (kind === "attachcdp") {
|
|
4419
|
+
if (!Array.isArray(options.domains) || options.domains.length === 0 || !options.domains.every((domain) => typeof domain === "string" && cdpdomains.includes(domain))) return { allowed: false, reason: `The attach needs a non-empty enabled domain list of the reviewed domain grammar: ${cdpdomains.join(", ")}.` };
|
|
4420
|
+
if (teardownplanof(options.teardown) === void 0) return { allowed: false, reason: "Every attach needs a reviewed teardown plan with its revert steps and resume policy before approval." };
|
|
4421
|
+
if (options.allowlist !== void 0) {
|
|
4422
|
+
const allowlist = cdpallowlistof(options.allowlist);
|
|
4423
|
+
if (!allowlist || !allowlist.domains.every((domain) => options.domains.includes(domain))) return { allowed: false, reason: "The reviewed method allowlist must stay inside the enabled domains of the attach." };
|
|
4424
|
+
}
|
|
4425
|
+
const budgetcheck = debugwaitbudgetallowed(typeof options.wait === "number" ? options.wait : void 0, void 0);
|
|
4426
|
+
if (!budgetcheck.allowed) return budgetcheck;
|
|
4427
|
+
return { allowed: true };
|
|
4428
|
+
}
|
|
4429
|
+
if (kind === "detachcdp") return { allowed: true };
|
|
4430
|
+
if (kind === "cdpcmd") {
|
|
4431
|
+
const command = options.command && typeof options.command === "object" && !Array.isArray(options.command) ? options.command : void 0;
|
|
4432
|
+
if (!command || typeof command.method !== "string" || methoddomain(command.method) === void 0) return { allowed: false, reason: "The raw command needs a reviewed method of the Domain.method form." };
|
|
4433
|
+
if (command.params !== void 0 && (typeof command.params !== "object" || Array.isArray(command.params))) return { allowed: false, reason: "The raw command params must be a JSON object." };
|
|
4434
|
+
if (command.resultpath !== void 0 && typeof command.resultpath !== "string") return { allowed: false, reason: "The reviewed result path must be a dotted path string." };
|
|
4435
|
+
return { allowed: true };
|
|
4436
|
+
}
|
|
4437
|
+
if (kind === "watchcdp") {
|
|
4438
|
+
if (!Array.isArray(options.events) || options.events.length === 0 || !options.events.every((rule) => cdpeventruleof(rule) !== void 0)) return { allowed: false, reason: "The event watch needs a non-empty reviewed list of domain event rules of the reviewed domain grammar." };
|
|
4439
|
+
let watchwindow;
|
|
4440
|
+
if (options.watch !== void 0) {
|
|
4441
|
+
const watch = options.watch;
|
|
4442
|
+
if (!watch || typeof watch !== "object" || Array.isArray(watch)) return { allowed: false, reason: "The reviewed event watch window must be an object." };
|
|
4443
|
+
const reviewed = watch;
|
|
4444
|
+
if (reviewed.window !== void 0) {
|
|
4445
|
+
if (typeof reviewed.window !== "number" || !Number.isFinite(reviewed.window) || reviewed.window < 0) return { allowed: false, reason: "The reviewed event watch window must be zero or a positive number of milliseconds." };
|
|
4446
|
+
watchwindow = reviewed.window;
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
if (watchwindow === void 0) return { allowed: false, reason: "The event watch needs a reviewed lifetime window before any domain event is observed." };
|
|
4450
|
+
const budgetcheck = debugwaitbudgetallowed(watchwindow, typeof options.wait === "number" ? options.wait : void 0);
|
|
4451
|
+
if (!budgetcheck.allowed) return budgetcheck;
|
|
4452
|
+
return { allowed: true };
|
|
4453
|
+
}
|
|
4454
|
+
if (kind === "setbreakpoint") {
|
|
4455
|
+
const breakpoint = breakpointinputof(options.breakpoint);
|
|
4456
|
+
if (!breakpoint) return { allowed: false, reason: "The breakpoint needs a reviewed script url and a zero based line." };
|
|
4457
|
+
if (!ishttpsurl(breakpoint.url)) return { allowed: false, reason: "The breakpoint script url must be a reviewed HTTPS url." };
|
|
4458
|
+
if (breakpoint.condition !== void 0) {
|
|
4459
|
+
const conditioncheck = validatebreakpointcondition(breakpoint.condition);
|
|
4460
|
+
if (!conditioncheck.allowed) return conditioncheck;
|
|
4461
|
+
}
|
|
4462
|
+
return { allowed: true };
|
|
4463
|
+
}
|
|
4464
|
+
if (kind === "stepcode") {
|
|
4465
|
+
if (stepmodeof(options.mode) === void 0) return { allowed: false, reason: "The step code mode must be one of stepover, stepinto, stepout or resume." };
|
|
4466
|
+
return { allowed: true };
|
|
4467
|
+
}
|
|
4468
|
+
if (kind === "watchexpr") {
|
|
4469
|
+
if (watchexpressionof(options.expression) === void 0) return { allowed: false, reason: "The watch expression needs the reviewed expression text." };
|
|
4470
|
+
if (options.reviewed !== true) return { allowed: false, reason: "Watch expressions must be reviewed before evaluation; set the explicit reviewed flag on the step." };
|
|
4471
|
+
return { allowed: true };
|
|
4472
|
+
}
|
|
4473
|
+
if (kind === "overridescript") {
|
|
4474
|
+
const override = overrideinputof(options.override);
|
|
4475
|
+
if (!override) return { allowed: false, reason: "The script override needs a reviewed url pattern and its full fixture source." };
|
|
4476
|
+
if (patternorigin(override.urlpattern) === void 0) return { allowed: false, reason: "Script overrides without a named https origin pattern are refused." };
|
|
4477
|
+
if (options.reviewed !== true) return { allowed: false, reason: "The full fixture source must be reviewed before the script override runs; set the explicit reviewed flag on the step." };
|
|
4478
|
+
return { allowed: true };
|
|
4479
|
+
}
|
|
4480
|
+
return { allowed: true };
|
|
4481
|
+
}
|
|
4482
|
+
function planallowlist(steps) {
|
|
4483
|
+
const attach = steps.find((step) => step.kind === "attachcdp");
|
|
4484
|
+
if (!attach) return void 0;
|
|
4485
|
+
let options = {};
|
|
4486
|
+
try {
|
|
4487
|
+
options = parseoptions(attach);
|
|
4488
|
+
} catch {
|
|
4489
|
+
options = {};
|
|
4490
|
+
}
|
|
4491
|
+
const domains = Array.isArray(options.domains) ? options.domains.filter((domain) => typeof domain === "string" && cdpdomains.includes(domain)) : [];
|
|
4492
|
+
if (domains.length === 0) return void 0;
|
|
4493
|
+
const gated = cdpallowlistof(options.allowlist);
|
|
4494
|
+
return { domains, ...gated?.methods !== void 0 ? { methods: gated.methods } : {} };
|
|
4495
|
+
}
|
|
4129
4496
|
function controltarget(step) {
|
|
4130
4497
|
let options = {};
|
|
4131
4498
|
try {
|
|
@@ -4535,6 +4902,10 @@ function validatestep(step, origin) {
|
|
|
4535
4902
|
const timelinecheck = validatetimelinegrammar(step, options);
|
|
4536
4903
|
if (!timelinecheck.allowed) return timelinecheck;
|
|
4537
4904
|
}
|
|
4905
|
+
if (iscdpkind(step.kind)) {
|
|
4906
|
+
const cdpcheck = validatecdpgrammar(step, options);
|
|
4907
|
+
if (!cdpcheck.allowed) return cdpcheck;
|
|
4908
|
+
}
|
|
4538
4909
|
if (step.kind === "tabcreate") {
|
|
4539
4910
|
if (options.background !== void 0 && typeof options.background !== "boolean") return { allowed: false, reason: "The reviewed background flag must be a boolean." };
|
|
4540
4911
|
if (options.window !== void 0 && (typeof options.window !== "number" || !Number.isInteger(options.window) || options.window < 0)) return { allowed: false, reason: "The reviewed target window id must be a non-negative integer." };
|
|
@@ -4640,6 +5011,46 @@ function canexecute(input) {
|
|
|
4640
5011
|
const timelinegatecheck = timelinegate(input.session, input.tabid, input.origin, now);
|
|
4641
5012
|
if (!timelinegatecheck.allowed) return timelinegatecheck;
|
|
4642
5013
|
}
|
|
5014
|
+
if (iscdpkind(input.step.kind)) {
|
|
5015
|
+
const debuggatecheck = debuggate(input.session, input.tabid, input.origin, now);
|
|
5016
|
+
if (!debuggatecheck.allowed) return debuggatecheck;
|
|
5017
|
+
if (!input.plan) return { allowed: false, reason: "The devtools protocol steps need an approved plan." };
|
|
5018
|
+
const allowlist = planallowlist(input.plan.steps);
|
|
5019
|
+
if (input.step.kind !== "attachcdp") {
|
|
5020
|
+
if (allowlist === void 0) return { allowed: false, reason: "The devtools protocol step needs the attachcdp step of the same plan with its enabled domains first." };
|
|
5021
|
+
if (input.step.kind === "cdpcmd") {
|
|
5022
|
+
let cdpoptions2 = {};
|
|
5023
|
+
try {
|
|
5024
|
+
cdpoptions2 = parseoptions(input.step);
|
|
5025
|
+
} catch {
|
|
5026
|
+
cdpoptions2 = {};
|
|
5027
|
+
}
|
|
5028
|
+
const command = cdpoptions2.command && typeof cdpoptions2.command === "object" && !Array.isArray(cdpoptions2.command) ? cdpoptions2.command : void 0;
|
|
5029
|
+
const method = typeof command?.method === "string" ? command.method : "";
|
|
5030
|
+
if (methoddomain(method) === void 0 || !allowlistcovers(allowlist, method)) return { allowed: false, reason: `The raw command ${method || ""} stays outside the enabled domain allowlist of the plan attach; review the attach domains or the method gates.` };
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
let cdpoptions = {};
|
|
5034
|
+
try {
|
|
5035
|
+
cdpoptions = parseoptions(input.step);
|
|
5036
|
+
} catch {
|
|
5037
|
+
cdpoptions = {};
|
|
5038
|
+
}
|
|
5039
|
+
if (input.step.kind === "setbreakpoint") {
|
|
5040
|
+
const breakpoint = breakpointinputof(cdpoptions.breakpoint);
|
|
5041
|
+
if (breakpoint) {
|
|
5042
|
+
const targetgate = origincheck(input.session, breakpoint.url);
|
|
5043
|
+
if (!targetgate.allowed) return targetgate;
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
if (input.step.kind === "overridescript") {
|
|
5047
|
+
const override = overrideinputof(cdpoptions.override);
|
|
5048
|
+
if (override) {
|
|
5049
|
+
const targetgate = origincheck(input.session, override.urlpattern);
|
|
5050
|
+
if (!targetgate.allowed) return targetgate;
|
|
5051
|
+
}
|
|
5052
|
+
}
|
|
5053
|
+
}
|
|
4643
5054
|
if (iscontrolkind(input.step.kind)) {
|
|
4644
5055
|
const controlgate = sessiongate({ session: input.session, tabid: input.tabid, origin: input.origin, now, action: "control the network" });
|
|
4645
5056
|
if (!controlgate.allowed) return controlgate;
|
|
@@ -4723,7 +5134,7 @@ function canexecute(input) {
|
|
|
4723
5134
|
}
|
|
4724
5135
|
|
|
4725
5136
|
// version.ts
|
|
4726
|
-
var packageversion = "1.1.
|
|
5137
|
+
var packageversion = "1.1.46";
|
|
4727
5138
|
|
|
4728
5139
|
// types.ts
|
|
4729
5140
|
var protocolversion = packageversion;
|
|
@@ -4748,6 +5159,20 @@ function parseproposal(value, origin, grants) {
|
|
|
4748
5159
|
const expiresat = typeof planinput.expiresat === "number" ? planinput.expiresat : createdat + 10 * 60 * 1e3;
|
|
4749
5160
|
if (expiresat <= createdat) throw new Error("Plan expiry must be in the future.");
|
|
4750
5161
|
const planwindow = expiresat - createdat;
|
|
5162
|
+
const attachinput = stepsinput.map((input) => record(input)).find((candidate) => candidate.kind === "attachcdp");
|
|
5163
|
+
let planallowlist2;
|
|
5164
|
+
if (attachinput !== void 0) {
|
|
5165
|
+
const attachoptions = (() => {
|
|
5166
|
+
try {
|
|
5167
|
+
return parseoptions({ id: "attach", kind: "attachcdp", summary: "attach", risk: "sensitive", ...typeof attachinput.options === "string" ? { options: attachinput.options } : {} });
|
|
5168
|
+
} catch {
|
|
5169
|
+
return {};
|
|
5170
|
+
}
|
|
5171
|
+
})();
|
|
5172
|
+
const domains = Array.isArray(attachoptions.domains) ? attachoptions.domains.filter((domain) => typeof domain === "string" && cdpdomains.includes(domain)) : [];
|
|
5173
|
+
const gated = cdpallowlistof(attachoptions.allowlist);
|
|
5174
|
+
planallowlist2 = domains.length > 0 ? { domains, ...gated?.methods !== void 0 ? { methods: gated.methods } : {} } : void 0;
|
|
5175
|
+
}
|
|
4751
5176
|
const steps = stepsinput.map((input, index) => {
|
|
4752
5177
|
const candidate = record(input);
|
|
4753
5178
|
const kind = text(candidate.kind, `step ${index + 1} kind`);
|
|
@@ -4798,6 +5223,36 @@ function parseproposal(value, origin, grants) {
|
|
|
4798
5223
|
if (!granted) throw new Error(`The ${step.kind} capture of ${origin} targets an origin outside the grants.`);
|
|
4799
5224
|
if (debugoptions.level !== void 0 && !loglevels.includes(debugoptions.level)) throw new Error(`The reviewed level floor must be one of ${loglevels.join(", ")}.`);
|
|
4800
5225
|
}
|
|
5226
|
+
if (iscdpkind(step.kind)) {
|
|
5227
|
+
const granted = covered.some((pattern) => {
|
|
5228
|
+
try {
|
|
5229
|
+
return new URL(origin).origin === new URL(pattern).origin;
|
|
5230
|
+
} catch {
|
|
5231
|
+
return false;
|
|
5232
|
+
}
|
|
5233
|
+
});
|
|
5234
|
+
if (!granted) throw new Error(`The ${step.kind} step of ${origin} targets an origin outside the grants.`);
|
|
5235
|
+
let cdpoptions = {};
|
|
5236
|
+
try {
|
|
5237
|
+
cdpoptions = parseoptions(step);
|
|
5238
|
+
} catch {
|
|
5239
|
+
cdpoptions = {};
|
|
5240
|
+
}
|
|
5241
|
+
if (step.kind === "attachcdp") {
|
|
5242
|
+
if (teardownplanof(cdpoptions.teardown) === void 0) throw new Error("Attach steps without a reviewed teardown plan are refused.");
|
|
5243
|
+
const domains = Array.isArray(cdpoptions.domains) ? cdpoptions.domains.filter((domain) => typeof domain === "string" && cdpdomains.includes(domain)) : [];
|
|
5244
|
+
if (domains.length === 0) throw new Error("Attach steps need a non-empty enabled domain list of the reviewed domain grammar.");
|
|
5245
|
+
const gated = cdpallowlistof(cdpoptions.allowlist);
|
|
5246
|
+
if (cdpoptions.allowlist !== void 0 && (!gated || !gated.domains.every((domain) => domains.includes(domain)))) throw new Error("The reviewed method allowlist must stay inside the enabled domains of the attach.");
|
|
5247
|
+
}
|
|
5248
|
+
if (step.kind === "cdpcmd") {
|
|
5249
|
+
const command = cdpoptions.command && typeof cdpoptions.command === "object" && !Array.isArray(cdpoptions.command) ? cdpoptions.command : void 0;
|
|
5250
|
+
const method = typeof command?.method === "string" ? command.method : "";
|
|
5251
|
+
if (methoddomain(method) === void 0) throw new Error("Raw commands need a reviewed method of the Domain.method form.");
|
|
5252
|
+
if (planallowlist2 === void 0) throw new Error("Raw command steps need the attachcdp step of the same plan with its enabled domains first.");
|
|
5253
|
+
if (!allowlistcovers(planallowlist2, method)) throw new Error(`The raw command ${method} stays outside the enabled domain allowlist of the plan attach.`);
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
4801
5256
|
const evaluation = validatestep(step, origin);
|
|
4802
5257
|
if (!evaluation.allowed) throw new Error(evaluation.reason);
|
|
4803
5258
|
const target = outboundtarget(step);
|
|
@@ -4872,7 +5327,7 @@ function requestbody(input) {
|
|
|
4872
5327
|
return JSON.stringify({ version: protocolversion, objective: input.objective, session: input.session, observation: input.observation, capabilities: input.capabilities });
|
|
4873
5328
|
}
|
|
4874
5329
|
function outcomeresponse(input) {
|
|
4875
|
-
return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, outcome: input.outcome, ...input.resolvedtarget ? { resolvedtarget: input.resolvedtarget } : {}, ...input.capture ? { capture: input.capture } : {}, ...input.media ? { media: input.media } : {}, ...input.transport ? { transport: input.transport } : {}, ...input.network ? { network: input.network } : {}, ...input.control ? { control: input.control } : {}, ...input.timeline ? { timeline: input.timeline } : {} });
|
|
5330
|
+
return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, outcome: input.outcome, ...input.resolvedtarget ? { resolvedtarget: input.resolvedtarget } : {}, ...input.capture ? { capture: input.capture } : {}, ...input.media ? { media: input.media } : {}, ...input.transport ? { transport: input.transport } : {}, ...input.network ? { network: input.network } : {}, ...input.control ? { control: input.control } : {}, ...input.timeline ? { timeline: input.timeline } : {}, ...input.cdp ? { cdp: input.cdp } : {} });
|
|
4876
5331
|
}
|
|
4877
5332
|
function mapresponse(input) {
|
|
4878
5333
|
return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, map: input.map });
|
|
@@ -4989,7 +5444,21 @@ function timelinereport(input) {
|
|
|
4989
5444
|
function consolediffreport(input) {
|
|
4990
5445
|
return { version: protocolversion, diff: input.diff };
|
|
4991
5446
|
}
|
|
5447
|
+
function cdpreport(input) {
|
|
5448
|
+
const overrides = input.overrides.map((spec) => {
|
|
5449
|
+
const { source, ...metadata } = spec;
|
|
5450
|
+
void source;
|
|
5451
|
+
return metadata;
|
|
5452
|
+
});
|
|
5453
|
+
const grants = input.grants.map((grant) => {
|
|
5454
|
+
const { prompt, ...metadata } = grant;
|
|
5455
|
+
void prompt;
|
|
5456
|
+
return metadata;
|
|
5457
|
+
});
|
|
5458
|
+
return { version: protocolversion, sessions: input.sessions, commands: input.commands, events: input.events, breakpoints: input.breakpoints, pauses: input.pauses, watches: input.watches, overrides, grants };
|
|
5459
|
+
}
|
|
4992
5460
|
export {
|
|
5461
|
+
allowlistcovers,
|
|
4993
5462
|
annotationplanof,
|
|
4994
5463
|
apientries,
|
|
4995
5464
|
apikeyconsentgranted,
|
|
@@ -4997,6 +5466,7 @@ export {
|
|
|
4997
5466
|
applyheaderules,
|
|
4998
5467
|
argkind,
|
|
4999
5468
|
assetentries,
|
|
5469
|
+
attachcdpsession,
|
|
5000
5470
|
attachtimeline,
|
|
5001
5471
|
authconsentgranted,
|
|
5002
5472
|
authorizeurl,
|
|
@@ -5007,6 +5477,9 @@ export {
|
|
|
5007
5477
|
blockruleof,
|
|
5008
5478
|
bodyfilterof,
|
|
5009
5479
|
bodymatches,
|
|
5480
|
+
breakpointbudgetallowed,
|
|
5481
|
+
breakpointceilingof,
|
|
5482
|
+
breakpointinputof,
|
|
5010
5483
|
buildname,
|
|
5011
5484
|
buildpdf,
|
|
5012
5485
|
buildsheet,
|
|
@@ -5022,12 +5495,18 @@ export {
|
|
|
5022
5495
|
captureformats,
|
|
5023
5496
|
capturekinds,
|
|
5024
5497
|
captureoptionsof,
|
|
5498
|
+
capturepause,
|
|
5025
5499
|
captureregion,
|
|
5026
5500
|
capturereport,
|
|
5027
5501
|
capturestates,
|
|
5028
5502
|
capturestitched,
|
|
5029
5503
|
capturetargets,
|
|
5030
5504
|
capturevisible,
|
|
5505
|
+
cdpallowlistof,
|
|
5506
|
+
cdpdomains,
|
|
5507
|
+
cdpeventruleof,
|
|
5508
|
+
cdpkinds,
|
|
5509
|
+
cdpreport,
|
|
5031
5510
|
channeloptionsof,
|
|
5032
5511
|
channelorigin,
|
|
5033
5512
|
closechannel,
|
|
@@ -5048,9 +5527,12 @@ export {
|
|
|
5048
5527
|
crossesviewport,
|
|
5049
5528
|
cursorfrom,
|
|
5050
5529
|
datasetresponse,
|
|
5530
|
+
debuggate,
|
|
5531
|
+
debuggerconsentcovers,
|
|
5051
5532
|
debugwaitbudgetallowed,
|
|
5052
5533
|
dedupeimages,
|
|
5053
5534
|
actionrisk as deriveactionrisk,
|
|
5535
|
+
detachcdpsession,
|
|
5054
5536
|
diffresponse,
|
|
5055
5537
|
diffreviewgrade,
|
|
5056
5538
|
downloadreport,
|
|
@@ -5082,6 +5564,7 @@ export {
|
|
|
5082
5564
|
imagefilterof,
|
|
5083
5565
|
imagematches,
|
|
5084
5566
|
imagenames,
|
|
5567
|
+
iscdpkind,
|
|
5085
5568
|
iscontrolkind,
|
|
5086
5569
|
isdebugkind,
|
|
5087
5570
|
isformkind,
|
|
@@ -5102,6 +5585,7 @@ export {
|
|
|
5102
5585
|
mediakinds,
|
|
5103
5586
|
mediareport,
|
|
5104
5587
|
messagefilterof,
|
|
5588
|
+
methoddomain,
|
|
5105
5589
|
mockfor,
|
|
5106
5590
|
mockspecof,
|
|
5107
5591
|
multipartchunks,
|
|
@@ -5122,6 +5606,8 @@ export {
|
|
|
5122
5606
|
observationresponse,
|
|
5123
5607
|
openchannel,
|
|
5124
5608
|
outcomeresponse,
|
|
5609
|
+
overrideinputof,
|
|
5610
|
+
overridematches,
|
|
5125
5611
|
pairexchange,
|
|
5126
5612
|
pairstates,
|
|
5127
5613
|
parsehtmlbody,
|
|
@@ -5130,6 +5616,7 @@ export {
|
|
|
5130
5616
|
parsetokens,
|
|
5131
5617
|
passwordconsentgranted,
|
|
5132
5618
|
patternorigin,
|
|
5619
|
+
pauseretentionwindow,
|
|
5133
5620
|
payloadshapeof,
|
|
5134
5621
|
payloadvalid,
|
|
5135
5622
|
payloadwithdefaults,
|
|
@@ -5137,6 +5624,7 @@ export {
|
|
|
5137
5624
|
pdfpagesize,
|
|
5138
5625
|
pdfsegments,
|
|
5139
5626
|
pdftextlayout,
|
|
5627
|
+
planallowlist,
|
|
5140
5628
|
pollcursorof,
|
|
5141
5629
|
polldecision,
|
|
5142
5630
|
pollurl,
|
|
@@ -5158,6 +5646,7 @@ export {
|
|
|
5158
5646
|
receivemessage,
|
|
5159
5647
|
reconnectwaits,
|
|
5160
5648
|
recordingoptionsof,
|
|
5649
|
+
recordwatchvalue,
|
|
5161
5650
|
redactconsoletext,
|
|
5162
5651
|
redactedcookies,
|
|
5163
5652
|
regionsteps,
|
|
@@ -5176,9 +5665,11 @@ export {
|
|
|
5176
5665
|
scaledrect,
|
|
5177
5666
|
seamweights,
|
|
5178
5667
|
selectorresponse,
|
|
5668
|
+
sendcdpcommand,
|
|
5179
5669
|
sendfetch,
|
|
5180
5670
|
sequenceintegrity,
|
|
5181
5671
|
serializearg,
|
|
5672
|
+
serializecdpcommand,
|
|
5182
5673
|
sessionmemory,
|
|
5183
5674
|
signalsreport,
|
|
5184
5675
|
socketgate,
|
|
@@ -5189,11 +5680,14 @@ export {
|
|
|
5189
5680
|
stackframes,
|
|
5190
5681
|
stackgate,
|
|
5191
5682
|
statusclassof,
|
|
5683
|
+
stepmodeof,
|
|
5192
5684
|
streamsummaries,
|
|
5193
5685
|
streamwindowof,
|
|
5194
5686
|
submitreviewgranted,
|
|
5195
5687
|
subscriptionoptionsof,
|
|
5196
5688
|
tabreportresponse,
|
|
5689
|
+
teardowncdpsession,
|
|
5690
|
+
teardownplanof,
|
|
5197
5691
|
templateurl,
|
|
5198
5692
|
thumbdirectiveof,
|
|
5199
5693
|
thumbgeometry,
|
|
@@ -5208,12 +5702,15 @@ export {
|
|
|
5208
5702
|
transformgrammar,
|
|
5209
5703
|
unwrapgraphql,
|
|
5210
5704
|
urlencodeform,
|
|
5705
|
+
validatebreakpointcondition,
|
|
5211
5706
|
validatefieldmatch,
|
|
5212
5707
|
validateformrecord,
|
|
5213
5708
|
validatestep,
|
|
5214
5709
|
validatetargetref,
|
|
5215
5710
|
validatevaluegen,
|
|
5711
|
+
watchcdpevents,
|
|
5216
5712
|
watcherdetached,
|
|
5713
|
+
watchexpressionof,
|
|
5217
5714
|
watchgate,
|
|
5218
5715
|
wizardreport
|
|
5219
5716
|
};
|