@ai-ecoverse/slicc-browsers 1.55.0 → 1.56.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 +9 -8
- package/catalog.json +15 -0
- package/engine/engine-js.mjs +1 -1
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/engine-vectors.json +813 -14
- package/failed-read-document.mjs +331 -0
- package/guard-driver.mjs +2 -0
- package/guard-runner.mjs +111 -17
- package/guard-vectors.json +650 -23
- package/package.json +7 -3
- package/persistent-subscriptions.mjs +136 -0
- package/protected-error-page.mjs +106 -54
- package/protected-js.mjs +1 -1
- package/protected.mjs +1 -1
- package/schema/catalog.schema.json +7 -1
- package/schema/engine-vectors.schema.json +4 -0
- package/schema/guard-vectors.schema.json +26 -0
- package/sealed-attach.mjs +406 -0
- package/sealed-event-rules.mjs +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.0",
|
|
4
4
|
"description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -83,6 +83,9 @@
|
|
|
83
83
|
"redirect-fragments.mjs",
|
|
84
84
|
"observer-target.mjs",
|
|
85
85
|
"frame-read.mjs",
|
|
86
|
+
"failed-read-document.mjs",
|
|
87
|
+
"sealed-attach.mjs",
|
|
88
|
+
"persistent-subscriptions.mjs",
|
|
86
89
|
"bfcache-restore.mjs",
|
|
87
90
|
"close-protected-shape.mjs",
|
|
88
91
|
"protected-worker.mjs",
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
"validate": "node scripts/sealed-events.mjs --check && node scripts/validate.mjs",
|
|
99
102
|
"lint": "export PATH=\"$HOME/.cargo/bin:$PATH\" && if [ \"$(uname -s)\" = Darwin ]; then echo 'Skipping byte comparison on macOS; Linux CI owns the wasm bytes.'; else artifacts='engine/engine.wasm engine/engine-wasm.mjs protected.mjs engine/engine-js.mjs protected-js.mjs' && git ls-files --error-unmatch $artifacts > /dev/null && npm run engine && git diff --exit-code -- $artifacts; fi && node scripts/protected-bundle.mjs --check && node scripts/engine-js.mjs --check && 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 --all --check && cargo clippy --workspace --locked --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features --locked && cargo check --target wasm32-wasip1 --features serde --locked && cargo check --target wasm32-wasip1 --all-features --locked",
|
|
100
103
|
"format": "biome check --write . && gofmt -w . && cargo fmt --all",
|
|
101
|
-
"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/protected-zones.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-ordinary-idp-cookies.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/engine.test.mjs test/integration/engine-js.test.mjs test/integration/engine-view-capture-chrome.test.mjs test/integration/engine-page.test.mjs test/integration/workflows.test.mjs test/integration/bb-env-setup.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-cookie-plant-attach-retry.test.mjs test/integration/guard-cookie-plant-open-commit.test.mjs test/integration/guard-cookie-plant-legacy-setup.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-error-page-enable.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-bfcache-ownership-probe.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-key.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-raw-cdp.test.mjs test/integration/guard-error-legs.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-preview.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 test/integration/guard-control-probe-failure.test.mjs test/integration/guard-kept-origins.test.mjs",
|
|
104
|
+
"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/protected-zones.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-sealed-payloads.test.mjs test/integration/guard-sealed-attach.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-ordinary-idp-cookies.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/engine.test.mjs test/integration/engine-js.test.mjs test/integration/engine-view-capture-chrome.test.mjs test/integration/engine-page.test.mjs test/integration/workflows.test.mjs test/integration/bb-env-setup.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-cookie-plant-attach-retry.test.mjs test/integration/guard-cookie-plant-open-commit.test.mjs test/integration/guard-cookie-plant-legacy-setup.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-error-page-enable.test.mjs test/integration/guard-discovery.test.mjs test/integration/guard-bfcache-chrome.test.mjs test/integration/guard-bfcache-ownership-probe.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-key.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-raw-cdp.test.mjs test/integration/guard-error-legs.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-preview.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 test/integration/guard-control-probe-failure.test.mjs test/integration/guard-kept-origins.test.mjs",
|
|
102
105
|
"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 ./...",
|
|
103
106
|
"build": "export PATH=\"$HOME/.cargo/bin:$PATH\" && go build ./... && cargo build --locked --all-features && cargo build --locked --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
104
107
|
"prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
|
|
@@ -106,7 +109,7 @@
|
|
|
106
109
|
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
|
|
107
110
|
"release": "semantic-release",
|
|
108
111
|
"test:unit:redirect": "mkdir -p coverage/unit && node --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=redirect-secret.mjs --test-coverage-include=redirect-fragments.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/redirect.lcov test/unit/guard-redirect-*.test.mjs && slicc-diff-cover coverage/unit/redirect.lcov",
|
|
109
|
-
"test:unit:guard": "mkdir -p coverage/unit && node --experimental-vm-modules --no-warnings --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=guard-runner.mjs --test-coverage-include=guard-driver.mjs --test-coverage-include=extension-frame.mjs --test-coverage-include=fixture-server.mjs --test-coverage-include=fixture-client.mjs --test-coverage-include=observer-target.mjs --test-coverage-include=frame-read.mjs --test-coverage-include=bfcache-restore.mjs --test-coverage-include=protected-error-page.mjs --test-coverage-include=protected-parent-iframes.mjs --test-coverage-include=unparseable-url.mjs --test-coverage-include=scripts/browser-runner.mjs --test-coverage-include=scripts/validate.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/guard.lcov test/unit/guard-*.test.mjs && slicc-diff-cover coverage/unit/guard.lcov"
|
|
112
|
+
"test:unit:guard": "mkdir -p coverage/unit && node --experimental-vm-modules --no-warnings --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=guard-runner.mjs --test-coverage-include=guard-driver.mjs --test-coverage-include=extension-frame.mjs --test-coverage-include=fixture-server.mjs --test-coverage-include=fixture-client.mjs --test-coverage-include=observer-target.mjs --test-coverage-include=frame-read.mjs --test-coverage-include=failed-read-document.mjs --test-coverage-include=sealed-attach.mjs --test-coverage-include=persistent-subscriptions.mjs --test-coverage-include=bfcache-restore.mjs --test-coverage-include=protected-error-page.mjs --test-coverage-include=protected-parent-iframes.mjs --test-coverage-include=unparseable-url.mjs --test-coverage-include=scripts/browser-runner.mjs --test-coverage-include=scripts/validate.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/guard.lcov test/unit/guard-*.test.mjs && slicc-diff-cover coverage/unit/guard.lcov"
|
|
110
113
|
},
|
|
111
114
|
"devDependencies": {
|
|
112
115
|
"@ai-ecoverse/slicc-cdp": "2.9.1",
|
|
@@ -117,6 +120,7 @@
|
|
|
117
120
|
"binaryen": "132.0.0",
|
|
118
121
|
"esbuild": "0.28.2",
|
|
119
122
|
"lefthook": "2.2.3",
|
|
123
|
+
"puppeteer-core": "26.0.0",
|
|
120
124
|
"semantic-release": "26.0.1"
|
|
121
125
|
}
|
|
122
126
|
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { outcome, waitFor } from './guard-driver.mjs';
|
|
2
|
+
|
|
3
|
+
const domains = new Set(['Debugger', 'Console', 'Overlay', 'LayerTree', 'Animation', 'Media']);
|
|
4
|
+
export const sealedBinding = Object.freeze({
|
|
5
|
+
name: 'sliccSealedWitness',
|
|
6
|
+
executionContextName: 'slicc-sealed-subscription',
|
|
7
|
+
});
|
|
8
|
+
export const persistentEvent = (method) =>
|
|
9
|
+
domains.has(method.split('.')[0]) || method === 'Runtime.bindingCalled';
|
|
10
|
+
export const persistentCommands = (session, frameId) => [
|
|
11
|
+
...[...domains].map((d) => [d + '.enable', {}, session]),
|
|
12
|
+
['Page.createIsolatedWorld', { frameId, worldName: sealedBinding.executionContextName }, session],
|
|
13
|
+
['Runtime.addBinding', sealedBinding, session],
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export async function checkPersistentDeclaration(client, reader, budget = 5000) {
|
|
17
|
+
const { targetId } = await reader.send('Target.createTarget', {
|
|
18
|
+
url: 'about:blank',
|
|
19
|
+
newWindow: true,
|
|
20
|
+
background: true,
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
const { sessionId } = await client.send('Target.attachToTarget', { targetId, flatten: true });
|
|
24
|
+
await client.send('Page.enable', {}, sessionId);
|
|
25
|
+
const doc = 'data:text/html,%3Ctitle%3Esubscription-check%3C%2Ftitle%3E';
|
|
26
|
+
const landed = await client.send('Page.navigate', { url: doc }, sessionId);
|
|
27
|
+
if (
|
|
28
|
+
landed.errorText ||
|
|
29
|
+
!(await waitFor(
|
|
30
|
+
async () =>
|
|
31
|
+
(await client.send('Page.getFrameTree', {}, sessionId)).frameTree.frame.url === doc,
|
|
32
|
+
budget
|
|
33
|
+
))
|
|
34
|
+
)
|
|
35
|
+
return 'persistentSubscriptions self-check did not reach an ordinary document';
|
|
36
|
+
for (const domain of ['Runtime', 'DOM']) await client.send(domain + '.enable', {}, sessionId);
|
|
37
|
+
for (const domain of domains) {
|
|
38
|
+
const method = domain + '.enable';
|
|
39
|
+
const attempt = await outcome(client.send(method, {}, sessionId));
|
|
40
|
+
if (attempt.ok)
|
|
41
|
+
return `undeclared persistentSubscriptions admits ${method} on an ordinary document`;
|
|
42
|
+
if (!/^slicc: refused:/.test(attempt.error.message))
|
|
43
|
+
return `${method} failed without a policy refusal during persistentSubscriptions self-check`;
|
|
44
|
+
}
|
|
45
|
+
const frame = (await client.send('Page.getFrameTree', {}, sessionId)).frameTree.frame;
|
|
46
|
+
const world = await outcome(
|
|
47
|
+
client.send(
|
|
48
|
+
'Page.createIsolatedWorld',
|
|
49
|
+
{ frameId: frame.id, worldName: sealedBinding.executionContextName },
|
|
50
|
+
sessionId
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
if (world.ok) {
|
|
54
|
+
const bound = await outcome(client.send('Runtime.addBinding', sealedBinding, sessionId));
|
|
55
|
+
if (bound.ok)
|
|
56
|
+
return 'undeclared persistentSubscriptions admits Runtime.addBinding on an ordinary document';
|
|
57
|
+
if (!/^slicc: refused:/.test(bound.error.message))
|
|
58
|
+
return 'Runtime.addBinding failed without a policy refusal during persistentSubscriptions self-check';
|
|
59
|
+
} else if (!/^slicc: refused:/.test(world.error.message))
|
|
60
|
+
return 'isolated world failed during persistentSubscriptions self-check';
|
|
61
|
+
return '';
|
|
62
|
+
} finally {
|
|
63
|
+
await outcome(reader.send('Target.closeTarget', { targetId }));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function armPersistent(client, session, frameId) {
|
|
68
|
+
const commands = [
|
|
69
|
+
['Runtime.enable', {}, session],
|
|
70
|
+
['DOM.enable', {}, session],
|
|
71
|
+
...persistentCommands(session, frameId),
|
|
72
|
+
];
|
|
73
|
+
for (const [method, ...args] of commands) {
|
|
74
|
+
const reply = await outcome(client.send(method, ...args));
|
|
75
|
+
if (!reply.ok) throw new Error(`${method} failed: ${reply.error.message}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function persistentWitness({
|
|
80
|
+
reader,
|
|
81
|
+
observer,
|
|
82
|
+
witness,
|
|
83
|
+
session,
|
|
84
|
+
frameId,
|
|
85
|
+
marker,
|
|
86
|
+
until,
|
|
87
|
+
}) {
|
|
88
|
+
await reader.send('Runtime.enable', {}, observer);
|
|
89
|
+
if (witness === reader && session === observer) {
|
|
90
|
+
for (const domain of ['Debugger', 'Console'])
|
|
91
|
+
await reader.send(domain + '.enable', {}, observer);
|
|
92
|
+
await reader.send('Runtime.addBinding', sealedBinding, observer);
|
|
93
|
+
}
|
|
94
|
+
const start = witness.events.length;
|
|
95
|
+
const { executionContextId } = await reader.send(
|
|
96
|
+
'Page.createIsolatedWorld',
|
|
97
|
+
{ frameId, worldName: sealedBinding.executionContextName },
|
|
98
|
+
observer
|
|
99
|
+
);
|
|
100
|
+
await reader.send(
|
|
101
|
+
'Runtime.compileScript',
|
|
102
|
+
{
|
|
103
|
+
executionContextId,
|
|
104
|
+
expression: 'void 0',
|
|
105
|
+
sourceURL: `sealed-witness:${marker}`,
|
|
106
|
+
persistScript: true,
|
|
107
|
+
},
|
|
108
|
+
observer
|
|
109
|
+
);
|
|
110
|
+
await reader.send(
|
|
111
|
+
'Runtime.evaluate',
|
|
112
|
+
{
|
|
113
|
+
contextId: executionContextId,
|
|
114
|
+
expression: `globalThis.${sealedBinding.name}?.('${marker}')`,
|
|
115
|
+
},
|
|
116
|
+
observer
|
|
117
|
+
);
|
|
118
|
+
await reader.send('Runtime.evaluate', { expression: `console.log('${marker}')` }, observer);
|
|
119
|
+
const expected = [
|
|
120
|
+
['Debugger.scriptParsed', (p) => p.url === `sealed-witness:${marker}`],
|
|
121
|
+
['Runtime.bindingCalled', (p) => p.name === sealedBinding.name && p.payload === marker],
|
|
122
|
+
['Console.messageAdded', (p) => p.message?.text === marker],
|
|
123
|
+
];
|
|
124
|
+
const absent = () =>
|
|
125
|
+
expected
|
|
126
|
+
.filter(
|
|
127
|
+
([method, match]) =>
|
|
128
|
+
!witness.events
|
|
129
|
+
.slice(start)
|
|
130
|
+
.some((e) => e.sessionId === session && e.method === method && match(e.params))
|
|
131
|
+
)
|
|
132
|
+
.map(([method]) => method);
|
|
133
|
+
return (await until(() => !absent().length))
|
|
134
|
+
? ''
|
|
135
|
+
: `sealed event witness did not receive ${absent().join(', ')}`;
|
|
136
|
+
}
|
package/protected-error-page.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { protectedRefusal } from './extension-frame.mjs';
|
|
2
2
|
import { outcome, parseURL, waitFor } from './guard-driver.mjs';
|
|
3
3
|
import { createObserverTarget } from './observer-target.mjs';
|
|
4
|
+
import {
|
|
5
|
+
sealedBinding as binding,
|
|
6
|
+
persistentCommands,
|
|
7
|
+
persistentEvent,
|
|
8
|
+
persistentWitness,
|
|
9
|
+
} from './persistent-subscriptions.mjs';
|
|
4
10
|
import { sealedContentEvent, sealedEventDomains } from './sealed-events.mjs';
|
|
5
11
|
|
|
6
12
|
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -25,25 +31,34 @@ const bounded = (error) =>
|
|
|
25
31
|
.replace(/([\w.-]+)=[^\s;,]+/g, '$1=<value>')
|
|
26
32
|
.slice(0, 200);
|
|
27
33
|
|
|
28
|
-
const binding = { name: 'sliccSealedWitness', executionContextName: 'slicc-sealed-subscription' };
|
|
29
34
|
const ordinarySeed = 'data:text/html,%3Ctitle%3Eordinary%3C%2Ftitle%3E';
|
|
30
35
|
|
|
31
36
|
const subscriptions = [...new Set(['Page', ...sealedEventDomains, 'Network'])];
|
|
32
|
-
const enables = (session, discovery, frameId) => [
|
|
33
|
-
...subscriptions
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
const enables = (session, discovery, frameId, persistent) => [
|
|
38
|
+
...subscriptions
|
|
39
|
+
.filter((domain) => !persistentEvent(domain + '.enable'))
|
|
40
|
+
.map((domain) => [domain + '.enable', {}, session]),
|
|
41
|
+
...(persistent ? persistentCommands(session, frameId) : []),
|
|
36
42
|
...(discovery ? [['Target.setDiscoverTargets', { discover: true }]] : []),
|
|
37
43
|
];
|
|
38
44
|
|
|
39
45
|
const notLive = (result, liveWhy) => ({ ...result, live: false, attached: false, liveWhy });
|
|
40
46
|
|
|
41
|
-
async function attachClient({
|
|
47
|
+
async function attachClient({
|
|
48
|
+
client,
|
|
49
|
+
targetId,
|
|
50
|
+
frame,
|
|
51
|
+
discovery,
|
|
52
|
+
persistent,
|
|
53
|
+
side,
|
|
54
|
+
result,
|
|
55
|
+
missing,
|
|
56
|
+
}) {
|
|
42
57
|
const attached = await outcome(client.send('Target.attachToTarget', { targetId, flatten: true }));
|
|
43
58
|
const session = attached.result?.sessionId;
|
|
44
59
|
result.diagnostics = { clientAttach: attachOutcome(attached) };
|
|
45
60
|
if (!session) return { stop: notLive(result, attachWhy(result.diagnostics.clientAttach)) };
|
|
46
|
-
for (const [method, ...args] of enables(session, discovery, (await frame()).id)) {
|
|
61
|
+
for (const [method, ...args] of enables(session, discovery, (await frame()).id, persistent)) {
|
|
47
62
|
const out = await outcome(client.send(method, ...args));
|
|
48
63
|
if (out.ok) continue;
|
|
49
64
|
if (!protectedRefusal(out))
|
|
@@ -228,6 +243,7 @@ function eventsRedacted({ events, targetId, start, ...failure }) {
|
|
|
228
243
|
|
|
229
244
|
const stimulus = (marker) => `(() => {
|
|
230
245
|
document.title = '${marker}';
|
|
246
|
+
const button = document.createElement('button'); button.id = '${marker}'; button.textContent = 'AX preparation'; document.body.append(button);
|
|
231
247
|
console.log('${marker}');
|
|
232
248
|
reportError(new Error('${marker}'));
|
|
233
249
|
const style = document.createElement('style');
|
|
@@ -247,9 +263,7 @@ const contentWithheld = (client, session, start) =>
|
|
|
247
263
|
|
|
248
264
|
function missingWitness(events, marker) {
|
|
249
265
|
const required = [
|
|
250
|
-
['Debugger.scriptParsed', (p) => p.url === `sealed-witness:${marker}`],
|
|
251
266
|
['Runtime.executionContextCreated', (p) => p.context.name === binding.executionContextName],
|
|
252
|
-
['Runtime.bindingCalled', (p) => p.name === binding.name && p.payload === marker],
|
|
253
267
|
['Accessibility.nodesUpdated', (p) => p.nodes.some((node) => node.name?.value === marker)],
|
|
254
268
|
['Runtime.consoleAPICalled', (p) => p.args.some((arg) => arg.value === marker)],
|
|
255
269
|
['Runtime.exceptionThrown', (p) => p.exceptionDetails.exception?.description?.includes(marker)],
|
|
@@ -260,7 +274,19 @@ function missingWitness(events, marker) {
|
|
|
260
274
|
.map(([method]) => method);
|
|
261
275
|
}
|
|
262
276
|
|
|
263
|
-
async function preEnabledEvents({
|
|
277
|
+
async function preEnabledEvents({
|
|
278
|
+
client,
|
|
279
|
+
session,
|
|
280
|
+
reader,
|
|
281
|
+
observer,
|
|
282
|
+
frame,
|
|
283
|
+
start,
|
|
284
|
+
side,
|
|
285
|
+
until,
|
|
286
|
+
persistent,
|
|
287
|
+
fragment,
|
|
288
|
+
notes,
|
|
289
|
+
}) {
|
|
264
290
|
const marker = `slicc-sealed-event-witness-${frame.loaderId.replace(/[^a-z0-9-]/gi, '').toLowerCase()}`;
|
|
265
291
|
const observedCommit = client.events.length;
|
|
266
292
|
const commit = client.events.findIndex(
|
|
@@ -277,48 +303,66 @@ async function preEnabledEvents({ client, session, reader, observer, frame, star
|
|
|
277
303
|
await reader.send('Runtime.enable', {}, observer);
|
|
278
304
|
if (side !== 'control') {
|
|
279
305
|
await reader.send('Log.enable', {}, observer);
|
|
280
|
-
await reader.send('Debugger.enable', {}, observer);
|
|
281
306
|
await reader.send('Accessibility.enable', {}, observer);
|
|
282
|
-
await reader.send('Runtime.addBinding', binding, observer);
|
|
283
307
|
}
|
|
284
308
|
await witness.send('Accessibility.getRootAXNode', { frameId: frame.id }, witnessSession);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
309
|
+
if (persistent) {
|
|
310
|
+
const missing = await persistentWitness({
|
|
311
|
+
reader,
|
|
312
|
+
observer,
|
|
313
|
+
witness,
|
|
314
|
+
session: witnessSession,
|
|
315
|
+
frameId: frame.id,
|
|
316
|
+
marker,
|
|
317
|
+
until,
|
|
318
|
+
});
|
|
319
|
+
if (missing) return { missing };
|
|
320
|
+
} else
|
|
321
|
+
await reader.send(
|
|
322
|
+
'Page.createIsolatedWorld',
|
|
323
|
+
{ frameId: frame.id, worldName: binding.executionContextName },
|
|
324
|
+
observer
|
|
325
|
+
);
|
|
326
|
+
const measured = await reader.send(
|
|
327
|
+
'Runtime.evaluate',
|
|
328
|
+
{ expression: stimulus(marker), returnByValue: true },
|
|
298
329
|
observer
|
|
299
330
|
);
|
|
300
|
-
|
|
331
|
+
if (measured.result?.value !== marker) return { missing: 'sealed event stimulus did not run' };
|
|
332
|
+
const button = await witness.send(
|
|
301
333
|
'Runtime.evaluate',
|
|
302
|
-
{
|
|
303
|
-
|
|
304
|
-
expression: `globalThis.${binding.name}?.('${marker}')`,
|
|
305
|
-
},
|
|
306
|
-
observer
|
|
334
|
+
{ expression: `document.getElementById('${marker}')` },
|
|
335
|
+
witnessSession
|
|
307
336
|
);
|
|
308
|
-
|
|
337
|
+
if (button.result?.objectId)
|
|
338
|
+
await witness.send(
|
|
339
|
+
'Accessibility.getAXNodeAndAncestors',
|
|
340
|
+
{ objectId: button.result.objectId },
|
|
341
|
+
witnessSession
|
|
342
|
+
);
|
|
343
|
+
await reader.send(
|
|
309
344
|
'Runtime.evaluate',
|
|
310
|
-
{ expression:
|
|
345
|
+
{ expression: `document.getElementById('${marker}').setAttribute('aria-label','${marker}')` },
|
|
311
346
|
observer
|
|
312
347
|
);
|
|
313
|
-
if (measured.result?.value !== marker) return { missing: 'sealed event stimulus did not run' };
|
|
314
348
|
const absent = () =>
|
|
315
349
|
missingWitness(
|
|
316
350
|
witness.events.slice(beforeProbe).filter((e) => e.sessionId === witnessSession),
|
|
317
351
|
marker
|
|
318
352
|
);
|
|
319
|
-
if (!(await until(() => !absent().length)))
|
|
320
|
-
|
|
321
|
-
|
|
353
|
+
if (!(await until(() => !absent().length))) {
|
|
354
|
+
const missing = absent();
|
|
355
|
+
if (fragment && missing.length === 1 && missing[0] === 'Accessibility.nodesUpdated')
|
|
356
|
+
notes.push(
|
|
357
|
+
'preEnabledEventsWithheld: Accessibility.nodesUpdated not witnessed after fragment commit'
|
|
358
|
+
);
|
|
359
|
+
else return { missing: `sealed event witness did not receive ${missing.join(', ')}` };
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
withheld: () => contentWithheld(client, session, since),
|
|
363
|
+
persistentWithheld: () =>
|
|
364
|
+
!client.events.slice(since).some((e) => e.sessionId === session && persistentEvent(e.method)),
|
|
365
|
+
};
|
|
322
366
|
}
|
|
323
367
|
|
|
324
368
|
async function reloadEventsRedacted(client, session, start, failedURL, tag, requireLeak, until) {
|
|
@@ -547,6 +591,14 @@ const secrets = {
|
|
|
547
591
|
fragment: (tag) => `/doc#fragment-secret-${tag}`,
|
|
548
592
|
};
|
|
549
593
|
|
|
594
|
+
function recordEvents(result, measured, persistent) {
|
|
595
|
+
result.preEnabledEventsWithheld =
|
|
596
|
+
measured.withheld() && (result.preEnabledEventsWithheld ?? true);
|
|
597
|
+
if (persistent)
|
|
598
|
+
result.persistentEventsWithheld =
|
|
599
|
+
measured.persistentWithheld() && (result.persistentEventsWithheld ?? true);
|
|
600
|
+
}
|
|
601
|
+
|
|
550
602
|
export async function protectedErrorPage({
|
|
551
603
|
client,
|
|
552
604
|
reader,
|
|
@@ -558,6 +610,7 @@ export async function protectedErrorPage({
|
|
|
558
610
|
internalSessions = new Set(),
|
|
559
611
|
secret = 'all',
|
|
560
612
|
discovery = true,
|
|
613
|
+
persistent = false,
|
|
561
614
|
notes = [],
|
|
562
615
|
budget = 5000,
|
|
563
616
|
}) {
|
|
@@ -593,7 +646,8 @@ export async function protectedErrorPage({
|
|
|
593
646
|
try {
|
|
594
647
|
const unseeded = await seed(reader, observer, loaded, initial, ordinarySeed);
|
|
595
648
|
if (unseeded) return missing(unseeded);
|
|
596
|
-
const
|
|
649
|
+
const setup = { client, targetId, frame, discovery, persistent, side, result, missing };
|
|
650
|
+
const ready = await attachClient(setup);
|
|
597
651
|
if (ready.stop) return ready.stop;
|
|
598
652
|
session = ready.session;
|
|
599
653
|
if (side === 'control') {
|
|
@@ -631,28 +685,26 @@ export async function protectedErrorPage({
|
|
|
631
685
|
return missing(`missing error commit ${JSON.stringify(evidence)}`);
|
|
632
686
|
result.live = live;
|
|
633
687
|
if (!live) return { ...result, liveWhy: commitWhy(result.diagnostics.errorCommit) };
|
|
688
|
+
const measurement = {
|
|
689
|
+
client,
|
|
690
|
+
session,
|
|
691
|
+
reader,
|
|
692
|
+
side,
|
|
693
|
+
until,
|
|
694
|
+
persistent,
|
|
695
|
+
fragment: mode === 'sticky' && secret === 'fragment',
|
|
696
|
+
notes,
|
|
697
|
+
};
|
|
634
698
|
const measureEvents = (frame, start) =>
|
|
635
|
-
preEnabledEvents({
|
|
699
|
+
preEnabledEvents({ ...measurement, observer, frame, start });
|
|
636
700
|
const sealedStart = client.events.length;
|
|
637
701
|
const first = await measureEvents(evidence.frame, start);
|
|
638
702
|
if (first.missing) return missing(first.missing);
|
|
639
703
|
await contentChecks(client, session, failedURL, tag, result);
|
|
640
704
|
const metadata = { client, targetId, failedURL, ordinary, tag, start, result, discovery };
|
|
641
705
|
await redaction({ ...metadata, sealedStart });
|
|
642
|
-
result
|
|
643
|
-
await reloadChecks({
|
|
644
|
-
client,
|
|
645
|
-
session,
|
|
646
|
-
reader,
|
|
647
|
-
observer,
|
|
648
|
-
targetId,
|
|
649
|
-
frame,
|
|
650
|
-
failedURL,
|
|
651
|
-
tag,
|
|
652
|
-
result,
|
|
653
|
-
side,
|
|
654
|
-
until,
|
|
655
|
-
});
|
|
706
|
+
recordEvents(result, first, persistent);
|
|
707
|
+
await reloadChecks({ ...measurement, ...metadata, observer, frame });
|
|
656
708
|
if (result.pageEventsRedacted === 'incomplete')
|
|
657
709
|
return missing('no raw Page or Network URL witness');
|
|
658
710
|
const recovery = `${ordinary}/blank?n=${tag}-recover`;
|
|
@@ -714,7 +766,7 @@ export async function protectedErrorPage({
|
|
|
714
766
|
const sticky = await measureEvents(await frame(), stickyStart);
|
|
715
767
|
if (sticky.missing) return missing(sticky.missing);
|
|
716
768
|
await pause(100);
|
|
717
|
-
result
|
|
769
|
+
recordEvents(result, sticky, persistent);
|
|
718
770
|
}
|
|
719
771
|
await lockChecks({ client, reader, session, targetId, result, until });
|
|
720
772
|
return result;
|