@ai-ecoverse/slicc-browsers 1.35.1 → 1.36.1
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 +3 -2
- package/cookie-plant.mjs +54 -25
- package/guard-driver.mjs +29 -1
- package/guard-runner.mjs +83 -15
- package/guard-vectors.json +10 -4
- package/package.json +2 -2
- package/schema/guard-vectors.schema.json +6 -0
package/README.md
CHANGED
|
@@ -232,8 +232,9 @@ You supply:
|
|
|
232
232
|
| --- | --- |
|
|
233
233
|
| `autoAttach` | auto-attach to child targets such as popups and iframes |
|
|
234
234
|
| `iframeAutoAttach` | auto-attach non-tab child targets (out-of-process iframes) under a page session |
|
|
235
|
-
| `errorFrameClass` | tell whether a failed (error) iframe was loading a protected URL, without being given the URL
|
|
236
|
-
| `browserSession` | send
|
|
235
|
+
| `errorFrameClass` | tell whether a failed (error) iframe was loading a protected URL, without being given the URL |
|
|
236
|
+
| `browserSession` | send `Target.*` and `Browser.*` on the browser session |
|
|
237
|
+
| `browserStorage` | send `Storage.*` there too (needs `browserSession`) |
|
|
237
238
|
| `browserContexts` | create isolated browser contexts |
|
|
238
239
|
| `discovery` | report target create/change without a session |
|
|
239
240
|
| `chromeUrlsAttach` | attach to `chrome://` pages (DevTools-port CDP; not `chrome.debugger`) |
|
package/cookie-plant.mjs
CHANGED
|
@@ -318,12 +318,10 @@ async function detectTransport(client, sessionId, notes) {
|
|
|
318
318
|
note(notes, 'cookie-plant.transport', { kind: 'legacy' });
|
|
319
319
|
return { kind: 'legacy', fetch: false, legacy: true, fetchEnable: null };
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
});
|
|
326
|
-
return { kind: null, fetch: false, legacy: false, fetchEnable: null };
|
|
321
|
+
const fetchError = String(fetchEnable.error?.message ?? fetchEnable.error);
|
|
322
|
+
const legacyError = String(legacyEnable.error?.message ?? legacyEnable.error);
|
|
323
|
+
note(notes, 'cookie-plant.transport', { kind: null, fetchError, legacyError });
|
|
324
|
+
return { kind: null, fetch: false, legacy: false, fetchEnable: null, fetchError, legacyError };
|
|
327
325
|
}
|
|
328
326
|
|
|
329
327
|
async function enableLegacy(client, sessionId) {
|
|
@@ -2702,23 +2700,45 @@ function timedClient(client, timing) {
|
|
|
2702
2700
|
};
|
|
2703
2701
|
}
|
|
2704
2702
|
|
|
2703
|
+
const missCap = 200;
|
|
2704
|
+
|
|
2705
|
+
function boundedError(error, tag) {
|
|
2706
|
+
const text = String(error?.message ?? error ?? 'no error')
|
|
2707
|
+
.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s"'<>]*/gi, '<url>')
|
|
2708
|
+
.replace(/([\w.-]+)=[^\s;,]+/g, '$1=<value>');
|
|
2709
|
+
return (tag ? text.split(tag).join('<tag>') : text).slice(0, missCap);
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
function missedTab(ctx, step, error) {
|
|
2713
|
+
return { ...EMPTY_ATTEMPT, missed: { step, error: boundedError(error, ctx.tag) } };
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
function missedPath(name, attempt, notes) {
|
|
2717
|
+
if (!attempt?.missed) return attempt;
|
|
2718
|
+
const { missed, ...rest } = attempt;
|
|
2719
|
+
note(notes, 'cookie-plant.attach', { path: name, ...missed });
|
|
2720
|
+
const fields = ['Answered', 'Refused', 'Planted', ...(name === 'deletion' ? ['Cleared'] : [])];
|
|
2721
|
+
return {
|
|
2722
|
+
...rest,
|
|
2723
|
+
...(name === 'deletion' ? { cleared: 'incomplete' } : {}),
|
|
2724
|
+
premiseMissed: fields.map(
|
|
2725
|
+
(field) => `${name}${field}: fresh tab ${missed.step}: ${missed.error}`
|
|
2726
|
+
),
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2705
2730
|
async function withFreshAttemptTab(ctx, run) {
|
|
2706
2731
|
const { client, reader, homeUrl, notes, internalSessions, browserContextId } = ctx;
|
|
2707
2732
|
const page = await openPage(reader, homeUrl, notes, internalSessions, browserContextId);
|
|
2708
|
-
if (!page.ok)
|
|
2709
|
-
|
|
2710
|
-
{ ok: false, error: { message: `open failed: ${page.error?.message ?? page.error}` } },
|
|
2711
|
-
'incomplete'
|
|
2712
|
-
);
|
|
2713
|
-
if (page.result?.incomplete)
|
|
2714
|
-
return attemptRecord({ ok: false, error: { message: page.result.incomplete } }, 'incomplete');
|
|
2733
|
+
if (!page.ok) return missedTab(ctx, 'open', page.error);
|
|
2734
|
+
if (page.result?.incomplete) return missedTab(ctx, 'open', page.result.incomplete);
|
|
2715
2735
|
const readerSession = page.result.sessionId;
|
|
2716
2736
|
const pageTarget = page.result.targetId;
|
|
2717
2737
|
const timing = { pathStartedAt: Date.now() };
|
|
2718
2738
|
const attached = await attachClientPage(client, pageTarget, internalSessions);
|
|
2719
2739
|
if (attached.incomplete) {
|
|
2720
2740
|
await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
|
|
2721
|
-
return
|
|
2741
|
+
return missedTab(ctx, attached.step, attached.error);
|
|
2722
2742
|
}
|
|
2723
2743
|
if (attached.refused && refused(attached.refused)) {
|
|
2724
2744
|
await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
|
|
@@ -2727,20 +2747,17 @@ async function withFreshAttemptTab(ctx, run) {
|
|
|
2727
2747
|
const pageSession = attached.pageSession;
|
|
2728
2748
|
if (!pageSession) {
|
|
2729
2749
|
await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
|
|
2730
|
-
return
|
|
2731
|
-
{ ok: false, error: { message: 'client has no page session for interception attempts' } },
|
|
2732
|
-
'incomplete'
|
|
2733
|
-
);
|
|
2750
|
+
return missedTab(ctx, 'missing page session', 'Target.attachToTarget gave no sessionId');
|
|
2734
2751
|
}
|
|
2735
2752
|
const enabled = await enableClientTransport(client, pageSession, notes);
|
|
2736
2753
|
if (enabled.incomplete) {
|
|
2737
2754
|
await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
|
|
2738
|
-
return
|
|
2755
|
+
return missedTab(ctx, 'transport', enabled.error ?? enabled.incomplete);
|
|
2739
2756
|
}
|
|
2740
2757
|
const tabContextId = await resolveTabContextId(reader, pageTarget, browserContextId ?? null);
|
|
2741
2758
|
if (ctx.browserContexts && (tabContextId == null || tabContextId === '')) {
|
|
2742
2759
|
await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
|
|
2743
|
-
return
|
|
2760
|
+
return missedTab(ctx, 'context', 'Target.getTargetInfo gave no browserContextId');
|
|
2744
2761
|
}
|
|
2745
2762
|
const canary = canarySpec({ tag: ctx.tag, homeUrl });
|
|
2746
2763
|
const handle = {
|
|
@@ -3829,14 +3846,14 @@ function fillMissingAttempts(results, legacyReady) {
|
|
|
3829
3846
|
}
|
|
3830
3847
|
}
|
|
3831
3848
|
|
|
3832
|
-
async function runOneAttempt(name, run, ceiling, legacyReady, results, ran) {
|
|
3849
|
+
async function runOneAttempt(name, run, ceiling, legacyReady, results, ran, notes) {
|
|
3833
3850
|
if (!legacyReady && (name === 'legacyHeaders' || name === 'legacyRaw')) {
|
|
3834
3851
|
results[name] = notSupportedAttempt();
|
|
3835
3852
|
ran.add(name);
|
|
3836
3853
|
return;
|
|
3837
3854
|
}
|
|
3838
3855
|
try {
|
|
3839
|
-
results[name] = await withPathBudget(run(), ceiling, name);
|
|
3856
|
+
results[name] = missedPath(name, await withPathBudget(run(), ceiling, name), notes);
|
|
3840
3857
|
} catch (error) {
|
|
3841
3858
|
results[name] = attemptRecord(
|
|
3842
3859
|
{ ok: false, error: { message: String(error?.message ?? error) } },
|
|
@@ -3846,7 +3863,13 @@ async function runOneAttempt(name, run, ceiling, legacyReady, results, ran) {
|
|
|
3846
3863
|
ran.add(name);
|
|
3847
3864
|
}
|
|
3848
3865
|
|
|
3849
|
-
async function runAttempts(
|
|
3866
|
+
async function runAttempts(
|
|
3867
|
+
groups,
|
|
3868
|
+
budget = 5000,
|
|
3869
|
+
onlyPaths = null,
|
|
3870
|
+
legacyReady = true,
|
|
3871
|
+
notes = []
|
|
3872
|
+
) {
|
|
3850
3873
|
const results = {};
|
|
3851
3874
|
const ran = new Set();
|
|
3852
3875
|
const ceiling = pathCeiling(budget) + cleanupCeiling(budget) + Math.min(budget, 500);
|
|
@@ -3855,7 +3878,7 @@ async function runAttempts(groups, budget = 5000, onlyPaths = null, legacyReady
|
|
|
3855
3878
|
for (const group of groups) {
|
|
3856
3879
|
for (const [name, run] of Object.entries(group ?? {})) {
|
|
3857
3880
|
if (allow && !allow.has(name)) continue;
|
|
3858
|
-
await runOneAttempt(name, run, ceiling, legacyReady, results, ran);
|
|
3881
|
+
await runOneAttempt(name, run, ceiling, legacyReady, results, ran, notes);
|
|
3859
3882
|
}
|
|
3860
3883
|
}
|
|
3861
3884
|
fillMissingAttempts(results, legacyReady);
|
|
@@ -3872,6 +3895,8 @@ async function attachClientPage(client, pageTarget, internalSessions) {
|
|
|
3872
3895
|
if (sessionCut(attached) || refused(attached)) return { refused: attached, pageSession: null };
|
|
3873
3896
|
return {
|
|
3874
3897
|
incomplete: `client attach failed: ${attached.error?.message ?? attached.error}`,
|
|
3898
|
+
step: 'Target.attachToTarget',
|
|
3899
|
+
error: attached.error,
|
|
3875
3900
|
};
|
|
3876
3901
|
}
|
|
3877
3902
|
const pageSession = attached.result?.sessionId;
|
|
@@ -3887,6 +3912,8 @@ async function attachClientPage(client, pageTarget, internalSessions) {
|
|
|
3887
3912
|
if (sessionCut(enabled) || refused(enabled)) return { refused: enabled, pageSession };
|
|
3888
3913
|
return {
|
|
3889
3914
|
incomplete: `client ${label} failed: ${enabled.error?.message ?? enabled.error}`,
|
|
3915
|
+
step: label,
|
|
3916
|
+
error: enabled.error,
|
|
3890
3917
|
};
|
|
3891
3918
|
}
|
|
3892
3919
|
}
|
|
@@ -3900,6 +3927,7 @@ async function enableClientTransport(client, pageSession, notes) {
|
|
|
3900
3927
|
return {
|
|
3901
3928
|
incomplete:
|
|
3902
3929
|
'neither Fetch.enable nor Network.setRequestInterception is available on the guarded client',
|
|
3930
|
+
error: `Fetch.enable: ${transport.fetchError}; Network.setRequestInterception: ${transport.legacyError}`,
|
|
3903
3931
|
};
|
|
3904
3932
|
let fetchEnable = transport.fetchEnable ?? null;
|
|
3905
3933
|
if (transport.fetch && refused(fetchEnable))
|
|
@@ -4418,7 +4446,8 @@ export async function cookiePlant({
|
|
|
4418
4446
|
],
|
|
4419
4447
|
budget,
|
|
4420
4448
|
onlyPaths,
|
|
4421
|
-
legacyReady
|
|
4449
|
+
legacyReady,
|
|
4450
|
+
notes
|
|
4422
4451
|
);
|
|
4423
4452
|
|
|
4424
4453
|
const evidenceIncomplete =
|
package/guard-driver.mjs
CHANGED
|
@@ -66,6 +66,25 @@ function named(list, n = { i: 0 }) {
|
|
|
66
66
|
|
|
67
67
|
const flatten = (list) => list.flatMap((s) => [s, ...flatten(s.children ?? [])]);
|
|
68
68
|
|
|
69
|
+
const has = (capabilities, capability) =>
|
|
70
|
+
Array.isArray(capabilities)
|
|
71
|
+
? capabilities.includes(capability)
|
|
72
|
+
: capabilities?.[capability] === true;
|
|
73
|
+
|
|
74
|
+
const cookieStorageStep = (step) =>
|
|
75
|
+
step.session === 'page-or-browser' &&
|
|
76
|
+
/^Storage\.(getCookies|setCookies|clearCookies)$/.test(step.cdp ?? '');
|
|
77
|
+
|
|
78
|
+
export const browserStorageStep = (step, capabilities) =>
|
|
79
|
+
cookieStorageStep(step) && has(capabilities, 'browserStorage');
|
|
80
|
+
|
|
81
|
+
export const browserContextStep = (vector, capabilities) =>
|
|
82
|
+
flatten([...(vector?.setup ?? []), ...(vector?.trigger ?? [])]).some(
|
|
83
|
+
(step) =>
|
|
84
|
+
step.params?.browserContextId !== undefined ||
|
|
85
|
+
(cookieStorageStep(step) && has(capabilities, 'browserContexts'))
|
|
86
|
+
);
|
|
87
|
+
|
|
69
88
|
export const refusals = (vector) =>
|
|
70
89
|
flatten(named([...(vector.setup ?? []), ...(vector.trigger ?? [])]))
|
|
71
90
|
.filter((s) => s.refusable)
|
|
@@ -380,6 +399,10 @@ function declaredCapabilities(value) {
|
|
|
380
399
|
|
|
381
400
|
const autoAttachCaps = ['autoAttach', 'stockSetup', 'syntheticAutoAttach'];
|
|
382
401
|
|
|
402
|
+
const needsBrowser = (vector, cap, declared) =>
|
|
403
|
+
(vector?.requires ?? []).includes(cap) ||
|
|
404
|
+
(cap === 'browserSession' && browserContextStep(vector, declared));
|
|
405
|
+
|
|
383
406
|
function skipWhy(vector, row, known, guard, declared) {
|
|
384
407
|
const { reason } = row;
|
|
385
408
|
if (typeof reason !== 'string' || reason === '') return 'skip without a reason';
|
|
@@ -391,8 +414,13 @@ function skipWhy(vector, row, known, guard, declared) {
|
|
|
391
414
|
: `skip with a reason the runner never gives: ${reason}`;
|
|
392
415
|
if (reason.startsWith('not-supported:')) {
|
|
393
416
|
const cap = reason.slice('not-supported:'.length);
|
|
394
|
-
if (
|
|
417
|
+
if (
|
|
418
|
+
['extensionFrame', 'explicitAttach', 'browserSession', 'browserStorage'].includes(cap) &&
|
|
419
|
+
declared.includes(cap)
|
|
420
|
+
)
|
|
395
421
|
return `skip with not-supported:${cap} while the run declared ${cap}`;
|
|
422
|
+
if (['browserSession', 'browserStorage'].includes(cap) && !needsBrowser(vector, cap, declared))
|
|
423
|
+
return `skip with not-supported:${cap} on a row that does not need ${cap}`;
|
|
396
424
|
if (autoAttachCaps.includes(cap) && (vector?.requires ?? []).includes('explicitAttach'))
|
|
397
425
|
return `skip with not-supported:${cap} on an explicitAttach row`;
|
|
398
426
|
if (known.has(cap)) return null;
|
package/guard-runner.mjs
CHANGED
|
@@ -11,6 +11,8 @@ import { DEFAULT_EXTENSION_WORLD_ID, extensionWorld } from './extension-world.mj
|
|
|
11
11
|
import { frameRead } from './frame-read.mjs';
|
|
12
12
|
import {
|
|
13
13
|
beacon,
|
|
14
|
+
browserContextStep,
|
|
15
|
+
browserStorageStep,
|
|
14
16
|
canary,
|
|
15
17
|
debuggerCleanup,
|
|
16
18
|
debuggerPaused,
|
|
@@ -377,6 +379,18 @@ const resultNames = (check) =>
|
|
|
377
379
|
resultNames
|
|
378
380
|
),
|
|
379
381
|
].filter(Boolean);
|
|
382
|
+
const callNames = (check) =>
|
|
383
|
+
!check || typeof check !== 'object'
|
|
384
|
+
? []
|
|
385
|
+
: [
|
|
386
|
+
check.result,
|
|
387
|
+
...[check.from, check.compare, check.refused, check.reached, check.filtered?.from].flat(),
|
|
388
|
+
...[...(check.all ?? []), ...(check.any ?? []), ...(check.not ? [check.not] : [])].flatMap(
|
|
389
|
+
callNames
|
|
390
|
+
),
|
|
391
|
+
].filter((name) => typeof name === 'string');
|
|
392
|
+
const storageLeg = (step, capabilities) =>
|
|
393
|
+
`${step.as ?? step.cdp}: ${step.cdp} ran on the ${browserStorageStep(step, capabilities) ? 'browser' : 'page'} session`;
|
|
380
394
|
const stateCheck = (check) =>
|
|
381
395
|
check?.state ||
|
|
382
396
|
[...(check?.all ?? []), ...(check?.any ?? []), ...(check?.not ? [check.not] : [])]
|
|
@@ -563,6 +577,11 @@ class Execution {
|
|
|
563
577
|
return { sessionId, released };
|
|
564
578
|
}
|
|
565
579
|
|
|
580
|
+
stepSession(step) {
|
|
581
|
+
if (step.session === 'page-or-browser') this.note(storageLeg(step, this.options.capabilities));
|
|
582
|
+
return this.session(step.session);
|
|
583
|
+
}
|
|
584
|
+
|
|
566
585
|
session(kind) {
|
|
567
586
|
if (kind === 'browser') return undefined;
|
|
568
587
|
return this.sessions[kind === 'child' ? 'child' : 'page'];
|
|
@@ -1195,7 +1214,7 @@ class Execution {
|
|
|
1195
1214
|
const step = expand(raw, this.vars);
|
|
1196
1215
|
if (!supported(step.requires, this.options.capabilities) || step.text) continue;
|
|
1197
1216
|
if (!childSession && step.session === 'child') await this.childrenSettled();
|
|
1198
|
-
const session = childSession ?? this.
|
|
1217
|
+
const session = childSession ?? this.stepSession(step);
|
|
1199
1218
|
const first = await this.operation(step, session, phase);
|
|
1200
1219
|
if (!first) continue;
|
|
1201
1220
|
const out = await this.browserUiRetry(step, first, session, phase);
|
|
@@ -2059,7 +2078,7 @@ class Execution {
|
|
|
2059
2078
|
if (this.explicit) return this.explicitCall(step, params, sessionId);
|
|
2060
2079
|
const session =
|
|
2061
2080
|
step.session === 'page-or-browser' &&
|
|
2062
|
-
supported(['
|
|
2081
|
+
supported(['browserStorage'], this.options.capabilities) &&
|
|
2063
2082
|
/^Storage\.(getCookies|setCookies|clearCookies)$/.test(step.cdp)
|
|
2064
2083
|
? undefined
|
|
2065
2084
|
: sessionId;
|
|
@@ -2268,8 +2287,9 @@ class Execution {
|
|
|
2268
2287
|
const hint = skips.find(
|
|
2269
2288
|
(entry) => typeof entry === 'string' && (entry === name || entry.startsWith(`${name}:`))
|
|
2270
2289
|
);
|
|
2271
|
-
|
|
2272
|
-
|
|
2290
|
+
const reason = incompleteReason(name, hint, want);
|
|
2291
|
+
if (reason && !this.incomplete.some((entry) => entry.startsWith(`${name}:`)))
|
|
2292
|
+
this.incomplete.push(reason);
|
|
2273
2293
|
return 'incomplete';
|
|
2274
2294
|
}
|
|
2275
2295
|
if (this.unmeasured(check)) return 'incomplete';
|
|
@@ -2693,6 +2713,7 @@ class Execution {
|
|
|
2693
2713
|
observed[`${name}.either`] = holds;
|
|
2694
2714
|
if (holds === 'incomplete') incomplete.push(name);
|
|
2695
2715
|
}
|
|
2716
|
+
this.controlErrors(observed);
|
|
2696
2717
|
this.premises(observed);
|
|
2697
2718
|
this.unguardedPremises(observed);
|
|
2698
2719
|
this.explicitPremises(observed);
|
|
@@ -2700,6 +2721,41 @@ class Execution {
|
|
|
2700
2721
|
return { observed, incomplete };
|
|
2701
2722
|
}
|
|
2702
2723
|
|
|
2724
|
+
failedCalls() {
|
|
2725
|
+
const failed = new Map();
|
|
2726
|
+
for (const error of this.errors) {
|
|
2727
|
+
const [name, message] = error.split(' failed without a refusal: ');
|
|
2728
|
+
if (message !== undefined) failed.set(name, message);
|
|
2729
|
+
}
|
|
2730
|
+
for (const [name, out] of Object.entries(this.calls)) {
|
|
2731
|
+
if (name === '$cdp' || !out || out.ok || this.refused[name] === true) continue;
|
|
2732
|
+
const message = String(out.error?.message ?? out.error);
|
|
2733
|
+
if (!/refused/.test(message)) failed.set(name, message);
|
|
2734
|
+
}
|
|
2735
|
+
return failed;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
controlErrors(observed) {
|
|
2739
|
+
if (this.side !== 'control') return;
|
|
2740
|
+
const failed = this.failedCalls();
|
|
2741
|
+
this.unrun();
|
|
2742
|
+
if (!failed.size) return;
|
|
2743
|
+
const order = Object.keys(this.calls);
|
|
2744
|
+
const want = this.vector.control.expected ?? {};
|
|
2745
|
+
for (const [name, observation] of Object.entries(this.vector.observe ?? {})) {
|
|
2746
|
+
if (want[name] !== true || observed[name] !== false) continue;
|
|
2747
|
+
const read = [...(observation.dependsOn ?? []), ...callNames(observation.check)];
|
|
2748
|
+
const last = Math.max(...read.map((entry) => order.indexOf(entry)));
|
|
2749
|
+
const call = [...failed.keys()].find(
|
|
2750
|
+
(entry) => read.includes(entry) || (order.includes(entry) && order.indexOf(entry) < last)
|
|
2751
|
+
);
|
|
2752
|
+
if (!call) continue;
|
|
2753
|
+
observed[name] = 'incomplete';
|
|
2754
|
+
const reason = `${call} failed without a refusal: ${failed.get(call)}`;
|
|
2755
|
+
if (!this.incomplete.includes(reason)) this.incomplete.push(reason);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2703
2759
|
premises(observed) {
|
|
2704
2760
|
const want = this.side === 'control' ? this.vector.control.expected : this.vector.expected;
|
|
2705
2761
|
const observe = this.vector.observe ?? {};
|
|
@@ -2906,6 +2962,11 @@ class Execution {
|
|
|
2906
2962
|
}
|
|
2907
2963
|
}
|
|
2908
2964
|
|
|
2965
|
+
const incompleteReason = (name, hint, want) => {
|
|
2966
|
+
if (hint) return hint.includes(': ') ? hint : `${name}: ${hint}`;
|
|
2967
|
+
return want === undefined ? undefined : `${name}: incomplete, no reason recorded`;
|
|
2968
|
+
};
|
|
2969
|
+
|
|
2909
2970
|
const usesPre = (value) =>
|
|
2910
2971
|
Boolean(value && typeof value === 'object') &&
|
|
2911
2972
|
(Object.hasOwn(value, 'pre') ||
|
|
@@ -2950,14 +3011,6 @@ const skipRow = (base, reason) => ({
|
|
|
2950
3011
|
live: 'skip',
|
|
2951
3012
|
reason,
|
|
2952
3013
|
});
|
|
2953
|
-
const browserContextStep = (vector, capabilities) =>
|
|
2954
|
-
allSteps([...vector.setup, ...vector.trigger]).some(
|
|
2955
|
-
(step) =>
|
|
2956
|
-
step.params?.browserContextId !== undefined ||
|
|
2957
|
-
(step.session === 'page-or-browser' &&
|
|
2958
|
-
/^Storage\.(getCookies|setCookies|clearCookies)$/.test(step.cdp ?? '') &&
|
|
2959
|
-
supported(['browserContexts'], capabilities))
|
|
2960
|
-
);
|
|
2961
3014
|
|
|
2962
3015
|
function nullOrigins(value, targets) {
|
|
2963
3016
|
return [...q(value).matchAll(/\{([A-Za-z][A-Za-z-]*)\}/g)]
|
|
@@ -3435,12 +3488,18 @@ function validateScales(opts) {
|
|
|
3435
3488
|
throw new TypeError('refusalScale must be a number of at least 1');
|
|
3436
3489
|
}
|
|
3437
3490
|
|
|
3491
|
+
function validateCapabilities(capabilities) {
|
|
3492
|
+
if (declared('browserStorage', capabilities) && !declared('browserSession', capabilities))
|
|
3493
|
+
throw new TypeError('browserStorage needs browserSession in one run');
|
|
3494
|
+
const both = exclusive.filter((capability) => declared(capability, capabilities));
|
|
3495
|
+
if (declared('explicitAttach', capabilities) && both.length)
|
|
3496
|
+
throw new TypeError(`explicitAttach excludes ${both.join(' and ')} in one run`);
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3438
3499
|
function validate(set, opts) {
|
|
3439
3500
|
if (!opts.fixture?.log) throw new TypeError('fixture.log is required');
|
|
3440
3501
|
validateScales(opts);
|
|
3441
|
-
|
|
3442
|
-
if (declared('explicitAttach', opts.capabilities) && both.length)
|
|
3443
|
-
throw new TypeError(`explicitAttach excludes ${both.join(' and ')} in one run`);
|
|
3502
|
+
validateCapabilities(opts.capabilities);
|
|
3444
3503
|
for (const vector of set.vectors)
|
|
3445
3504
|
for (const [name, observation] of Object.entries(vector.observe ?? {}))
|
|
3446
3505
|
if (!observation.check) throw new TypeError(`${vector.id}: ${name} lacks a check`);
|
|
@@ -3619,6 +3678,8 @@ export function summary({ set, results, guard = 'reference', sha = 'unknown', ca
|
|
|
3619
3678
|
.map(([reason, count]) => `${reason}=${count}`)
|
|
3620
3679
|
.join(', ')})`
|
|
3621
3680
|
: line;
|
|
3681
|
+
const caps = capabilities ?? {};
|
|
3682
|
+
const storageUndeclared = declared('browserSession', caps) && !declared('browserStorage', caps);
|
|
3622
3683
|
return {
|
|
3623
3684
|
...value,
|
|
3624
3685
|
pass: value.pass && observerSkipped === 0,
|
|
@@ -3626,6 +3687,13 @@ export function summary({ set, results, guard = 'reference', sha = 'unknown', ca
|
|
|
3626
3687
|
skips,
|
|
3627
3688
|
observerSkipped,
|
|
3628
3689
|
incomplete,
|
|
3690
|
+
...(storageUndeclared
|
|
3691
|
+
? {
|
|
3692
|
+
browserStorageUndeclared: true,
|
|
3693
|
+
browserStorageNote:
|
|
3694
|
+
'browserStorage undeclared: page-or-browser Storage.getCookies, Storage.setCookies and Storage.clearCookies steps ran on the page session, not the browser session',
|
|
3695
|
+
}
|
|
3696
|
+
: {}),
|
|
3629
3697
|
counts: Object.fromEntries(
|
|
3630
3698
|
['control', 'guarded', 'live'].map((side) => [
|
|
3631
3699
|
side,
|
package/guard-vectors.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"setVersion": "1.
|
|
3
|
+
"setVersion": "1.36.1",
|
|
4
4
|
"sources": [
|
|
5
5
|
{
|
|
6
6
|
"repo": "ai-ecoverse/slicc-cli",
|
|
@@ -101,7 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"capabilities": {
|
|
103
103
|
"autoAttach": "Target.setAutoAttach, the children steps and child sessions",
|
|
104
|
-
"browserSession": "
|
|
104
|
+
"browserSession": "session-less Target.* and Browser.* calls on the browser session; session-less Storage.* there is browserStorage",
|
|
105
|
+
"browserStorage": "session-less Storage.* calls on the browser session, with or without browserContextId; needs browserSession; undeclared, page-or-browser Storage.getCookies, Storage.setCookies and Storage.clearCookies steps run on the row's page session, and a row that must send one on the browser session is skipped",
|
|
105
106
|
"browserContexts": "Target.createBrowserContext and Target.disposeBrowserContext",
|
|
106
107
|
"extensionWorld": "a browser hosting a foreign content-script extension isolated world on the ordinary fixture page",
|
|
107
108
|
"extensionFrame": "a browser hosting the harness extension, whose web-accessible frame.html an ordinary page embeds as an out-of-process chrome-extension: frame, like a password manager's autofill list",
|
|
@@ -18746,7 +18747,11 @@
|
|
|
18746
18747
|
},
|
|
18747
18748
|
"session": "page-or-browser",
|
|
18748
18749
|
"as": "storage",
|
|
18749
|
-
"on": "control"
|
|
18750
|
+
"on": "control",
|
|
18751
|
+
"requires": [
|
|
18752
|
+
"browserSession",
|
|
18753
|
+
"browserStorage"
|
|
18754
|
+
]
|
|
18750
18755
|
},
|
|
18751
18756
|
{
|
|
18752
18757
|
"cdp": "Storage.clearCookies",
|
|
@@ -18775,7 +18780,8 @@
|
|
|
18775
18780
|
],
|
|
18776
18781
|
"requires": [
|
|
18777
18782
|
"browserSession",
|
|
18778
|
-
"browserContexts"
|
|
18783
|
+
"browserContexts",
|
|
18784
|
+
"browserStorage"
|
|
18779
18785
|
],
|
|
18780
18786
|
"observe": {
|
|
18781
18787
|
"network": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.1",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"validate": "node scripts/validate.mjs",
|
|
80
80
|
"lint": "slicc-lint && test -z \"$(gofmt -l .)\" && go mod tidy -diff && go vet ./... && GOOS=darwin go vet ./... && GOOS=windows go vet ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features && cargo check --target wasm32-wasip1 --features serde && cargo check --target wasm32-wasip1 --all-features",
|
|
81
81
|
"format": "biome check --write . && gofmt -w . && cargo fmt",
|
|
82
|
-
"test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-redirect-through.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-trusted-emulation.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-error-page-events.test.mjs test/integration/guard-error-page-reload.test.mjs test/integration/guard-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-credential-export.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-cookie-plant-deletion.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs test/integration/guard-control-premises.test.mjs",
|
|
82
|
+
"test": "export PATH=\"$HOME/.cargo/bin:$PATH\" && node --test --test-concurrency=1 test/integration/debugger-stage1-packaging.test.mjs test/integration/debugger-raw-control.test.mjs test/integration/debugger-cleanup.test.mjs test/integration/debugger-stage1-install-vectors.test.mjs test/integration/protected-premise.test.mjs test/integration/debugger-stage1-vectors.test.mjs test/integration/self-contained.test.mjs test/integration/seven-corpus.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/guard-redirect-session-end.test.mjs test/integration/guard-redirect-history.test.mjs test/integration/guard-redirect-iframe.test.mjs test/integration/guard-redirect-through.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-unparseable-wipe.test.mjs test/integration/guard-browser-ui.test.mjs test/integration/guard-snapshot-settle.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs test/integration/guard-trusted-emulation.test.mjs test/integration/guard-exit-steps.test.mjs test/integration/guard-exit-refusal.test.mjs test/integration/guard-frame-read.test.mjs test/integration/guard-bfcache.test.mjs test/integration/guard-bfcache-marker.test.mjs test/integration/guard-bfcache-history.test.mjs test/integration/guard-bfcache-review.test.mjs test/integration/guard-bfcache-quarantine.test.mjs test/integration/guard-error-page-navigation.test.mjs test/integration/guard-error-page-events.test.mjs test/integration/guard-error-page-reload.test.mjs test/integration/guard-close-protected.test.mjs test/integration/guard-close-protected-shapes.test.mjs test/integration/guard-close-protected-shapes-chrome.test.mjs test/integration/guard-credential-export.test.mjs test/integration/guard-protected-parent-iframes.test.mjs test/integration/guard-protected-parent-iframes-chrome.test.mjs test/integration/guard-error-frame-class.test.mjs test/integration/guard-sign-in-hold.test.mjs test/integration/guard-cookie-plant-chrome.test.mjs test/integration/guard-cookie-plant.test.mjs test/integration/guard-protected-parent-page.test.mjs test/integration/guard-protected-parent-page-chrome.test.mjs test/integration/guard-world-paint.test.mjs test/integration/gates.test.mjs test/integration/validate.test.mjs test/integration/validate-guard-stock-setup.test.mjs test/integration/validate-guard-explicit.test.mjs test/integration/go.test.mjs test/integration/cargo.test.mjs test/integration/workflows.test.mjs test/integration/guard-refusable-nav.test.mjs test/integration/guard-protected-worker.test.mjs test/integration/guard-protected-worker-chrome-narrow.test.mjs test/integration/guard-protected-worker-chrome-hide.test.mjs test/integration/guard-protected-worker-chrome-hide-cut.test.mjs test/integration/guard-protected-worker-chrome-admit.test.mjs test/integration/guard-protected-worker-chrome-late.test.mjs test/integration/guard-protected-worker-chrome-rewrite.test.mjs test/integration/guard-protected-worker-chrome-rewrite-late.test.mjs test/integration/guard-sweep-union.test.mjs test/integration/guard-explicit-attach-chrome.test.mjs && node --test --test-concurrency=2 test/integration/guard-lifecycle.test.mjs test/integration/chromium-launch.test.mjs test/integration/guard-fit.test.mjs test/integration/guard-chain.test.mjs test/integration/guard-validation.test.mjs test/integration/guard-liveness.test.mjs test/integration/guard-observations.test.mjs test/integration/guard-child-latency.test.mjs test/integration/guard-child-latency-stress.test.mjs test/integration/guard-adoption.test.mjs test/integration/guard-scoping.test.mjs test/integration/guard-late-pause.test.mjs test/integration/guard-cookie-plant-raw-leg.test.mjs test/integration/guard-cookie-plant-deletion.test.mjs test/integration/guard-cookie-plant-attach.test.mjs test/integration/guard-legs.test.mjs test/integration/guard-fetch-enable.test.mjs test/integration/guard-diagnostics.test.mjs test/integration/guard-chrome.test.mjs test/integration/guard-worlds.test.mjs test/integration/guard-world-discovery.test.mjs test/integration/guard-world-guesses.test.mjs test/integration/guard-unparseable.test.mjs test/integration/guard-redirect-secret.test.mjs test/integration/guard-error-page.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-browser-page.test.mjs test/integration/guard-scales.test.mjs test/integration/guard-shared-log.test.mjs test/integration/guard-pre-beacon.test.mjs test/integration/guard-world-pause.test.mjs test/integration/guard-reveal-overlap.test.mjs test/integration/guard-extension-frame-cast.test.mjs test/integration/guard-extension-frame-mouse.test.mjs test/integration/guard-extension-frame-click.test.mjs test/integration/guard-extension-frame-attach.test.mjs test/integration/guard-extension-frames.test.mjs test/integration/guard-stock-setup.test.mjs test/integration/guard-explicit-attach.test.mjs test/integration/guard-explicit-order.test.mjs test/integration/guard-stock-attack.test.mjs test/integration/guard-parallel.test.mjs test/integration/guard-client-exit.test.mjs test/integration/guard-runner-record.test.mjs test/integration/guard-runner.test.mjs test/integration/guard-sweep-ordinary.test.mjs test/integration/guard-sweep-seven.test.mjs test/integration/guard-sweep-vault.test.mjs test/integration/guard-sweep-vault-x.test.mjs test/integration/guard-sweep-apex.test.mjs test/integration/guard-sweep-idp.test.mjs test/integration/guard-sweep-others.test.mjs test/integration/guard-browser-storage.test.mjs test/integration/guard-control-premises.test.mjs",
|
|
83
83
|
"test:unit": "mkdir -p coverage/unit && node --experimental-test-coverage --test --test-concurrency=1 --test-reporter=lcov --test-reporter-destination=coverage/unit/lcov.info test/unit/*.test.mjs && go test -race -cover ./...",
|
|
84
84
|
"build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
85
85
|
"prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"required": [
|
|
85
85
|
"autoAttach",
|
|
86
86
|
"browserSession",
|
|
87
|
+
"browserStorage",
|
|
87
88
|
"browserContexts",
|
|
88
89
|
"chromeUrlsAttach",
|
|
89
90
|
"extensionWorld",
|
|
@@ -103,6 +104,10 @@
|
|
|
103
104
|
"type": "string",
|
|
104
105
|
"minLength": 1
|
|
105
106
|
},
|
|
107
|
+
"browserStorage": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"minLength": 1
|
|
110
|
+
},
|
|
106
111
|
"browserContexts": {
|
|
107
112
|
"type": "string",
|
|
108
113
|
"minLength": 1
|
|
@@ -212,6 +217,7 @@
|
|
|
212
217
|
"enum": [
|
|
213
218
|
"autoAttach",
|
|
214
219
|
"browserSession",
|
|
220
|
+
"browserStorage",
|
|
215
221
|
"browserContexts",
|
|
216
222
|
"chromeUrlsAttach",
|
|
217
223
|
"extensionWorld",
|