@ai-ecoverse/slicc-browsers 1.52.0 → 1.53.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 +8 -6
- package/catalog.json +81 -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 +1611 -162
- package/engine.mjs +4 -22
- package/guard-vectors.json +650 -18
- package/package.json +7 -4
- package/protected-error-page.mjs +250 -28
- package/protected-js.mjs +1 -1
- package/protected.json +329 -11
- package/protected.mjs +1 -1
- package/schema/catalog.schema.json +28 -0
- package/schema/engine-vectors.schema.json +3 -1
- package/schema/protected.schema.json +3 -0
- package/sealed-event-rules.mjs +18 -0
- package/sealed-events.mjs +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.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",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
"extension-frame.mjs",
|
|
78
78
|
"unparseable-url.mjs",
|
|
79
79
|
"protected-error-page.mjs",
|
|
80
|
+
"sealed-events.mjs",
|
|
81
|
+
"sealed-event-rules.mjs",
|
|
80
82
|
"redirect-secret.mjs",
|
|
81
83
|
"redirect-fragments.mjs",
|
|
82
84
|
"observer-target.mjs",
|
|
@@ -91,11 +93,12 @@
|
|
|
91
93
|
"scripts": {
|
|
92
94
|
"prepare": "slicc-install-hooks",
|
|
93
95
|
"corpus": "node scripts/corpus.mjs",
|
|
96
|
+
"sealed-events": "node scripts/sealed-events.mjs",
|
|
94
97
|
"engine": "PATH=\"$HOME/.cargo/bin:$PATH\" node scripts/engine.mjs",
|
|
95
|
-
"validate": "node scripts/validate.mjs",
|
|
98
|
+
"validate": "node scripts/sealed-events.mjs --check && node scripts/validate.mjs",
|
|
96
99
|
"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",
|
|
97
100
|
"format": "biome check --write . && gofmt -w . && cargo fmt --all",
|
|
98
|
-
"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-page.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-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",
|
|
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-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",
|
|
99
102
|
"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 ./...",
|
|
100
103
|
"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",
|
|
101
104
|
"prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
|
|
@@ -107,7 +110,7 @@
|
|
|
107
110
|
},
|
|
108
111
|
"devDependencies": {
|
|
109
112
|
"@ai-ecoverse/slicc-cdp": "2.9.1",
|
|
110
|
-
"@ai-ecoverse/slicc-shared-web": "3.
|
|
113
|
+
"@ai-ecoverse/slicc-shared-web": "3.2.0",
|
|
111
114
|
"@biomejs/biome": "2.6.9",
|
|
112
115
|
"ajv": "8.20.0",
|
|
113
116
|
"ajv-formats": "3.0.1",
|
package/protected-error-page.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { sealedContentEvent, sealedEventDomains } from './sealed-events.mjs';
|
|
4
5
|
|
|
5
6
|
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
6
7
|
const refused = (out) => !out.ok && /^slicc: refused:/.test(out.error?.message ?? '');
|
|
@@ -24,20 +25,25 @@ const bounded = (error) =>
|
|
|
24
25
|
.replace(/([\w.-]+)=[^\s;,]+/g, '$1=<value>')
|
|
25
26
|
.slice(0, 200);
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const binding = { name: 'sliccSealedWitness', executionContextName: 'slicc-sealed-subscription' };
|
|
29
|
+
const ordinarySeed = 'data:text/html,%3Ctitle%3Eordinary%3C%2Ftitle%3E';
|
|
30
|
+
|
|
31
|
+
const subscriptions = [...new Set(['Page', ...sealedEventDomains, 'Network'])];
|
|
32
|
+
const enables = (session, discovery, frameId) => [
|
|
33
|
+
...subscriptions.map((domain) => [`${domain}.enable`, {}, session]),
|
|
34
|
+
['Page.createIsolatedWorld', { frameId, worldName: binding.executionContextName }, session],
|
|
35
|
+
['Runtime.addBinding', binding, session],
|
|
30
36
|
...(discovery ? [['Target.setDiscoverTargets', { discover: true }]] : []),
|
|
31
37
|
];
|
|
32
38
|
|
|
33
39
|
const notLive = (result, liveWhy) => ({ ...result, live: false, attached: false, liveWhy });
|
|
34
40
|
|
|
35
|
-
async function attachClient({ client, targetId, discovery, side, result, missing }) {
|
|
41
|
+
async function attachClient({ client, targetId, frame, discovery, side, result, missing }) {
|
|
36
42
|
const attached = await outcome(client.send('Target.attachToTarget', { targetId, flatten: true }));
|
|
37
43
|
const session = attached.result?.sessionId;
|
|
38
44
|
result.diagnostics = { clientAttach: attachOutcome(attached) };
|
|
39
45
|
if (!session) return { stop: notLive(result, attachWhy(result.diagnostics.clientAttach)) };
|
|
40
|
-
for (const [method, ...args] of enables(session, discovery)) {
|
|
46
|
+
for (const [method, ...args] of enables(session, discovery, (await frame()).id)) {
|
|
41
47
|
const out = await outcome(client.send(method, ...args));
|
|
42
48
|
if (out.ok) continue;
|
|
43
49
|
if (!protectedRefusal(out))
|
|
@@ -220,6 +226,117 @@ function eventsRedacted({ events, targetId, start, ...failure }) {
|
|
|
220
226
|
);
|
|
221
227
|
}
|
|
222
228
|
|
|
229
|
+
const stimulus = (marker) => `(() => {
|
|
230
|
+
document.title = '${marker}';
|
|
231
|
+
console.log('${marker}');
|
|
232
|
+
reportError(new Error('${marker}'));
|
|
233
|
+
const style = document.createElement('style');
|
|
234
|
+
style.textContent = ':root { --sealed-event: 1 }';
|
|
235
|
+
document.head.append(style);
|
|
236
|
+
getComputedStyle(document.documentElement).getPropertyValue('--sealed-event');
|
|
237
|
+
const policy = document.createElement('meta');
|
|
238
|
+
policy.httpEquiv = 'Content-Security-Policy';
|
|
239
|
+
policy.content = 'img-src https://${marker}.invalid';
|
|
240
|
+
document.head.append(policy);
|
|
241
|
+
new Image().src = 'data:image/png,${marker}';
|
|
242
|
+
return '${marker}';
|
|
243
|
+
})()`;
|
|
244
|
+
|
|
245
|
+
const contentWithheld = (client, session, start) =>
|
|
246
|
+
!client.events.slice(start).some((e) => e.sessionId === session && sealedContentEvent(e.method));
|
|
247
|
+
|
|
248
|
+
function missingWitness(events, marker) {
|
|
249
|
+
const required = [
|
|
250
|
+
['Debugger.scriptParsed', (p) => p.url === `sealed-witness:${marker}`],
|
|
251
|
+
['Runtime.executionContextCreated', (p) => p.context.name === binding.executionContextName],
|
|
252
|
+
['Runtime.bindingCalled', (p) => p.name === binding.name && p.payload === marker],
|
|
253
|
+
['Accessibility.nodesUpdated', (p) => p.nodes.some((node) => node.name?.value === marker)],
|
|
254
|
+
['Runtime.consoleAPICalled', (p) => p.args.some((arg) => arg.value === marker)],
|
|
255
|
+
['Runtime.exceptionThrown', (p) => p.exceptionDetails.exception?.description?.includes(marker)],
|
|
256
|
+
['Log.entryAdded', (p) => p.entry.source === 'security' && p.entry.text.includes(marker)],
|
|
257
|
+
];
|
|
258
|
+
return required
|
|
259
|
+
.filter(([method, match]) => !events.some((e) => e.method === method && match(e.params)))
|
|
260
|
+
.map(([method]) => method);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function preEnabledEvents({ client, session, reader, observer, frame, start, side, until }) {
|
|
264
|
+
const marker = `slicc-sealed-event-witness-${frame.loaderId.replace(/[^a-z0-9-]/gi, '').toLowerCase()}`;
|
|
265
|
+
const observedCommit = client.events.length;
|
|
266
|
+
const commit = client.events.findIndex(
|
|
267
|
+
(e, i) =>
|
|
268
|
+
i >= start &&
|
|
269
|
+
e.sessionId === session &&
|
|
270
|
+
e.method === 'Page.frameNavigated' &&
|
|
271
|
+
e.params.frame.loaderId === frame.loaderId
|
|
272
|
+
);
|
|
273
|
+
const since = commit < 0 ? observedCommit : commit + 1;
|
|
274
|
+
const witness = side === 'control' ? client : reader;
|
|
275
|
+
const witnessSession = side === 'control' ? session : observer;
|
|
276
|
+
const beforeProbe = witness.events.length;
|
|
277
|
+
await reader.send('Runtime.enable', {}, observer);
|
|
278
|
+
if (side !== 'control') {
|
|
279
|
+
await reader.send('Log.enable', {}, observer);
|
|
280
|
+
await reader.send('Debugger.enable', {}, observer);
|
|
281
|
+
await reader.send('Accessibility.enable', {}, observer);
|
|
282
|
+
await reader.send('Runtime.addBinding', binding, observer);
|
|
283
|
+
}
|
|
284
|
+
await witness.send('Accessibility.getRootAXNode', { frameId: frame.id }, witnessSession);
|
|
285
|
+
const { executionContextId } = await reader.send(
|
|
286
|
+
'Page.createIsolatedWorld',
|
|
287
|
+
{ frameId: frame.id, worldName: binding.executionContextName },
|
|
288
|
+
observer
|
|
289
|
+
);
|
|
290
|
+
await reader.send(
|
|
291
|
+
'Runtime.compileScript',
|
|
292
|
+
{
|
|
293
|
+
expression: 'void 0',
|
|
294
|
+
sourceURL: `sealed-witness:${marker}`,
|
|
295
|
+
persistScript: true,
|
|
296
|
+
executionContextId,
|
|
297
|
+
},
|
|
298
|
+
observer
|
|
299
|
+
);
|
|
300
|
+
await reader.send(
|
|
301
|
+
'Runtime.evaluate',
|
|
302
|
+
{
|
|
303
|
+
contextId: executionContextId,
|
|
304
|
+
expression: `globalThis.${binding.name}?.('${marker}')`,
|
|
305
|
+
},
|
|
306
|
+
observer
|
|
307
|
+
);
|
|
308
|
+
const measured = await reader.send(
|
|
309
|
+
'Runtime.evaluate',
|
|
310
|
+
{ expression: stimulus(marker), returnByValue: true },
|
|
311
|
+
observer
|
|
312
|
+
);
|
|
313
|
+
if (measured.result?.value !== marker) return { missing: 'sealed event stimulus did not run' };
|
|
314
|
+
const absent = () =>
|
|
315
|
+
missingWitness(
|
|
316
|
+
witness.events.slice(beforeProbe).filter((e) => e.sessionId === witnessSession),
|
|
317
|
+
marker
|
|
318
|
+
);
|
|
319
|
+
if (!(await until(() => !absent().length)))
|
|
320
|
+
return { missing: `sealed event witness did not receive ${absent().join(', ')}` };
|
|
321
|
+
return { withheld: () => contentWithheld(client, session, since) };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
async function reloadEventsRedacted(client, session, start, failedURL, tag, requireLeak, until) {
|
|
325
|
+
const { leaks } = failureRules({ failedURL, tag });
|
|
326
|
+
const reported = (domain) =>
|
|
327
|
+
client.events
|
|
328
|
+
.slice(start)
|
|
329
|
+
.some(
|
|
330
|
+
(e) =>
|
|
331
|
+
e.sessionId === session &&
|
|
332
|
+
e.method.startsWith(domain) &&
|
|
333
|
+
leaks(JSON.stringify(e.params ?? {}))
|
|
334
|
+
);
|
|
335
|
+
if (requireLeak && !(await until(() => reported('Page.') && reported('Network.'))))
|
|
336
|
+
return 'incomplete';
|
|
337
|
+
return !reported('Page.') && !reported('Network.');
|
|
338
|
+
}
|
|
339
|
+
|
|
223
340
|
async function privateBlank({ frame, reader, observer, targetId, failedURL, tag }) {
|
|
224
341
|
const { leaks, names } = failureRules({ failedURL, tag });
|
|
225
342
|
if (frame.url !== privateBlankURL || frame.unreachableUrl) return false;
|
|
@@ -241,13 +358,23 @@ async function privateBlank({ frame, reader, observer, targetId, failedURL, tag
|
|
|
241
358
|
);
|
|
242
359
|
}
|
|
243
360
|
|
|
244
|
-
async function redaction({
|
|
361
|
+
async function redaction({
|
|
362
|
+
client,
|
|
363
|
+
targetId,
|
|
364
|
+
failedURL,
|
|
365
|
+
ordinary,
|
|
366
|
+
tag,
|
|
367
|
+
start,
|
|
368
|
+
sealedStart,
|
|
369
|
+
result,
|
|
370
|
+
discovery,
|
|
371
|
+
}) {
|
|
245
372
|
const info = await outcome(client.send('Target.getTargetInfo', { targetId }));
|
|
246
373
|
const list = await outcome(client.send('Target.getTargets'));
|
|
247
374
|
const before = client.events.length;
|
|
248
375
|
const again = await outcome(client.send('Target.attachToTarget', { targetId, flatten: true }));
|
|
249
376
|
const origin = new URL(failedURL).origin;
|
|
250
|
-
const only = (i) => i?.url === origin && i.title === origin;
|
|
377
|
+
const only = (i) => i?.url === origin && (i.title === origin || i.title === '');
|
|
251
378
|
const listed = list.ok ? list.result.targetInfos.find((i) => i.targetId === targetId) : undefined;
|
|
252
379
|
await pause(100);
|
|
253
380
|
const attachedInfo = client.events
|
|
@@ -261,6 +388,18 @@ async function redaction({ client, targetId, failedURL, ordinary, tag, start, re
|
|
|
261
388
|
result.infoRedacted = info.ok && only(info.result.targetInfo);
|
|
262
389
|
result.listRedacted = only(listed);
|
|
263
390
|
result.attachRedacted = only(attachedInfo);
|
|
391
|
+
result.metadataOriginOnly =
|
|
392
|
+
result.infoRedacted &&
|
|
393
|
+
result.listRedacted &&
|
|
394
|
+
result.attachRedacted &&
|
|
395
|
+
client.events
|
|
396
|
+
.slice(sealedStart)
|
|
397
|
+
.every(
|
|
398
|
+
(e) =>
|
|
399
|
+
!discoveryMethods.includes(e.method) ||
|
|
400
|
+
e.params?.targetInfo?.targetId !== targetId ||
|
|
401
|
+
only(e.params.targetInfo)
|
|
402
|
+
);
|
|
264
403
|
result.fullURL =
|
|
265
404
|
info.result?.targetInfo?.url === failedURL &&
|
|
266
405
|
listed?.url === failedURL &&
|
|
@@ -277,6 +416,80 @@ async function redaction({ client, targetId, failedURL, ordinary, tag, start, re
|
|
|
277
416
|
: 'not-supported';
|
|
278
417
|
}
|
|
279
418
|
|
|
419
|
+
async function contentChecks(client, session, failedURL, tag, result) {
|
|
420
|
+
const { leaks } = failureRules({ failedURL, tag });
|
|
421
|
+
const read = (method, params) => outcome(client.send(method, params, session));
|
|
422
|
+
const script = await read('Runtime.evaluate', {
|
|
423
|
+
expression:
|
|
424
|
+
"globalThis.loadTimeDataRaw?.reloadButton?.reloadUrl ?? globalThis.loadTimeData?.getValue('reloadButton')?.reloadUrl ?? document.querySelector('#reload-button')?.dataset.url",
|
|
425
|
+
returnByValue: true,
|
|
426
|
+
});
|
|
427
|
+
const dom = await read('DOM.getDocument', { depth: -1, pierce: true });
|
|
428
|
+
const scriptMeasured =
|
|
429
|
+
script.ok &&
|
|
430
|
+
typeof script.result?.result?.value === 'string' &&
|
|
431
|
+
!script.result.exceptionDetails;
|
|
432
|
+
const domMeasured = dom.ok && typeof dom.result?.root?.nodeName === 'string';
|
|
433
|
+
result.failedUrlExposed = Boolean(
|
|
434
|
+
(scriptMeasured && leaks(script.result.result.value)) ||
|
|
435
|
+
(domMeasured && leaks(JSON.stringify(dom.result)))
|
|
436
|
+
);
|
|
437
|
+
result.failedUrlHidden =
|
|
438
|
+
!result.failedUrlExposed &&
|
|
439
|
+
Boolean((protectedRefusal(script) || scriptMeasured) && (protectedRefusal(dom) || domMeasured));
|
|
440
|
+
const pixels = await read('Page.captureScreenshot', { format: 'png' });
|
|
441
|
+
result.captureRefused = protectedRefusal(pixels)
|
|
442
|
+
? true
|
|
443
|
+
: pixels.ok && typeof pixels.result?.data === 'string' && pixels.result.data.length > 0
|
|
444
|
+
? false
|
|
445
|
+
: 'incomplete';
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
async function reloadChecks({
|
|
449
|
+
client,
|
|
450
|
+
session,
|
|
451
|
+
reader,
|
|
452
|
+
observer,
|
|
453
|
+
targetId,
|
|
454
|
+
frame,
|
|
455
|
+
failedURL,
|
|
456
|
+
tag,
|
|
457
|
+
result,
|
|
458
|
+
side,
|
|
459
|
+
until,
|
|
460
|
+
}) {
|
|
461
|
+
const beforeReload = (await frame()).loaderId;
|
|
462
|
+
const reloadStart = client.events.length;
|
|
463
|
+
result.reload = (await outcome(client.send('Page.reload', {}, session))).ok;
|
|
464
|
+
if (result.reload) {
|
|
465
|
+
result.reload = await until(async () => {
|
|
466
|
+
const f = await frame();
|
|
467
|
+
result.reloadedError =
|
|
468
|
+
f.loaderId !== beforeReload && f.url === errorPageURL && f.unreachableUrl === failedURL;
|
|
469
|
+
result.reloadedBlank =
|
|
470
|
+
!result.reloadedError &&
|
|
471
|
+
side === 'guarded' &&
|
|
472
|
+
(await privateBlank({ frame: f, reader, observer, targetId, failedURL, tag }));
|
|
473
|
+
return result.reloadedError || result.reloadedBlank === true;
|
|
474
|
+
});
|
|
475
|
+
if (!result.reload && result.reloadedBlank === 'incomplete') {
|
|
476
|
+
result.reload = 'incomplete';
|
|
477
|
+
result.incomplete = 'protected-error-page: the private blank page could not be read';
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (result.reloadedError)
|
|
481
|
+
result.preEnabledEventsWithheld &&= contentWithheld(client, session, reloadStart);
|
|
482
|
+
result.pageEventsRedacted = await reloadEventsRedacted(
|
|
483
|
+
client,
|
|
484
|
+
session,
|
|
485
|
+
reloadStart,
|
|
486
|
+
failedURL,
|
|
487
|
+
tag,
|
|
488
|
+
side === 'control' && result.reload,
|
|
489
|
+
until
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
280
493
|
async function observerTarget(reader, initial, notes) {
|
|
281
494
|
const { targetId } = await createObserverTarget(
|
|
282
495
|
reader,
|
|
@@ -378,9 +591,9 @@ export async function protectedErrorPage({
|
|
|
378
591
|
}
|
|
379
592
|
})();
|
|
380
593
|
try {
|
|
381
|
-
const unseeded = await seed(reader, observer, loaded, initial,
|
|
594
|
+
const unseeded = await seed(reader, observer, loaded, initial, ordinarySeed);
|
|
382
595
|
if (unseeded) return missing(unseeded);
|
|
383
|
-
const ready = await attachClient({ client, targetId, discovery, side, result, missing });
|
|
596
|
+
const ready = await attachClient({ client, targetId, frame, discovery, side, result, missing });
|
|
384
597
|
if (ready.stop) return ready.stop;
|
|
385
598
|
session = ready.session;
|
|
386
599
|
if (side === 'control') {
|
|
@@ -418,25 +631,30 @@ export async function protectedErrorPage({
|
|
|
418
631
|
return missing(`missing error commit ${JSON.stringify(evidence)}`);
|
|
419
632
|
result.live = live;
|
|
420
633
|
if (!live) return { ...result, liveWhy: commitWhy(result.diagnostics.errorCommit) };
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
634
|
+
const measureEvents = (frame, start) =>
|
|
635
|
+
preEnabledEvents({ client, session, reader, observer, frame, start, side, until });
|
|
636
|
+
const sealedStart = client.events.length;
|
|
637
|
+
const first = await measureEvents(evidence.frame, start);
|
|
638
|
+
if (first.missing) return missing(first.missing);
|
|
639
|
+
await contentChecks(client, session, failedURL, tag, result);
|
|
640
|
+
const metadata = { client, targetId, failedURL, ordinary, tag, start, result, discovery };
|
|
641
|
+
await redaction({ ...metadata, sealedStart });
|
|
642
|
+
result.preEnabledEventsWithheld = first.withheld();
|
|
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
|
+
});
|
|
656
|
+
if (result.pageEventsRedacted === 'incomplete')
|
|
657
|
+
return missing('no raw Page or Network URL witness');
|
|
440
658
|
const recovery = `${ordinary}/blank?n=${tag}-recover`;
|
|
441
659
|
result.blank = (await outcome(client.send('Page.navigate', { url: recovery }, session))).ok;
|
|
442
660
|
if (result.blank) result.blank = await loaded(recovery);
|
|
@@ -488,11 +706,15 @@ export async function protectedErrorPage({
|
|
|
488
706
|
{ patterns: [{ resourceType: 'Document', requestStage: 'Request' }] },
|
|
489
707
|
observer
|
|
490
708
|
);
|
|
709
|
+
const stickyStart = client.events.length;
|
|
491
710
|
await reader.send('Page.navigate', { url: failedURL }, observer);
|
|
492
711
|
if (!(await until(async () => (await frame()).unreachableUrl === failedURL)))
|
|
493
712
|
return missing(`missing sticky error ${JSON.stringify(await frame())}`);
|
|
494
713
|
result.stickyError = true;
|
|
714
|
+
const sticky = await measureEvents(await frame(), stickyStart);
|
|
715
|
+
if (sticky.missing) return missing(sticky.missing);
|
|
495
716
|
await pause(100);
|
|
717
|
+
result.preEnabledEventsWithheld &&= sticky.withheld();
|
|
496
718
|
}
|
|
497
719
|
await lockChecks({ client, reader, session, targetId, result, until });
|
|
498
720
|
return result;
|