@ai-ecoverse/slicc-browsers 1.43.0 → 1.45.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 +10 -16
- package/catalog.json +1 -1
- package/cookie-plant.mjs +15 -218
- package/engine/engine-wasm.mjs +3 -0
- package/engine/engine.wasm +0 -0
- package/engine.mjs +108 -0
- package/fixture-server.mjs +19 -5
- package/guard-driver.mjs +16 -3
- package/guard-runner.mjs +3 -27
- package/guard-vectors.json +435 -1432
- package/package.json +17 -9
- package/schema/catalog.schema.json +2 -2
- package/schema/guard-vectors.schema.json +2 -0
- package/credential-export.mjs +0 -1511
|
Binary file
|
package/engine.mjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import bytes from './engine/engine-wasm.mjs';
|
|
2
|
+
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
5
|
+
const roles = [
|
|
6
|
+
'seven',
|
|
7
|
+
'slicc',
|
|
8
|
+
'extra',
|
|
9
|
+
'browser',
|
|
10
|
+
'extension',
|
|
11
|
+
'file',
|
|
12
|
+
'unparseable',
|
|
13
|
+
'ordinary',
|
|
14
|
+
];
|
|
15
|
+
let compiled;
|
|
16
|
+
|
|
17
|
+
function valid(op, result) {
|
|
18
|
+
switch (op) {
|
|
19
|
+
case 'urlClass':
|
|
20
|
+
return (
|
|
21
|
+
typeof result?.protected === 'boolean' &&
|
|
22
|
+
roles.includes(result.role) &&
|
|
23
|
+
(result.origin === null || typeof result.origin === 'string')
|
|
24
|
+
);
|
|
25
|
+
case 'info':
|
|
26
|
+
return (
|
|
27
|
+
result?.abi === 1 &&
|
|
28
|
+
Number.isInteger(result.catalogSchema) &&
|
|
29
|
+
typeof result.digest === 'string' &&
|
|
30
|
+
/^[0-9a-f]{16}$/.test(result.digest)
|
|
31
|
+
);
|
|
32
|
+
case 'har':
|
|
33
|
+
return result === 'include' || result === 'exclude';
|
|
34
|
+
case 'storageKey':
|
|
35
|
+
return typeof result?.protected === 'boolean';
|
|
36
|
+
default:
|
|
37
|
+
return typeof result === 'boolean';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function exchange(wasm, method, input) {
|
|
42
|
+
const ptr = wasm.engine_alloc(input.length) >>> 0;
|
|
43
|
+
new Uint8Array(wasm.memory.buffer, ptr, input.length).set(input);
|
|
44
|
+
const packed = wasm[method](ptr, input.length);
|
|
45
|
+
const start = Number(BigInt.asUintN(64, packed) >> 32n);
|
|
46
|
+
const length = Number(packed & 0xffffffffn);
|
|
47
|
+
const answer = JSON.parse(decoder.decode(new Uint8Array(wasm.memory.buffer, start, length)));
|
|
48
|
+
wasm.engine_free(start, length);
|
|
49
|
+
wasm.engine_free(ptr, input.length);
|
|
50
|
+
if (typeof answer?.error === 'string') throw new Error(answer.error);
|
|
51
|
+
if (!answer || Object.keys(answer).length !== 1 || !Object.hasOwn(answer, 'ok'))
|
|
52
|
+
throw new Error('invalid engine response');
|
|
53
|
+
return answer.ok;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function binding(module, config) {
|
|
57
|
+
const input = encoder.encode(JSON.stringify(config));
|
|
58
|
+
function create() {
|
|
59
|
+
const wasm = new WebAssembly.Instance(module).exports;
|
|
60
|
+
if (wasm.engine_abi() !== 1) throw new Error('unsupported engine ABI');
|
|
61
|
+
if (exchange(wasm, 'engine_init', input) !== true)
|
|
62
|
+
throw new Error('engine initialization failed');
|
|
63
|
+
return wasm;
|
|
64
|
+
}
|
|
65
|
+
let instance = create();
|
|
66
|
+
function call(request) {
|
|
67
|
+
try {
|
|
68
|
+
instance ??= create();
|
|
69
|
+
const result = exchange(instance, 'engine_call', encoder.encode(JSON.stringify(request)));
|
|
70
|
+
const ok =
|
|
71
|
+
request.op === 'batch'
|
|
72
|
+
? Array.isArray(result) &&
|
|
73
|
+
result.length === request.calls.length &&
|
|
74
|
+
result.every((v, i) => valid(request.calls[i].op, v))
|
|
75
|
+
: valid(request.op, result);
|
|
76
|
+
if (!ok) throw new Error(`invalid engine result for ${request.op}`);
|
|
77
|
+
return result;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
instance = undefined;
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
url: (url, { readOnly = false } = {}) => call({ op: 'url', url, readOnly }),
|
|
85
|
+
urlReadOnly: (url) => call({ op: 'url', url, readOnly: true }),
|
|
86
|
+
urlClass: (url) => call({ op: 'urlClass', url }),
|
|
87
|
+
target: (facts) => call({ ...facts, op: 'target' }),
|
|
88
|
+
kept: (url) => call({ op: 'kept', url }),
|
|
89
|
+
keptTarget: (facts) => call({ ...facts, op: 'keptTarget' }),
|
|
90
|
+
unparseable: (url) => call({ op: 'unparseable', url }),
|
|
91
|
+
cookieDomain: (domain) => call({ op: 'cookieDomain', domain }),
|
|
92
|
+
storageKey: (key) => call({ op: 'storageKey', key }),
|
|
93
|
+
extensionFrame: (url) => call({ op: 'extensionFrame', url }),
|
|
94
|
+
har: (url) => call({ op: 'har', url }),
|
|
95
|
+
info: () => call({ op: 'info' }),
|
|
96
|
+
batch: (calls) => call({ op: 'batch', calls }),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function engine(config = {}) {
|
|
101
|
+
compiled ??= new WebAssembly.Module(bytes);
|
|
102
|
+
return binding(compiled, config);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function loadEngine(config = {}) {
|
|
106
|
+
compiled ??= await WebAssembly.compile(bytes);
|
|
107
|
+
return binding(compiled, config);
|
|
108
|
+
}
|
package/fixture-server.mjs
CHANGED
|
@@ -81,11 +81,25 @@ function route(req, url, send, html, redirects) {
|
|
|
81
81
|
'blob-nav',
|
|
82
82
|
`<p>blob-nav ${escape(p.get('n') ?? '')}</p><script>const b=URL.createObjectURL(new Blob(['<!doctype html><title>blob</title><p>blob ${escape(p.get('n') ?? '')}</p>'],{type:'text/html'}));location.replace(b);</script>`
|
|
83
83
|
),
|
|
84
|
-
'/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
'/ordinary-cookie': () => {
|
|
85
|
+
const tag = encodeURIComponent(p.get('n') ?? '');
|
|
86
|
+
const received = new Set((req.headers.cookie ?? '').split(/;\s*/));
|
|
87
|
+
const pair = (name) => name + '-' + tag + '=' + tag;
|
|
88
|
+
const status = Object.fromEntries(
|
|
89
|
+
['ordinary', 'batch', 'response', 'keep'].map((name) => [name, received.has(pair(name))])
|
|
90
|
+
);
|
|
91
|
+
const headers = p.has('inspect')
|
|
92
|
+
? {}
|
|
93
|
+
: {
|
|
94
|
+
'set-cookie': ['ordinary', 'response', 'keep'].map(
|
|
95
|
+
(name) => pair(name) + '; Path=/; HttpOnly'
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
return send(200, JSON.stringify(status), 'application/json', {
|
|
99
|
+
'cache-control': 'no-store',
|
|
100
|
+
...headers,
|
|
101
|
+
});
|
|
102
|
+
},
|
|
89
103
|
'/blank': () => html('blank', `<p>blank ${escape(p.get('n') ?? '')}</p>`),
|
|
90
104
|
'/blank-open': () => html('blank-open', `<p>blank-open ${escape(p.get('n') ?? '')}</p>`),
|
|
91
105
|
'/os/': () => html('os', `<p>os ${escape(p.get('n') ?? '')}</p>`),
|
package/guard-driver.mjs
CHANGED
|
@@ -277,8 +277,8 @@ export function result(vector, run) {
|
|
|
277
277
|
};
|
|
278
278
|
if (vector.kind === 'text')
|
|
279
279
|
return { ...row, control: 'not-run', guarded: 'not-run', live: 'not-run' };
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
const reason = declaredSkip(vector, run.target);
|
|
281
|
+
if (reason) return { ...row, control: 'skip', guarded: 'skip', live: 'skip', reason };
|
|
282
282
|
const missing = (vector.requires ?? []).find(
|
|
283
283
|
(cap) => Array.isArray(run.capabilities) && !run.capabilities.includes(cap)
|
|
284
284
|
);
|
|
@@ -374,9 +374,22 @@ function originReason(vector, row, reason) {
|
|
|
374
374
|
].includes(origin);
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
export function removedStepReason(vector) {
|
|
378
|
+
for (const step of flatten([...(vector?.setup ?? []), ...(vector?.trigger ?? [])])) {
|
|
379
|
+
if (step.credentialExport === true) return 'not-applicable:removed-credential-export';
|
|
380
|
+
if (step.cookiePlant === 'credential' || step.cookiePlant === 'credential-set-cookie')
|
|
381
|
+
return 'not-applicable:removed-credential-cookie-plant';
|
|
382
|
+
}
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const declaredSkip = (vector, target) =>
|
|
387
|
+
removedStepReason(vector) ?? (vector.skip?.target === target ? vector.skip.reason : null);
|
|
388
|
+
|
|
377
389
|
export const skipReason = (vector, target, scope) => {
|
|
378
390
|
if (!vector) return null;
|
|
379
|
-
|
|
391
|
+
const declared = declaredSkip(vector, target);
|
|
392
|
+
if (declared) return declared;
|
|
380
393
|
if (vector.observable?.[target] === false) return 'not-applicable';
|
|
381
394
|
return vector.scope !== 'any' && vector.scope !== scope ? 'not-applicable' : null;
|
|
382
395
|
};
|
package/guard-runner.mjs
CHANGED
|
@@ -5,7 +5,6 @@ export { fixtureClient };
|
|
|
5
5
|
import { bfcacheRestore } from './bfcache-restore.mjs';
|
|
6
6
|
import { closeProtectedShape } from './close-protected-shape.mjs';
|
|
7
7
|
import { cookiePlant } from './cookie-plant.mjs';
|
|
8
|
-
import { credentialExport } from './credential-export.mjs';
|
|
9
8
|
import { extensionFrame, protectedRefusal } from './extension-frame.mjs';
|
|
10
9
|
import { DEFAULT_EXTENSION_WORLD_ID, extensionWorld } from './extension-world.mjs';
|
|
11
10
|
import { frameRead } from './frame-read.mjs';
|
|
@@ -28,6 +27,7 @@ import {
|
|
|
28
27
|
owned,
|
|
29
28
|
parseURL,
|
|
30
29
|
refusalError,
|
|
30
|
+
removedStepReason,
|
|
31
31
|
summary as report,
|
|
32
32
|
result,
|
|
33
33
|
skipReason,
|
|
@@ -1181,7 +1181,6 @@ class Execution {
|
|
|
1181
1181
|
'errorPage',
|
|
1182
1182
|
'closeProtectedShape',
|
|
1183
1183
|
'protectedParentIframes',
|
|
1184
|
-
'credentialExport',
|
|
1185
1184
|
'signInHold',
|
|
1186
1185
|
'cookiePlant',
|
|
1187
1186
|
'extensionWorld',
|
|
@@ -1196,7 +1195,6 @@ class Execution {
|
|
|
1196
1195
|
'errorPage',
|
|
1197
1196
|
'closeProtectedShape',
|
|
1198
1197
|
'protectedParentIframes',
|
|
1199
|
-
'credentialExport',
|
|
1200
1198
|
'signInHold',
|
|
1201
1199
|
'cookiePlant',
|
|
1202
1200
|
'redirectSecret',
|
|
@@ -1315,7 +1313,6 @@ class Execution {
|
|
|
1315
1313
|
step.errorPage ||
|
|
1316
1314
|
step.closeProtectedShape ||
|
|
1317
1315
|
step.protectedParentIframes ||
|
|
1318
|
-
step.credentialExport ||
|
|
1319
1316
|
step.signInHold ||
|
|
1320
1317
|
step.cookiePlant ||
|
|
1321
1318
|
step.spawnWorker ||
|
|
@@ -1471,7 +1468,6 @@ class Execution {
|
|
|
1471
1468
|
if (step.redirectSecret || step.errorPage) return this.originProbe(step, session);
|
|
1472
1469
|
if (step.closeProtectedShape) return this.runCloseProtectedShape(step);
|
|
1473
1470
|
if (step.protectedParentIframes) return this.runProtectedParentIframes(step);
|
|
1474
|
-
if (step.credentialExport) return this.runCredentialExport(step);
|
|
1475
1471
|
if (step.signInHold) return this.runSignInHold(step);
|
|
1476
1472
|
if (step.cookiePlant) return this.runCookiePlant(step);
|
|
1477
1473
|
if (step.spawnWorker) return this.spawnWorker(step);
|
|
@@ -1560,25 +1556,6 @@ class Execution {
|
|
|
1560
1556
|
return out;
|
|
1561
1557
|
}
|
|
1562
1558
|
|
|
1563
|
-
runCredentialExport(step) {
|
|
1564
|
-
return outcome(
|
|
1565
|
-
credentialExport({
|
|
1566
|
-
client: this.client,
|
|
1567
|
-
reader: this.reader,
|
|
1568
|
-
credentialOrigin: this.vars.idp ?? this.options.targets?.idp ?? this.vars.target,
|
|
1569
|
-
ordinary: this.vars.plain ?? this.vars.ordinary,
|
|
1570
|
-
tag: this.vars.tag,
|
|
1571
|
-
internalSessions: this.internalSessions,
|
|
1572
|
-
notes: this.notes,
|
|
1573
|
-
budget: this.bound(8000),
|
|
1574
|
-
refusalPrefix:
|
|
1575
|
-
this.options.credentialOrigins?.refusal ??
|
|
1576
|
-
this.options.catalog?.credentialOrigins?.refusal ??
|
|
1577
|
-
'slicc: refused:',
|
|
1578
|
-
})
|
|
1579
|
-
);
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
1559
|
async runSignInHold(step) {
|
|
1583
1560
|
const out = await outcome(
|
|
1584
1561
|
signInHold({
|
|
@@ -1608,14 +1585,12 @@ class Execution {
|
|
|
1608
1585
|
client: this.client,
|
|
1609
1586
|
reader: this.reader,
|
|
1610
1587
|
protectedOrigin: this.vars.protectedTarget,
|
|
1611
|
-
credentialOrigin: this.vars.idp ?? this.options.targets?.idp ?? this.vars.protectedTarget,
|
|
1612
1588
|
ordinary: this.vars.ordinary,
|
|
1613
1589
|
tag: this.vars.tag,
|
|
1614
1590
|
internalSessions: this.internalSessions,
|
|
1615
1591
|
notes: this.notes,
|
|
1616
1592
|
budget: this.bound(5000),
|
|
1617
1593
|
control: this.side === 'control',
|
|
1618
|
-
mode: step.cookiePlant,
|
|
1619
1594
|
fixtureLog: () => this.options.fixture.log(),
|
|
1620
1595
|
blockedMarkers: this.vector.blockedMarkers ?? [],
|
|
1621
1596
|
onlyPaths: this.options.cookiePlantOnlyPaths ?? null,
|
|
@@ -3007,7 +2982,6 @@ const needsObserver = (vector) =>
|
|
|
3007
2982
|
step.spawnWorker ||
|
|
3008
2983
|
step.closeProtectedShape ||
|
|
3009
2984
|
step.protectedParentIframes ||
|
|
3010
|
-
step.credentialExport ||
|
|
3011
2985
|
step.signInHold ||
|
|
3012
2986
|
step.cookiePlant ||
|
|
3013
2987
|
step.rawTarget
|
|
@@ -3273,6 +3247,8 @@ async function executeRow(job, opts, made, set, slot, index, flights) {
|
|
|
3273
3247
|
via: vector.control.via,
|
|
3274
3248
|
transportVariant: clients.transportVariant === true,
|
|
3275
3249
|
};
|
|
3250
|
+
const removed = removedStepReason(job.vector);
|
|
3251
|
+
if (removed) return skipRow(base, removed);
|
|
3276
3252
|
const unavailable = scoped.missing;
|
|
3277
3253
|
if (unavailable)
|
|
3278
3254
|
return {
|