fix(browser): require storage fingerprint approval
This commit is contained in:
@@ -164,6 +164,7 @@ const browserParameters = (
|
||||
include_websocket_shapes: input.include_websocket_shapes,
|
||||
include_script_sources: input.include_script_sources,
|
||||
include_storage_keys: input.include_storage_keys,
|
||||
include_storage_fingerprints: input.include_storage_fingerprints,
|
||||
limits: input.limits,
|
||||
...(input.include_script_sources && "source_capture_approved" in input
|
||||
? {
|
||||
|
||||
@@ -71,7 +71,7 @@ export const captureStorage = async (
|
||||
: [{ name: name.slice(0, 1_024), id } satisfies CapturedCache];
|
||||
});
|
||||
const maximum = context.input.limits.max_storage_keys;
|
||||
const fingerprints = context.input.include_storage_keys
|
||||
const fingerprints = context.input.include_storage_fingerprints
|
||||
? await captureStorageFingerprints({
|
||||
context,
|
||||
origin,
|
||||
|
||||
@@ -134,6 +134,7 @@ const registerPageInspection = (
|
||||
websocket_shape_approved: options.websocketShapeApproved,
|
||||
include_script_sources: options.includeScriptSources,
|
||||
include_storage_keys: options.includeStorageKeys,
|
||||
include_storage_fingerprints: options.includeStorageFingerprints,
|
||||
limits: {
|
||||
max_frames: options.maxFrames,
|
||||
max_dom_nodes: options.maxDomNodes,
|
||||
|
||||
@@ -74,6 +74,10 @@ export const browserPageInspectionOptions = z.object({
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe("Include storage key names without values"),
|
||||
includeStorageFingerprints: z
|
||||
.boolean()
|
||||
.default(false)
|
||||
.describe("Include content-derived storage fingerprints"),
|
||||
maxFrames: boundedCount("page frames", 1_000, 200),
|
||||
maxDomNodes: boundedCount("DOM nodes", 10_000, 2_000),
|
||||
maxAxNodes: boundedCount("accessibility nodes", 10_000, 2_000),
|
||||
|
||||
@@ -164,6 +164,7 @@ export const BROWSER_TOOL_CONTRACTS = [
|
||||
websocket_shape_approved: false,
|
||||
include_script_sources: false,
|
||||
include_storage_keys: false,
|
||||
include_storage_fingerprints: false,
|
||||
limits: {
|
||||
max_frames: 200,
|
||||
max_dom_nodes: 2_000,
|
||||
|
||||
@@ -222,11 +222,18 @@ export const inspectWebPageInputSchema = z
|
||||
websocket_shape_approved: z.boolean().default(false),
|
||||
include_script_sources: z.boolean().default(false),
|
||||
include_storage_keys: z.boolean().default(false),
|
||||
include_storage_fingerprints: z.boolean().default(false),
|
||||
limits: browserInspectionLimitsSchema.default(
|
||||
DEFAULT_BROWSER_INSPECTION_LIMITS,
|
||||
),
|
||||
})
|
||||
.superRefine((input, context) => {
|
||||
if (input.include_storage_fingerprints && !input.include_storage_keys)
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
path: ["include_storage_fingerprints"],
|
||||
message: "Storage fingerprints require storage key capture",
|
||||
});
|
||||
if (
|
||||
input.limits.max_script_source_bytes >
|
||||
input.limits.max_total_script_source_bytes
|
||||
|
||||
Reference in New Issue
Block a user