@ai-ecoverse/slicc-browsers 1.28.5 → 1.29.0
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 +1 -0
- package/cookie-plant.mjs +4273 -0
- package/fixture-server.mjs +10 -0
- package/guard-runner.mjs +56 -7
- package/guard-vectors.json +5501 -1140
- package/package.json +4 -3
- package/schema/guard-vectors.schema.json +42 -2
package/fixture-server.mjs
CHANGED
|
@@ -304,6 +304,16 @@ export async function fixtureServer({ host = '127.0.0.1', port = 0, tls, latency
|
|
|
304
304
|
port: address.port,
|
|
305
305
|
origin: `${scheme}://${host}:${address.port}`,
|
|
306
306
|
log: () => structuredClone(entries),
|
|
307
|
+
record: (url) => {
|
|
308
|
+
const entry = {
|
|
309
|
+
time: Date.now(),
|
|
310
|
+
url: String(url ?? ''),
|
|
311
|
+
method: 'GET',
|
|
312
|
+
headers: {},
|
|
313
|
+
};
|
|
314
|
+
entries.push(entry);
|
|
315
|
+
history.push(entry);
|
|
316
|
+
},
|
|
307
317
|
reset: () => {
|
|
308
318
|
entries = [];
|
|
309
319
|
},
|
package/guard-runner.mjs
CHANGED
|
@@ -4,6 +4,7 @@ export { fixtureClient };
|
|
|
4
4
|
|
|
5
5
|
import { bfcacheRestore } from './bfcache-restore.mjs';
|
|
6
6
|
import { closeProtectedShape } from './close-protected-shape.mjs';
|
|
7
|
+
import { cookiePlant } from './cookie-plant.mjs';
|
|
7
8
|
import { credentialExport } from './credential-export.mjs';
|
|
8
9
|
import { extensionFrame } from './extension-frame.mjs';
|
|
9
10
|
import { DEFAULT_EXTENSION_WORLD_ID, extensionWorld } from './extension-world.mjs';
|
|
@@ -98,6 +99,22 @@ const declared = (capability, capabilities) =>
|
|
|
98
99
|
const gatedOut = (observation, capabilities) =>
|
|
99
100
|
!supported(observation?.requires, capabilities) ||
|
|
100
101
|
(observation?.unless ?? []).some((capability) => declared(capability, capabilities));
|
|
102
|
+
const withCookiePlantCaps = (capabilities, probe) => {
|
|
103
|
+
const asObject = Array.isArray(capabilities)
|
|
104
|
+
? Object.fromEntries(capabilities.map((name) => [name, true]))
|
|
105
|
+
: { ...capabilities };
|
|
106
|
+
if (!declared('requestInterception', asObject)) return capabilities;
|
|
107
|
+
if (!probe) return capabilities;
|
|
108
|
+
if (probe.fetch === true && asObject.fetchInterception !== false)
|
|
109
|
+
asObject.fetchInterception = true;
|
|
110
|
+
else delete asObject.fetchInterception;
|
|
111
|
+
if (probe.legacy === true && asObject.legacyInterception === true)
|
|
112
|
+
asObject.legacyInterception = true;
|
|
113
|
+
else delete asObject.legacyInterception;
|
|
114
|
+
return Array.isArray(capabilities)
|
|
115
|
+
? Object.keys(asObject).filter((name) => asObject[name] === true)
|
|
116
|
+
: asObject;
|
|
117
|
+
};
|
|
101
118
|
const matches = (value, predicate) => {
|
|
102
119
|
if (predicate === null || typeof predicate !== 'object') return value === predicate;
|
|
103
120
|
return Object.entries(predicate).every(([key, want]) => {
|
|
@@ -908,6 +925,7 @@ class Execution {
|
|
|
908
925
|
'protectedParentIframes',
|
|
909
926
|
'credentialExport',
|
|
910
927
|
'signInHold',
|
|
928
|
+
'cookiePlant',
|
|
911
929
|
'extensionWorld',
|
|
912
930
|
'extensionFrame',
|
|
913
931
|
'frameRead',
|
|
@@ -922,6 +940,7 @@ class Execution {
|
|
|
922
940
|
'protectedParentIframes',
|
|
923
941
|
'credentialExport',
|
|
924
942
|
'signInHold',
|
|
943
|
+
'cookiePlant',
|
|
925
944
|
'redirectSecret',
|
|
926
945
|
'extensionFrame',
|
|
927
946
|
'frameRead',
|
|
@@ -1029,6 +1048,7 @@ class Execution {
|
|
|
1029
1048
|
step.protectedParentIframes ||
|
|
1030
1049
|
step.credentialExport ||
|
|
1031
1050
|
step.signInHold ||
|
|
1051
|
+
step.cookiePlant ||
|
|
1032
1052
|
step.spawnWorker ||
|
|
1033
1053
|
step.probeSessions
|
|
1034
1054
|
)
|
|
@@ -1181,6 +1201,7 @@ class Execution {
|
|
|
1181
1201
|
if (step.protectedParentIframes) return this.runProtectedParentIframes(step);
|
|
1182
1202
|
if (step.credentialExport) return this.runCredentialExport(step);
|
|
1183
1203
|
if (step.signInHold) return this.runSignInHold(step);
|
|
1204
|
+
if (step.cookiePlant) return this.runCookiePlant(step);
|
|
1184
1205
|
if (step.spawnWorker) return this.spawnWorker(step);
|
|
1185
1206
|
return this.probeSessions(step);
|
|
1186
1207
|
}
|
|
@@ -1309,6 +1330,30 @@ class Execution {
|
|
|
1309
1330
|
return out;
|
|
1310
1331
|
}
|
|
1311
1332
|
|
|
1333
|
+
async runCookiePlant(step) {
|
|
1334
|
+
return outcome(
|
|
1335
|
+
cookiePlant({
|
|
1336
|
+
client: this.client,
|
|
1337
|
+
reader: this.reader,
|
|
1338
|
+
protectedOrigin: this.vars.protectedTarget,
|
|
1339
|
+
credentialOrigin: this.vars.idp ?? this.options.targets?.idp ?? this.vars.protectedTarget,
|
|
1340
|
+
ordinary: this.vars.ordinary,
|
|
1341
|
+
tag: this.vars.tag,
|
|
1342
|
+
internalSessions: this.internalSessions,
|
|
1343
|
+
notes: this.notes,
|
|
1344
|
+
budget: this.bound(5000),
|
|
1345
|
+
control: this.side === 'control',
|
|
1346
|
+
mode: step.cookiePlant,
|
|
1347
|
+
fixtureLog: () => this.options.fixture.log(),
|
|
1348
|
+
blockedMarkers: this.vector.blockedMarkers ?? [],
|
|
1349
|
+
onlyPaths: this.options.cookiePlantOnlyPaths ?? null,
|
|
1350
|
+
forcedRaw: this.options.cookiePlantForcedRaw ?? null,
|
|
1351
|
+
browserContextId: this.vars.context ?? null,
|
|
1352
|
+
browserContexts: supported(['browserContexts'], this.options.capabilities),
|
|
1353
|
+
})
|
|
1354
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1312
1357
|
spawnWorkerKind() {
|
|
1313
1358
|
return allSteps([...(this.vector.setup ?? []), ...(this.vector.trigger ?? [])]).find(
|
|
1314
1359
|
(step) => step.spawnWorker
|
|
@@ -2131,10 +2176,11 @@ class Execution {
|
|
|
2131
2176
|
async observeAll(unseen) {
|
|
2132
2177
|
const observed = { ...this.refused };
|
|
2133
2178
|
const incomplete = [];
|
|
2179
|
+
const capabilities = withCookiePlantCaps(this.options.capabilities, this.calls.probe?.result);
|
|
2134
2180
|
let measured = 0;
|
|
2135
2181
|
let excused = 0;
|
|
2136
2182
|
for (const [name, observation] of Object.entries(this.vector.observe ?? {})) {
|
|
2137
|
-
if (gatedOut(observation,
|
|
2183
|
+
if (gatedOut(observation, capabilities)) {
|
|
2138
2184
|
observed[name] = 'not-supported';
|
|
2139
2185
|
continue;
|
|
2140
2186
|
}
|
|
@@ -2344,7 +2390,8 @@ const needsObserver = (vector) =>
|
|
|
2344
2390
|
step.closeProtectedShape ||
|
|
2345
2391
|
step.protectedParentIframes ||
|
|
2346
2392
|
step.credentialExport ||
|
|
2347
|
-
step.signInHold
|
|
2393
|
+
step.signInHold ||
|
|
2394
|
+
step.cookiePlant
|
|
2348
2395
|
) ||
|
|
2349
2396
|
vector.control.via === 'unguarded' ||
|
|
2350
2397
|
observerRequired(vector.liveCheck) ||
|
|
@@ -2570,18 +2617,19 @@ async function watch(work, ms, snapshot) {
|
|
|
2570
2617
|
return stuck;
|
|
2571
2618
|
}
|
|
2572
2619
|
|
|
2573
|
-
async function timedOut(stuck, base, made, work, opts) {
|
|
2620
|
+
async function timedOut(stuck, base, made, work, opts, rowTimeoutMs) {
|
|
2574
2621
|
const close = made.close;
|
|
2575
2622
|
made.close = undefined;
|
|
2576
2623
|
await close?.call(made);
|
|
2577
2624
|
work.catch(() => {});
|
|
2625
|
+
const ms = rowTimeoutMs ?? opts.rowTimeoutMs;
|
|
2578
2626
|
const failed = {
|
|
2579
2627
|
...base,
|
|
2580
2628
|
control: 'fail',
|
|
2581
2629
|
guarded: 'fail',
|
|
2582
2630
|
live: 'fail',
|
|
2583
|
-
why: `row timed out after ${
|
|
2584
|
-
errors: [`row timed out after ${
|
|
2631
|
+
why: `row timed out after ${ms}ms`,
|
|
2632
|
+
errors: [`row timed out after ${ms}ms: ${JSON.stringify(stuck)}`],
|
|
2585
2633
|
inFlight: stuck,
|
|
2586
2634
|
};
|
|
2587
2635
|
opts.log?.(failed);
|
|
@@ -2661,12 +2709,13 @@ async function executeRow(job, opts, made, set, slot, index, flights) {
|
|
|
2661
2709
|
flights.add({ flight, base, clients });
|
|
2662
2710
|
opts.onStart?.(base);
|
|
2663
2711
|
const sides = runLegs({ vector, opts, clients, set, job, slot, index, legs, renewed });
|
|
2664
|
-
const
|
|
2712
|
+
const rowTimeoutMs = Number.isFinite(opts.rowTimeoutMs) ? opts.rowTimeoutMs : undefined;
|
|
2713
|
+
const stuck = await watch(sides, rowTimeoutMs, () => view(flight, base, clients));
|
|
2665
2714
|
for (const entry of flights) if (entry.flight === flight) flights.delete(entry);
|
|
2666
2715
|
await closeAll(renewed);
|
|
2667
2716
|
if (stuck) {
|
|
2668
2717
|
flight.abandoned = true;
|
|
2669
|
-
return timedOut(stuck, base, made, sides, opts);
|
|
2718
|
+
return timedOut(stuck, base, made, sides, opts, rowTimeoutMs);
|
|
2670
2719
|
}
|
|
2671
2720
|
if (legs.control.unsupported === 'trustedEmulation')
|
|
2672
2721
|
return skipRow(base, 'not-supported:trustedEmulation');
|