@ai-ecoverse/slicc-browsers 1.13.4 → 1.13.5
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/guard-driver.mjs +96 -2
- package/guard-runner.mjs +2 -15
- package/guard-vectors.json +1 -1
- package/package.json +2 -2
- package/redirect-secret.mjs +3 -2
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ The `C9` foreign extension isolated-world family requires `extensionWorld`: a br
|
|
|
190
190
|
|
|
191
191
|
The integration launcher loads shared-web 1.25.2’s harness extension exactly once through `Extensions.loadUnpacked` (`ankmbodmgimjemnojmeddfcdlbocolob`), whose content script runs on HTTP(S) pages. shared-web 1.25.2 also loads it by default in its own harness. A transport unable to host a foreign content-script extension omits `extensionWorld` and reports `not-supported:extensionWorld`; an advertised capability with no observed world fails, rather than silently skipping.
|
|
192
192
|
|
|
193
|
-
`C2.redirect-secret` probes ordinary fixture 302s to seven’s `/auth/callback?code=…&state=…` and vault’s `/oauth/mcp-callback?code=…`, plus `#access_token=…` variants of both. It navigates with Page and scripted `location.href`, fetches a subresource and sends an XHR. The 302 carries `Location`, `Content-Location`, `Refresh: 0;url=…` and `Link: <…>; rel=preconnect`. Page, Network (including ExtraInfo), Runtime, Log, Audits and both Fetch stages are enabled. Every received raw message is scanned, including replies but not the probe’s own observer session traffic, across an eight-second tail, for raw, percent-encoded, JSON-escaped and base64 marker representations. Both response-body APIs are attempted on each hop; guarded bodies need matched refusals. `Network.getResponseBody` is attempted, once per id, with every network id the client learns for a 301–308 hop: the `requestId` of a Network event carrying the redirect status and the `networkId` of the Fetch response-stage pause. For each registered hop whose id the client learned neither way, the probe reads the hop’s real id from the harness’s own unguarded tap (the observer session, which enables Network on the guarded leg) and attempts the read on the guarded session with it. The evidence’s `networkBodyCarriers` counts the ids per carrier, and `networkBodyPath` names the weakest carrier any id needed: `withheld+tap`, then `fetch-networkId`, then `network`, or `none` without any id. These reads never hold up a Fetch pause, and the probe gives them five seconds after `Fetch.disable` to settle. A read still unanswered then is not a refusal. `networkBodyAttempted` and `networkBodyRefused` hold only when every attempt is refused. On the guarded leg a `fetch-networkId` or `withheld+tap` carrier also needs the same row’s unguarded control to have seen the redirect’s Network events. Without that proof, or with no id at all, both read `incomplete` and the probe returns `redirect-secret: network body leg <reason>`; an attempt that is not refused is measured and fails. Every
|
|
193
|
+
`C2.redirect-secret` probes ordinary fixture 302s to seven’s `/auth/callback?code=…&state=…` and vault’s `/oauth/mcp-callback?code=…`, plus `#access_token=…` variants of both. It navigates with Page and scripted `location.href`, fetches a subresource and sends an XHR. The 302 carries `Location`, `Content-Location`, `Refresh: 0;url=…` and `Link: <…>; rel=preconnect`. Page, Network (including ExtraInfo), Runtime, Log, Audits and both Fetch stages are enabled. Every received raw message is scanned, including replies but not the probe’s own observer session traffic, across an eight-second tail, for raw, percent-encoded, JSON-escaped and base64 marker representations. Both response-body APIs are attempted on each hop; guarded bodies need matched refusals. `Network.getResponseBody` is attempted, once per id, with every network id the client learns for a 301–308 hop: the `requestId` of a Network event carrying the redirect status and the `networkId` of the Fetch response-stage pause. For each registered hop whose id the client learned neither way, the probe reads the hop’s real id from the harness’s own unguarded tap (the observer session, which enables Network on the guarded leg) and attempts the read on the guarded session with it. The evidence’s `networkBodyCarriers` counts the ids per carrier, and `networkBodyPath` names the weakest carrier any id needed: `withheld+tap`, then `fetch-networkId`, then `network`, or `none` without any id. These reads never hold up a Fetch pause, and the probe gives them five seconds after `Fetch.disable` to settle. A read still unanswered then is not a refusal. `networkBodyAttempted` and `networkBodyRefused` hold only when every attempt is refused. On the guarded leg a `fetch-networkId` or `withheld+tap` carrier also needs the same row’s unguarded control to have seen the redirect’s Network events. Without that proof, or with no id at all, both read `incomplete` and the probe returns `redirect-secret: network body leg <reason>`; an attempt that is not refused is measured and fails. Every request the client sees for a registered redirect URL, through its initial `Network.requestWillBeSent` or a redirect `requestWillBeSent` whose `redirectResponse.url` is that URL, must end within the step in a redirect `requestWillBeSent`, `loadingFinished` or `loadingFailed` for that `requestId`. The evidence’s `hops` records per `requestId` the `delivery` (`redacted` for an origin-only protected redirect in place, `withheld` for a terminal without the redirect, `ordinary`, `raw` or `unterminated`) and the `terminal` event method. `requestsTerminated` is false on any `unterminated` request, a measured guard failure rather than missing evidence; `hopsRedacted` is false on any `raw` or `ordinary` hop, so a delivered protected hop must be origin-only, never the raw or a substituted URL; the guarded leg expects it. Page frame trees, resource trees and navigation history are read before recovery to catch error-page leftovers. A separate structural check requires every protected `Network.Request.urlFragment` and `Page.Frame.urlFragment` to be empty or absent, even if its value contains no marker; the ordinary `#access_token` control independently requires fragment evidence in request events, frame events, frame-tree replies and resource-tree replies. The ordinary session must survive. The unguarded ordinary redirect control preserves all four headers in `redirectResponse`, ExtraInfo’s headers and `headersText`, and Fetch’s response headers. `C2.redirect-secret-mix` repeats that matrix with 301/303/307/308. The protected leg requires in-place ExtraInfo delivery with origin-only header values, not merely the absence of a marker.
|
|
194
194
|
|
|
195
195
|
`C2.redirect-body` calls `Network.loadNetworkResource` on an ordinary redirect with `includeCredentials: true`, reads any stream with `IO.read`, replays a redirected XHR, requests Page resource content, and captures Page/MHTML and DOM snapshots after a main-frame redirect. It also captures an ordinary parent containing an iframe redirected to vault, including its error document, and overrides a paused ordinary Fetch request to the allowed redirect URL. No protected marker may appear in any message or body, and no request from those operations may send the independently seeded seven cookie. The ordinary control must return the body, resource content and snapshots, and accept the URL override. Its network-body carrier, `networkBodyAttempted`, `networkBodyRefused`, `hops`, `requestsTerminated` and `hopsRedacted` follow `C2.redirect-secret`. Each probe cleans up its redirect registrations, observer session and cookie. The focused Chrome tests use HTTPS with SPKI-pinned fixture trust and default-port protected URLs; host resolver rules route seven and vault to the fixture rather than the public service.
|
|
196
196
|
|
|
@@ -306,9 +306,10 @@ It exports:
|
|
|
306
306
|
- `waitFor(check, ms, step?)`: polls `check` every `step` ms (default 25) until it holds, checking once more after the bound. A timer heartbeat every `step` runs for the whole wait, including while `check` is awaiting a reply, and any gap between beats longer than a second (or four steps, if longer) extends the bound by that gap, so a synchronous event-loop stall elsewhere in the process does not consume it. The extensions add up to at most `max(4 × ms, 30000)` ms, so a throttled page cannot stretch a wait without limit. `load`, the runner's waits and the error-page and redirect-body probes use it;
|
|
307
307
|
- `judge(vector, side, observed)`: `{ pass, refused, skipped, mismatches }`, where `refused` lists the leg's refusals and `skipped` the observations that depend on them or explicitly record unavailable observation capabilities;
|
|
308
308
|
- `result(vector, run)`: a report row from `{ target, variant, transport, via?, capabilities?, control, guarded, live }`. `capabilities` is the transport's; without it, the transport has them all;
|
|
309
|
+
- `knownOrigins` and `originDefaults`: the origin names a runner can miss, and the origins `plain`, `cross`, `log` and `own` fall back to when unset;
|
|
309
310
|
- `parseURL(value, base?)`: a `URL`, or `null` for anything `new URL` rejects or a non-string; every parse of a fixture log entry or a Chrome-reported URL in the runner and the fixture goes through it (`protected.mjs` keeps its own copy, since it imports nothing), so an unparseable entry never throws;
|
|
310
311
|
- `owned(entries, tag)`: the fixture log entries whose raw URL contains `tag`, the row's attribution through its `n=`, `tag=` or `to=` query;
|
|
311
|
-
- `summary({ guard, sha, set, results })`: `set` is the parsed `guard-vectors.json`. It returns `{ set, schemaVersion, guard, sha, variants, targets, transports, results, skipped, notRun, missing, pass, line }`. `missing` lists each `{ id, target, variant, transport }` without a row, for every vector whose `scope` is `any` or the guard, every target it lists, every variant in `variants` or `results`, and every transport in `results`; `pass` needs it empty, where `line` is `GUARD-PASS <guard>@<sha> (vectors @ai-ecoverse/slicc-browsers@X.Y.Z)` or `GUARD-FAIL …`.
|
|
312
|
+
- `summary({ guard, sha, set, results })`: `set` is the parsed `guard-vectors.json`. It returns `{ set, schemaVersion, guard, sha, variants, targets, transports, results, skipped, notRun, missing, forged, pass, line }`. `missing` lists each `{ id, target, variant, transport }` without a row, for every vector whose `scope` is `any` or the guard, every target it lists, every variant in `variants` or `results`, and every transport in `results`; `pass` needs it empty, where `line` is `GUARD-PASS <guard>@<sha> (vectors @ai-ecoverse/slicc-browsers@X.Y.Z)` or `GUARD-FAIL …`. `forged` lists each `{ id, target, variant, transport, why }` that is `not-run` on a vector that isn't `kind: "text"`, or `skip` without a reason the runner gives (`not-applicable`, `not-applicable:no-<origin>-origin` for an origin in `knownOrigins` that the row's target, `plain`, the control's origin, the steps or a check names, directly or through `originDefaults`, where only the first branch of an `any` counts, the vector's own `skip.reason` on its target, or `not-supported:<capability>` for a capability the set requires, `browserSession` or `unguarded-observer`); `pass` needs it empty too, and `line` then ends in `forged <n>`.
|
|
312
313
|
|
|
313
314
|
**`npm run validate`** checks that:
|
|
314
315
|
- the file matches the schema, and ids are unique;
|
package/guard-driver.mjs
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
const q = JSON.stringify;
|
|
2
2
|
|
|
3
|
+
export const originDefaults = {
|
|
4
|
+
plain: 'ordinary',
|
|
5
|
+
cross: 'client',
|
|
6
|
+
log: 'ordinary',
|
|
7
|
+
own: 'client',
|
|
8
|
+
};
|
|
9
|
+
export const knownOrigins = [
|
|
10
|
+
'ordinary',
|
|
11
|
+
'ordinary-same-site',
|
|
12
|
+
'seven',
|
|
13
|
+
'vault',
|
|
14
|
+
'vault-x',
|
|
15
|
+
'apex',
|
|
16
|
+
'own',
|
|
17
|
+
'client',
|
|
18
|
+
'plain',
|
|
19
|
+
'cross',
|
|
20
|
+
'log',
|
|
21
|
+
];
|
|
22
|
+
|
|
3
23
|
export const beacon = (log, tag) =>
|
|
4
24
|
`try { const u = ${q(log)} + '/beacon?tag=' + ${q(tag)} + '&origin=' + encodeURIComponent(location.origin); if (!navigator.sendBeacon(u)) fetch(u, { keepalive: true, mode: 'no-cors' }).catch(() => {}); } catch {}`;
|
|
5
25
|
|
|
@@ -276,6 +296,77 @@ const passed = (r) =>
|
|
|
276
296
|
[r.control, r.guarded, r.live].every((s) => s === 'skip') ||
|
|
277
297
|
[r.control, r.guarded, r.live].every((s) => s === 'not-run');
|
|
278
298
|
|
|
299
|
+
const capabilities = (value) =>
|
|
300
|
+
Array.isArray(value)
|
|
301
|
+
? value.flatMap(capabilities)
|
|
302
|
+
: value && typeof value === 'object'
|
|
303
|
+
? Object.entries(value).flatMap(([key, item]) =>
|
|
304
|
+
key === 'requires' && Array.isArray(item) ? item : capabilities(item)
|
|
305
|
+
)
|
|
306
|
+
: [];
|
|
307
|
+
|
|
308
|
+
const originNames = (value) =>
|
|
309
|
+
[...q(value ?? null).matchAll(/\{([A-Za-z][A-Za-z-]*)\}/g)]
|
|
310
|
+
.map((match) => (match[1] === 'beacon' || match[1] === 'probe' ? 'log' : match[1]))
|
|
311
|
+
.flatMap((name) => [name, originDefaults[name]]);
|
|
312
|
+
|
|
313
|
+
const checkOrigins = (check) => {
|
|
314
|
+
if (!check || typeof check !== 'object') return [];
|
|
315
|
+
if (check.any) return checkOrigins(check.any[0]);
|
|
316
|
+
if (check.all || check.not) return (check.all ?? [check.not]).flatMap(checkOrigins);
|
|
317
|
+
return originNames(check);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
function originReason(vector, row, reason) {
|
|
321
|
+
const origin = /^not-applicable:no-(.+)-origin$/.exec(reason)?.[1];
|
|
322
|
+
if (!knownOrigins.includes(origin)) return false;
|
|
323
|
+
const fixed = [
|
|
324
|
+
row.target,
|
|
325
|
+
'{plain}',
|
|
326
|
+
vector?.control?.origin,
|
|
327
|
+
vector?.setup,
|
|
328
|
+
vector?.trigger,
|
|
329
|
+
].map((value) => (typeof value === 'string' && !value.startsWith('{') ? `{${value}}` : value));
|
|
330
|
+
return [
|
|
331
|
+
...originNames(fixed),
|
|
332
|
+
...checkOrigins(vector?.liveCheck),
|
|
333
|
+
...Object.values(vector?.observe ?? {}).flatMap((observation) =>
|
|
334
|
+
checkOrigins(observation?.check)
|
|
335
|
+
),
|
|
336
|
+
].includes(origin);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function skipWhy(vector, row, known) {
|
|
340
|
+
const { reason } = row;
|
|
341
|
+
if (typeof reason !== 'string' || reason === '') return 'skip without a reason';
|
|
342
|
+
if (reason === 'not-applicable' || originReason(vector, row, reason)) return null;
|
|
343
|
+
if (vector?.skip?.target === row.target && vector.skip.reason === reason) return null;
|
|
344
|
+
if (reason.startsWith('not-supported:') && known.has(reason.slice('not-supported:'.length)))
|
|
345
|
+
return null;
|
|
346
|
+
return `skip with a reason the runner never gives: ${reason}`;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function forgeries(set, results) {
|
|
350
|
+
const vectors = new Map(set.vectors.map((v) => [v.id, v]));
|
|
351
|
+
const known = new Set([
|
|
352
|
+
'browserSession',
|
|
353
|
+
'unguarded-observer',
|
|
354
|
+
...capabilities(set.vectors).filter((c) => typeof c === 'string' && c !== ''),
|
|
355
|
+
]);
|
|
356
|
+
return results.flatMap((row) => {
|
|
357
|
+
const legs = [row.control, row.guarded, row.live];
|
|
358
|
+
const vector = vectors.get(row.id);
|
|
359
|
+
const why = [];
|
|
360
|
+
if (legs.includes('not-run') && vector?.kind !== 'text')
|
|
361
|
+
why.push('not-run on a vector that is not kind text');
|
|
362
|
+
if (legs.includes('skip')) why.push(skipWhy(vector, row, known));
|
|
363
|
+
const found = why.filter(Boolean);
|
|
364
|
+
if (!found.length) return [];
|
|
365
|
+
const { id, target, variant, transport } = row;
|
|
366
|
+
return [{ id, target, variant, transport, why: found.join('; ') }];
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
279
370
|
export function summary({ guard, sha, set, results }) {
|
|
280
371
|
const uniq = (k) => [...new Set(results.map((r) => r[k]))].sort();
|
|
281
372
|
const variants = [...new Set([...Object.keys(set.variants ?? {}), ...uniq('variant')])].sort();
|
|
@@ -286,7 +377,9 @@ export function summary({ guard, sha, set, results }) {
|
|
|
286
377
|
.flatMap((row) => variants.map((variant) => ({ ...row, variant })))
|
|
287
378
|
.flatMap((row) => uniq('transport').map((transport) => ({ ...row, transport })))
|
|
288
379
|
.filter((r) => !has.has(q([r.id, r.target, r.variant, r.transport])));
|
|
289
|
-
const
|
|
380
|
+
const forged = forgeries(set, results);
|
|
381
|
+
const pass =
|
|
382
|
+
results.length > 0 && missing.length === 0 && forged.length === 0 && results.every(passed);
|
|
290
383
|
const name = `@ai-ecoverse/slicc-browsers@${set.setVersion}`;
|
|
291
384
|
return {
|
|
292
385
|
set: name,
|
|
@@ -302,8 +395,9 @@ export function summary({ guard, sha, set, results }) {
|
|
|
302
395
|
.map(({ id, target, reason }) => ({ id, target, reason })),
|
|
303
396
|
notRun: [...new Set(results.filter((r) => r.control === 'not-run').map((r) => r.id))],
|
|
304
397
|
missing,
|
|
398
|
+
forged,
|
|
305
399
|
pass,
|
|
306
|
-
line: `${pass ? 'GUARD-PASS' : 'GUARD-FAIL'} ${guard}@${sha} (vectors ${name})`,
|
|
400
|
+
line: `${pass ? 'GUARD-PASS' : 'GUARD-FAIL'} ${guard}@${sha} (vectors ${name})${forged.length ? ` forged ${forged.length}` : ''}`,
|
|
307
401
|
};
|
|
308
402
|
}
|
|
309
403
|
|
package/guard-runner.mjs
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
expand,
|
|
10
10
|
hop,
|
|
11
11
|
isRefusal,
|
|
12
|
+
knownOrigins,
|
|
12
13
|
loadedAfter,
|
|
14
|
+
originDefaults,
|
|
13
15
|
outcome,
|
|
14
16
|
owned,
|
|
15
17
|
parseURL,
|
|
@@ -1302,21 +1304,6 @@ const browserContextStep = (vector, capabilities) =>
|
|
|
1302
1304
|
supported(['browserContexts'], capabilities))
|
|
1303
1305
|
);
|
|
1304
1306
|
|
|
1305
|
-
const originDefaults = { plain: 'ordinary', cross: 'client', log: 'ordinary', own: 'client' };
|
|
1306
|
-
const knownOrigins = [
|
|
1307
|
-
'ordinary',
|
|
1308
|
-
'ordinary-same-site',
|
|
1309
|
-
'seven',
|
|
1310
|
-
'vault',
|
|
1311
|
-
'vault-x',
|
|
1312
|
-
'apex',
|
|
1313
|
-
'own',
|
|
1314
|
-
'client',
|
|
1315
|
-
'plain',
|
|
1316
|
-
'cross',
|
|
1317
|
-
'log',
|
|
1318
|
-
];
|
|
1319
|
-
|
|
1320
1307
|
function nullOrigins(value, targets) {
|
|
1321
1308
|
return [...q(value).matchAll(/\{([A-Za-z][A-Za-z-]*)\}/g)]
|
|
1322
1309
|
.map((match) => (match[1] === 'beacon' || match[1] === 'probe' ? 'log' : match[1]))
|
package/guard-vectors.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.5",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"validate": "node scripts/validate.mjs",
|
|
67
67
|
"lint": "slicc-lint && test -z \"$(gofmt -l .)\" && go mod tidy -diff && go vet ./... && golangci-lint run && cargo fmt --check && cargo clippy --all-features --all-targets -- -D warnings",
|
|
68
68
|
"format": "biome check --write . && gofmt -w . && cargo fmt",
|
|
69
|
-
"test": "npm run validate && node --test test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/git-retry.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/dist-tag.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-stall.test.mjs && go test -race -count=1 ./test/integration/... && cargo test --all-features",
|
|
69
|
+
"test": "npm run validate && node --test test/integration/self-contained.test.mjs test/integration/browser-runner.test.mjs test/integration/fixture-client.test.mjs test/integration/git-retry.test.mjs test/integration/guard-redirect-carrier.test.mjs test/integration/dist-tag.test.mjs test/integration/guard-incomplete.test.mjs test/integration/guard-stall.test.mjs test/integration/guard-forged.test.mjs && go test -race -count=1 ./test/integration/... && cargo test --all-features",
|
|
70
70
|
"test:unit": "go test -race -cover ./...",
|
|
71
71
|
"build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
72
72
|
"trust": "npx fledgling sync -y --skip-publish",
|
package/redirect-secret.mjs
CHANGED
|
@@ -222,8 +222,9 @@ class RedirectProbe {
|
|
|
222
222
|
.filter(
|
|
223
223
|
(event) =>
|
|
224
224
|
event.method === 'Network.requestWillBeSent' &&
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
(event.params.redirectResponse
|
|
226
|
+
? event.params.redirectResponse.url?.startsWith(this.prefix)
|
|
227
|
+
: event.params.request?.url?.startsWith(this.prefix))
|
|
227
228
|
)
|
|
228
229
|
.map((event) => event.params.requestId)
|
|
229
230
|
);
|