@ai-ecoverse/slicc-browsers 1.42.0 → 1.44.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 -17
- package/catalog.json +1 -0
- package/engine/engine-wasm.mjs +3 -0
- package/engine/engine.wasm +0 -0
- package/engine.mjs +108 -0
- package/guard-vectors.json +1 -1
- package/package.json +17 -8
- package/protected.json +77 -0
- package/protected.mjs +15 -1
- package/schema/catalog.schema.json +6 -0
- package/schema/protected.schema.json +29 -0
|
Binary file
|
package/engine.mjs
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import bytes from './engine/engine-wasm.mjs';
|
|
2
|
+
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
5
|
+
const roles = [
|
|
6
|
+
'seven',
|
|
7
|
+
'slicc',
|
|
8
|
+
'extra',
|
|
9
|
+
'browser',
|
|
10
|
+
'extension',
|
|
11
|
+
'file',
|
|
12
|
+
'unparseable',
|
|
13
|
+
'ordinary',
|
|
14
|
+
];
|
|
15
|
+
let compiled;
|
|
16
|
+
|
|
17
|
+
function valid(op, result) {
|
|
18
|
+
switch (op) {
|
|
19
|
+
case 'urlClass':
|
|
20
|
+
return (
|
|
21
|
+
typeof result?.protected === 'boolean' &&
|
|
22
|
+
roles.includes(result.role) &&
|
|
23
|
+
(result.origin === null || typeof result.origin === 'string')
|
|
24
|
+
);
|
|
25
|
+
case 'info':
|
|
26
|
+
return (
|
|
27
|
+
result?.abi === 1 &&
|
|
28
|
+
Number.isInteger(result.catalogSchema) &&
|
|
29
|
+
typeof result.digest === 'string' &&
|
|
30
|
+
/^[0-9a-f]{16}$/.test(result.digest)
|
|
31
|
+
);
|
|
32
|
+
case 'har':
|
|
33
|
+
return result === 'include' || result === 'exclude';
|
|
34
|
+
case 'storageKey':
|
|
35
|
+
return typeof result?.protected === 'boolean';
|
|
36
|
+
default:
|
|
37
|
+
return typeof result === 'boolean';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function exchange(wasm, method, input) {
|
|
42
|
+
const ptr = wasm.engine_alloc(input.length) >>> 0;
|
|
43
|
+
new Uint8Array(wasm.memory.buffer, ptr, input.length).set(input);
|
|
44
|
+
const packed = wasm[method](ptr, input.length);
|
|
45
|
+
const start = Number(BigInt.asUintN(64, packed) >> 32n);
|
|
46
|
+
const length = Number(packed & 0xffffffffn);
|
|
47
|
+
const answer = JSON.parse(decoder.decode(new Uint8Array(wasm.memory.buffer, start, length)));
|
|
48
|
+
wasm.engine_free(start, length);
|
|
49
|
+
wasm.engine_free(ptr, input.length);
|
|
50
|
+
if (typeof answer?.error === 'string') throw new Error(answer.error);
|
|
51
|
+
if (!answer || Object.keys(answer).length !== 1 || !Object.hasOwn(answer, 'ok'))
|
|
52
|
+
throw new Error('invalid engine response');
|
|
53
|
+
return answer.ok;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function binding(module, config) {
|
|
57
|
+
const input = encoder.encode(JSON.stringify(config));
|
|
58
|
+
function create() {
|
|
59
|
+
const wasm = new WebAssembly.Instance(module).exports;
|
|
60
|
+
if (wasm.engine_abi() !== 1) throw new Error('unsupported engine ABI');
|
|
61
|
+
if (exchange(wasm, 'engine_init', input) !== true)
|
|
62
|
+
throw new Error('engine initialization failed');
|
|
63
|
+
return wasm;
|
|
64
|
+
}
|
|
65
|
+
let instance = create();
|
|
66
|
+
function call(request) {
|
|
67
|
+
try {
|
|
68
|
+
instance ??= create();
|
|
69
|
+
const result = exchange(instance, 'engine_call', encoder.encode(JSON.stringify(request)));
|
|
70
|
+
const ok =
|
|
71
|
+
request.op === 'batch'
|
|
72
|
+
? Array.isArray(result) &&
|
|
73
|
+
result.length === request.calls.length &&
|
|
74
|
+
result.every((v, i) => valid(request.calls[i].op, v))
|
|
75
|
+
: valid(request.op, result);
|
|
76
|
+
if (!ok) throw new Error(`invalid engine result for ${request.op}`);
|
|
77
|
+
return result;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
instance = undefined;
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
url: (url, { readOnly = false } = {}) => call({ op: 'url', url, readOnly }),
|
|
85
|
+
urlReadOnly: (url) => call({ op: 'url', url, readOnly: true }),
|
|
86
|
+
urlClass: (url) => call({ op: 'urlClass', url }),
|
|
87
|
+
target: (facts) => call({ ...facts, op: 'target' }),
|
|
88
|
+
kept: (url) => call({ op: 'kept', url }),
|
|
89
|
+
keptTarget: (facts) => call({ ...facts, op: 'keptTarget' }),
|
|
90
|
+
unparseable: (url) => call({ op: 'unparseable', url }),
|
|
91
|
+
cookieDomain: (domain) => call({ op: 'cookieDomain', domain }),
|
|
92
|
+
storageKey: (key) => call({ op: 'storageKey', key }),
|
|
93
|
+
extensionFrame: (url) => call({ op: 'extensionFrame', url }),
|
|
94
|
+
har: (url) => call({ op: 'har', url }),
|
|
95
|
+
info: () => call({ op: 'info' }),
|
|
96
|
+
batch: (calls) => call({ op: 'batch', calls }),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function engine(config = {}) {
|
|
101
|
+
compiled ??= new WebAssembly.Module(bytes);
|
|
102
|
+
return binding(compiled, config);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function loadEngine(config = {}) {
|
|
106
|
+
compiled ??= await WebAssembly.compile(bytes);
|
|
107
|
+
return binding(compiled, config);
|
|
108
|
+
}
|
package/guard-vectors.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-browsers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"./protected.json": "./protected.json",
|
|
29
29
|
"./debugger-stage1.json": "./debugger-stage1.json",
|
|
30
30
|
"./protected.mjs": "./protected.mjs",
|
|
31
|
+
"./engine": "./engine.mjs",
|
|
32
|
+
"./engine.mjs": "./engine.mjs",
|
|
33
|
+
"./engine/engine-wasm.mjs": "./engine/engine-wasm.mjs",
|
|
34
|
+
"./engine/engine.wasm": "./engine/engine.wasm",
|
|
31
35
|
"./guard-vectors.json": "./guard-vectors.json",
|
|
32
36
|
"./guard-driver.mjs": "./guard-driver.mjs",
|
|
33
37
|
"./seven.mjs": "./seven.mjs",
|
|
@@ -49,6 +53,9 @@
|
|
|
49
53
|
"protected.json",
|
|
50
54
|
"debugger-stage1.json",
|
|
51
55
|
"protected.mjs",
|
|
56
|
+
"engine.mjs",
|
|
57
|
+
"engine/engine-wasm.mjs",
|
|
58
|
+
"engine/engine.wasm",
|
|
52
59
|
"guard-vectors.json",
|
|
53
60
|
"guard-driver.mjs",
|
|
54
61
|
"seven.mjs",
|
|
@@ -76,12 +83,13 @@
|
|
|
76
83
|
"scripts": {
|
|
77
84
|
"prepare": "slicc-install-hooks",
|
|
78
85
|
"corpus": "node scripts/corpus.mjs",
|
|
86
|
+
"engine": "PATH=\"$HOME/.cargo/bin:$PATH\" node scripts/engine.mjs",
|
|
79
87
|
"validate": "node scripts/validate.mjs",
|
|
80
|
-
"lint": "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 --check && cargo clippy --all-features --all-targets -- -D warnings && cargo check --target wasm32-wasip1 --no-default-features && cargo check --target wasm32-wasip1 --features serde && cargo check --target wasm32-wasip1 --all-features",
|
|
81
|
-
"format": "biome check --write . && gofmt -w . && cargo fmt",
|
|
82
|
-
"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/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-credential-export.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/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-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-apex.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",
|
|
88
|
+
"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 git ls-files --error-unmatch engine/engine.wasm engine/engine-wasm.mjs > /dev/null && npm run engine && git diff --exit-code -- engine/engine.wasm engine/engine-wasm.mjs; fi && 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",
|
|
89
|
+
"format": "biome check --write . && gofmt -w . && cargo fmt --all",
|
|
90
|
+
"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/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-credential-export.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/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-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-apex.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",
|
|
83
91
|
"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 ./...",
|
|
84
|
-
"build": "go build ./... && cargo build --all-features && cargo build --target wasm32-wasip1 --all-features && npm pack --dry-run",
|
|
92
|
+
"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",
|
|
85
93
|
"prepublishOnly": "node scripts/set-crate-version.mjs \"$npm_package_version\"",
|
|
86
94
|
"trust": "npx fledgling sync -y --skip-publish",
|
|
87
95
|
"trust:dry": "npx fledgling sync --dry-run -y --skip-publish",
|
|
@@ -90,12 +98,13 @@
|
|
|
90
98
|
"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"
|
|
91
99
|
},
|
|
92
100
|
"devDependencies": {
|
|
93
|
-
"@ai-ecoverse/slicc-cdp": "2.
|
|
94
|
-
"@ai-ecoverse/slicc-shared-web": "2.
|
|
101
|
+
"@ai-ecoverse/slicc-cdp": "2.4.0",
|
|
102
|
+
"@ai-ecoverse/slicc-shared-web": "2.19.1",
|
|
95
103
|
"@biomejs/biome": "2.6.8",
|
|
96
104
|
"ajv": "8.20.0",
|
|
97
105
|
"ajv-formats": "3.0.1",
|
|
106
|
+
"binaryen": "132.0.0",
|
|
98
107
|
"lefthook": "2.2.2",
|
|
99
|
-
"semantic-release": "
|
|
108
|
+
"semantic-release": "26.0.1"
|
|
100
109
|
}
|
|
101
110
|
}
|
package/protected.json
CHANGED
|
@@ -1393,5 +1393,82 @@
|
|
|
1393
1393
|
"key": "",
|
|
1394
1394
|
"protected": false
|
|
1395
1395
|
}
|
|
1396
|
+
],
|
|
1397
|
+
"kept": [
|
|
1398
|
+
{ "url": "https://lease-pilot.sliccy.ai/", "kept": true },
|
|
1399
|
+
{ "url": "https://lease-pilot.sliccy.ai", "kept": true },
|
|
1400
|
+
{ "url": "https://lease-pilot.sliccy.ai/os/x", "kept": true },
|
|
1401
|
+
{ "url": "https://lease-pilot.sliccy.ai/auth/callback", "kept": true },
|
|
1402
|
+
{ "url": "https://lease-pilot.sliccy.ai/os/x/y/z/deep/path/index.html", "kept": true },
|
|
1403
|
+
{ "url": "https://lease-pilot.sliccy.ai/?x=1&y=2", "kept": true },
|
|
1404
|
+
{ "url": "https://lease-pilot.sliccy.ai/#x", "kept": true },
|
|
1405
|
+
{ "url": "HTTPS://LEASE-PILOT.SLICCY.AI/", "kept": true },
|
|
1406
|
+
{ "url": "https://lease-pilot.sliccy.ai./", "kept": true },
|
|
1407
|
+
{ "url": "https://user:secret@lease-pilot.sliccy.ai/", "kept": true },
|
|
1408
|
+
{ "url": "https://lease-pilot.sliccy.ai:443/", "kept": true },
|
|
1409
|
+
{ "url": "https://lease-pilot%2Esliccy.ai/", "kept": true },
|
|
1410
|
+
{ "url": "https://lease-pilot.sliccy.ai/", "kept": true },
|
|
1411
|
+
{ "url": "https://lease-pilot.sliccy.ai:8443/", "kept": false },
|
|
1412
|
+
{ "url": "https://lease-pilot.sliccy.ai:80/", "kept": false },
|
|
1413
|
+
{ "url": "http://lease-pilot.sliccy.ai/", "kept": false },
|
|
1414
|
+
{ "url": "http://lease-pilot.sliccy.ai:80/", "kept": false },
|
|
1415
|
+
{ "url": "https://a.lease-pilot.sliccy.ai/", "kept": false },
|
|
1416
|
+
{ "url": "https://a.b.lease-pilot.sliccy.ai/", "kept": false },
|
|
1417
|
+
{ "url": "https://lease-pilot.sliccy.ai.example/", "kept": false },
|
|
1418
|
+
{ "url": "https://lease-pilot-sliccy.ai/", "kept": false },
|
|
1419
|
+
{ "url": "https://notsliccy.ai/", "kept": false },
|
|
1420
|
+
{ "url": "https://lease-pilot.sliccy.aix/", "kept": false },
|
|
1421
|
+
{ "url": "https://lease-pilot.sliccy.ai@example.com/", "kept": false },
|
|
1422
|
+
{ "url": "wss://lease-pilot.sliccy.ai/", "kept": false },
|
|
1423
|
+
{ "url": "ftp://lease-pilot.sliccy.ai/", "kept": false },
|
|
1424
|
+
{ "url": "https://sliccy.ai/", "kept": false },
|
|
1425
|
+
{ "url": "https://seven.sliccy.ai/", "kept": false },
|
|
1426
|
+
{ "url": "https://www.sliccy.ai/", "kept": false },
|
|
1427
|
+
{ "url": "https://vault.sliccy.ai/", "kept": false },
|
|
1428
|
+
{ "url": "blob:https://lease-pilot.sliccy.ai/x", "kept": false },
|
|
1429
|
+
{ "url": "view-source:https://lease-pilot.sliccy.ai/", "kept": false },
|
|
1430
|
+
{ "url": "https://lease-pilot.sliccy.ai:99999/", "kept": false }
|
|
1431
|
+
],
|
|
1432
|
+
"keptTargets": [
|
|
1433
|
+
{ "url": "about:blank", "contextOrigin": "https://lease-pilot.sliccy.ai", "kept": true },
|
|
1434
|
+
{
|
|
1435
|
+
"url": "about:blank",
|
|
1436
|
+
"contextOrigin": "https://lease-pilot.sliccy.ai",
|
|
1437
|
+
"opener": "protected",
|
|
1438
|
+
"kept": true
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
"url": "about:blank",
|
|
1442
|
+
"contextOrigin": "https://lease-pilot.sliccy.ai",
|
|
1443
|
+
"opener": "unprotected",
|
|
1444
|
+
"kept": true
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
"url": "about:blank",
|
|
1448
|
+
"contextOrigin": "https://lease-pilot.sliccy.ai",
|
|
1449
|
+
"previous": true,
|
|
1450
|
+
"kept": true
|
|
1451
|
+
},
|
|
1452
|
+
{ "url": "about:blank", "contextOrigin": "https://lease-pilot.sliccy.ai:8443", "kept": false },
|
|
1453
|
+
{ "url": "about:blank", "contextOrigin": "http://lease-pilot.sliccy.ai", "kept": false },
|
|
1454
|
+
{ "url": "about:blank", "contextOrigin": "https://a.lease-pilot.sliccy.ai", "kept": false },
|
|
1455
|
+
{ "url": "about:blank", "contextOrigin": "https://seven.sliccy.ai", "kept": false },
|
|
1456
|
+
{ "url": "about:blank", "contextOrigin": "https://example.com", "kept": false },
|
|
1457
|
+
{ "url": "about:blank", "contextOrigin": "https://lease-pilot.sliccy.ai/", "kept": false },
|
|
1458
|
+
{ "url": "about:blank", "contextOrigin": "HTTPS://LEASE-PILOT.SLICCY.AI", "kept": false },
|
|
1459
|
+
{ "url": "about:blank", "contextOrigin": "about://", "kept": false },
|
|
1460
|
+
{ "url": "about:blank", "contextOrigin": "://", "kept": false },
|
|
1461
|
+
{ "url": "about:blank", "kept": false },
|
|
1462
|
+
{ "url": "about:blank", "previous": true, "kept": false },
|
|
1463
|
+
{ "url": "about:blank", "opener": "protected", "kept": false },
|
|
1464
|
+
{ "url": "https://lease-pilot.sliccy.ai/", "kept": true },
|
|
1465
|
+
{ "url": "https://lease-pilot.sliccy.ai/os/x", "opener": "unprotected", "kept": true },
|
|
1466
|
+
{
|
|
1467
|
+
"url": "https://seven.sliccy.ai/",
|
|
1468
|
+
"contextOrigin": "https://lease-pilot.sliccy.ai",
|
|
1469
|
+
"kept": false
|
|
1470
|
+
},
|
|
1471
|
+
{ "url": "blob:https://lease-pilot.sliccy.ai/x", "kept": false },
|
|
1472
|
+
{ "url": "view-source:https://lease-pilot.sliccy.ai/", "kept": false }
|
|
1396
1473
|
]
|
|
1397
1474
|
}
|
package/protected.mjs
CHANGED
|
@@ -73,6 +73,20 @@ export function protectedOrigins(rules, extraOrigins = []) {
|
|
|
73
73
|
origin.toLowerCase().startsWith('about:') &&
|
|
74
74
|
origin !== 'about://';
|
|
75
75
|
|
|
76
|
+
const keptHosts = (rules.keptOrigins ?? [])
|
|
77
|
+
.map((o) => parse(o))
|
|
78
|
+
.filter((u) => u?.host && scheme(u) === 'https' && u.port === '')
|
|
79
|
+
.map(hostOf);
|
|
80
|
+
const keptOrigins = keptHosts.map((h) => `https://${h}`);
|
|
81
|
+
|
|
82
|
+
const kept = (text) => {
|
|
83
|
+
const u = parse(text);
|
|
84
|
+
return u !== null && scheme(u) === 'https' && u.port === '' && keptHosts.includes(hostOf(u));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const keptTarget = ({ url: text, contextOrigin }) =>
|
|
88
|
+
inheriting(text) ? keptOrigins.includes(contextOrigin) : kept(text);
|
|
89
|
+
|
|
76
90
|
const target = ({
|
|
77
91
|
url: text,
|
|
78
92
|
previous = false,
|
|
@@ -118,7 +132,7 @@ export function protectedOrigins(rules, extraOrigins = []) {
|
|
|
118
132
|
return !extra.includes(originOf(u));
|
|
119
133
|
};
|
|
120
134
|
|
|
121
|
-
return { url, target, cookieDomain, storageKey, unparseable, extensionFrame };
|
|
135
|
+
return { url, target, kept, keptTarget, cookieDomain, storageKey, unparseable, extensionFrame };
|
|
122
136
|
}
|
|
123
137
|
|
|
124
138
|
export function credentialOrigins(rules) {
|
|
@@ -209,6 +209,12 @@
|
|
|
209
209
|
"pattern": "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$"
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
|
+
"keptOrigins": {
|
|
213
|
+
"description": "Exact https origins (scheme and host, no port, path or trailing slash) whose documents are kept. A URL is kept when it parses as https on the default port and its host equals an entry's host, compared case-insensitively with one trailing dot ignored, for any path, query or fragment; userinfo does not change the host, and wrapped URLs (blob:, view-source:) are not kept. An inheriting document (about:blank) is kept when its context origin equals an entry exactly. Every kept origin is also a protected origin. Keeping only narrows and never grants protection: a consumer evaluates protected and kept together, and keeping never changes whether a page is protected. The about:blank case only means something beside the consumer's own context-origin judge. Optional; consumers without a kept notion ignore it.",
|
|
214
|
+
"type": "array",
|
|
215
|
+
"uniqueItems": true,
|
|
216
|
+
"items": { "type": "string", "pattern": "^https://[a-z0-9.-]+$" }
|
|
217
|
+
},
|
|
212
218
|
"schemes": { "$ref": "#/$defs/schemes", "type": "array", "minItems": 1 },
|
|
213
219
|
"innerSchemes": { "$ref": "#/$defs/schemes" },
|
|
214
220
|
"anySchemes": { "$ref": "#/$defs/schemes" },
|
|
@@ -85,6 +85,35 @@
|
|
|
85
85
|
"protected": { "type": "boolean" }
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
},
|
|
89
|
+
"kept": {
|
|
90
|
+
"description": "Expected answers of the reference kept judge for a URL. Keeping only narrows and never grants protection: every kept row is also protected, and consumers evaluate protected and kept together.",
|
|
91
|
+
"type": "array",
|
|
92
|
+
"items": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"required": ["url", "kept"],
|
|
96
|
+
"properties": {
|
|
97
|
+
"url": { "type": "string" },
|
|
98
|
+
"kept": { "type": "boolean" }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"keptTargets": {
|
|
103
|
+
"description": "Expected answers of the reference kept judge for a target. The about:blank rows only mean something beside the consumer's own context-origin judge; keeping only narrows and never grants protection.",
|
|
104
|
+
"type": "array",
|
|
105
|
+
"items": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"additionalProperties": false,
|
|
108
|
+
"required": ["url", "kept"],
|
|
109
|
+
"properties": {
|
|
110
|
+
"url": { "type": "string" },
|
|
111
|
+
"contextOrigin": { "type": "string", "minLength": 1 },
|
|
112
|
+
"previous": { "type": "boolean" },
|
|
113
|
+
"opener": { "enum": ["protected", "unprotected", "unknown"] },
|
|
114
|
+
"kept": { "type": "boolean" }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
88
117
|
}
|
|
89
118
|
}
|
|
90
119
|
}
|