@ai-ecoverse/slicc-browsers 1.46.0 → 1.48.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 +13 -12
- package/catalog.json +40 -0
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/engine.mjs +32 -2
- package/fixture-server.mjs +1 -1
- package/guard-runner.mjs +1 -0
- package/guard-vectors.json +1399 -143
- package/package.json +5 -4
- package/protected-parent-iframes.mjs +551 -567
- package/protected.json +123 -3
- package/protected.mjs +1 -209
- package/schema/catalog.schema.json +46 -0
- package/schema/guard-vectors.schema.json +7 -0
- package/schema/protected.schema.json +21 -0
package/engine/engine.wasm
CHANGED
|
Binary file
|
package/engine.mjs
CHANGED
|
@@ -29,6 +29,8 @@ function valid(op, result) {
|
|
|
29
29
|
typeof result.digest === 'string' &&
|
|
30
30
|
/^[0-9a-f]{16}$/.test(result.digest)
|
|
31
31
|
);
|
|
32
|
+
case 'refusal':
|
|
33
|
+
return typeof result === 'string' && result.startsWith('slicc: refused: ');
|
|
32
34
|
case 'har':
|
|
33
35
|
return result === 'include' || result === 'exclude';
|
|
34
36
|
case 'storageKey':
|
|
@@ -53,8 +55,29 @@ function exchange(wasm, method, input) {
|
|
|
53
55
|
return answer.ok;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
function encode(value) {
|
|
59
|
+
return encoder.encode(
|
|
60
|
+
JSON.stringify(value, (_, v) => (typeof v === 'string' ? v.toWellFormed() : v))
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function preserveTargetComparison(request) {
|
|
65
|
+
if (
|
|
66
|
+
request?.op !== 'target' ||
|
|
67
|
+
typeof request.url !== 'string' ||
|
|
68
|
+
typeof request.unreachableURL !== 'string'
|
|
69
|
+
)
|
|
70
|
+
return request;
|
|
71
|
+
if (
|
|
72
|
+
request.url !== request.unreachableURL &&
|
|
73
|
+
request.url.toWellFormed() === request.unreachableURL.toWellFormed()
|
|
74
|
+
)
|
|
75
|
+
return { ...request, unreachableURL: undefined };
|
|
76
|
+
return request;
|
|
77
|
+
}
|
|
78
|
+
|
|
56
79
|
function binding(module, config) {
|
|
57
|
-
const input =
|
|
80
|
+
const input = encode(config);
|
|
58
81
|
function create() {
|
|
59
82
|
const wasm = new WebAssembly.Instance(module).exports;
|
|
60
83
|
if (wasm.engine_abi() !== 1) throw new Error('unsupported engine ABI');
|
|
@@ -66,7 +89,11 @@ function binding(module, config) {
|
|
|
66
89
|
function call(request) {
|
|
67
90
|
try {
|
|
68
91
|
instance ??= create();
|
|
69
|
-
const
|
|
92
|
+
const wire =
|
|
93
|
+
request.op === 'batch' && Array.isArray(request.calls)
|
|
94
|
+
? { ...request, calls: request.calls.map(preserveTargetComparison) }
|
|
95
|
+
: preserveTargetComparison(request);
|
|
96
|
+
const result = exchange(instance, 'engine_call', encode(wire));
|
|
70
97
|
const ok =
|
|
71
98
|
request.op === 'batch'
|
|
72
99
|
? Array.isArray(result) &&
|
|
@@ -92,6 +119,9 @@ function binding(module, config) {
|
|
|
92
119
|
storageKey: (key) => call({ op: 'storageKey', key }),
|
|
93
120
|
extensionFrame: (url) => call({ op: 'extensionFrame', url }),
|
|
94
121
|
har: (url) => call({ op: 'har', url }),
|
|
122
|
+
zoneHost: (host) => call({ op: 'zoneHost', host }),
|
|
123
|
+
inheriting: (url) => call({ op: 'inheriting', url }),
|
|
124
|
+
refusal: (key) => call({ op: 'refusal', key }),
|
|
95
125
|
info: () => call({ op: 'info' }),
|
|
96
126
|
batch: (calls) => call({ op: 'batch', calls }),
|
|
97
127
|
};
|
package/fixture-server.mjs
CHANGED
|
@@ -138,7 +138,7 @@ function route(req, url, send, html, redirects) {
|
|
|
138
138
|
const marker = p.get('n') ?? '';
|
|
139
139
|
return html(
|
|
140
140
|
'oopif-srcdoc',
|
|
141
|
-
`<p>oopif-srcdoc ${escape(marker)}</p><iframe sandbox="allow-scripts allow-forms" srcdoc="${escape(`<!doctype html><title>srcdoc</title><p>ordinary srcdoc ${marker}</p>`)}"></iframe>`
|
|
141
|
+
`<p>oopif-srcdoc ${escape(marker)}</p><iframe${p.has('sandbox') ? ' sandbox="allow-scripts allow-forms"' : ''} srcdoc="${escape(`<!doctype html><title>srcdoc</title><p>ordinary srcdoc ${marker}</p>`)}"></iframe>`
|
|
142
142
|
);
|
|
143
143
|
},
|
|
144
144
|
'/held': () =>
|
package/guard-runner.mjs
CHANGED
|
@@ -1559,6 +1559,7 @@ class Execution {
|
|
|
1559
1559
|
protectedOrigin: this.vars.target,
|
|
1560
1560
|
cross: this.options.targets?.cross,
|
|
1561
1561
|
ordinary: this.vars.ordinary,
|
|
1562
|
+
browserSession: supported(['browserSession'], this.options.capabilities),
|
|
1562
1563
|
mode: step.protectedParentIframes,
|
|
1563
1564
|
tag: this.vars.tag,
|
|
1564
1565
|
internalSessions: this.internalSessions,
|