@ai-ecoverse/slicc-browsers 1.51.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 +9 -7
- package/catalog.json +81 -0
- package/engine/builtins.mjs +34 -0
- package/engine/engine-js.mjs +1 -0
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/engine/runtime.mjs +12 -0
- package/engine-vectors.json +1611 -162
- package/engine.mjs +38 -46
- package/guard-vectors.json +650 -18
- package/package.json +16 -7
- package/protected-error-page.mjs +250 -28
- package/protected-js.mjs +1 -0
- 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/README.md
CHANGED
|
@@ -75,11 +75,13 @@ npm install @ai-ecoverse/slicc-browsers
|
|
|
75
75
|
| `./guard-runner`, `./guard-driver.mjs` | the guard vector runner and its helpers |
|
|
76
76
|
| `./fixture`, `./fixture-client` | the test server (Node only) and a client for a remote one |
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Only `./fixture` requires Node. MV3 extension pages using wasm need `'wasm-unsafe-eval'`. Use `./protected-js.mjs` or `./engine-js` for page contexts whose CSP forbids WebAssembly. Inject the JS bundle before page scripts run so it can capture the original built-ins.
|
|
79
79
|
|
|
80
80
|
## Engine
|
|
81
81
|
|
|
82
|
-
One
|
|
82
|
+
One engine classifies origins, targets, cookie domains, storage keys and HAR URLs. Use `slicc_browsers::engine::Engine::embedded()?` in Rust (feature `engine`), `engine` or async `loadEngine` from `@ai-ecoverse/slicc-browsers/engine` in JS, or `engine.Default()` in `github.com/ai-ecoverse/slicc-browsers/engine` in Go. Default JS and Go share import-free wasm (under 512 KiB); Go uses wazero’s interpreter by default on macOS for hardened runtimes (wazero issue 2393). Bindings check ABI 1; only incompatible requests or answers bump it. Treat errors as refusals. `refusal(key)` returns catalog text or errors on unknown keys.
|
|
83
|
+
|
|
84
|
+
An inheriting document’s origin is its default execution context’s `contextOrigin`.
|
|
83
85
|
|
|
84
86
|
## The catalog
|
|
85
87
|
|
|
@@ -91,7 +93,7 @@ One rules engine classifies protected origins, targets, cookie domains, storage
|
|
|
91
93
|
- **Profiles and platforms**: where SLICC keeps its browser profiles, and the config dirs and registry keys per OS.
|
|
92
94
|
- **Protected origins**: see [below](#protected-origins).
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
Construct catalog and vector types by field name (Go) or with `..Default::default()` (Rust). Schema 1 grows additively; changing or removing fields requires schema 2 and a major. slicc-cli has no browser tables: change `catalog.json`, release and bump the dependency.
|
|
95
97
|
|
|
96
98
|
## Discovery
|
|
97
99
|
|
|
@@ -151,11 +153,11 @@ Browser control must never navigate to, open, attach to, or read cookies or stor
|
|
|
151
153
|
- **the browser's own privileged pages**: `chrome://` and other Chromium browsers' equivalents, `devtools://`, `chrome-extension://` (home to password managers and wallets), `file://` and Chrome's UI targets, bar the new tab page;
|
|
152
154
|
- **a program's extra seven origins**.
|
|
153
155
|
|
|
154
|
-
Targets
|
|
156
|
+
Targets use their own URL and origin (even inherited), not parent, opener or history. Unknown origins alone are ordinary; unparseable URLs are protected. Protected or unparseable failures and failed inherited-origin reads seal reads and captures. Sealed pages stay listed, attachable and navigable; sealed iframes are tree placeholders. Guards drop sealed content events, even on prior subscriptions, and reduce failed URLs to origins in metadata and Page/Network events. Refusal: `slicc: refused: target is on seven's origin`.
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
Guards withhold protected frames, not their ordinary page. Report mixed state from capture to release: screenshots and screencasts show Seven but blank other protected boxes; refuse PDFs needing blanking.
|
|
157
159
|
|
|
158
|
-
Foreign extension frames cannot be attached or read.
|
|
160
|
+
Foreign extension frames cannot be attached or read. Discovery, snapshots, accessibility trees and evaluate results hide their URLs; the tab remains readable and snapshottable. Screenshots and input require all extension frames to be hidden (no layout box or `visibility: hidden`) and unfocused, even in nested documents or shadow roots. Opacity and position don’t count. Drop screenshots if a frame becomes visible; the check can race the CDP reply. While a frame is present, refuse whole-page captures and new screencasts; stop active casts or drop their frames. Refusals name the extension frame, not seven. `protectedOrigins.extensionFrames` lists schemes, methods and refusals; `protected.mjs` offers `extensionFrame(url)`.
|
|
159
161
|
|
|
160
162
|
`catalog.json`’s `protectedOrigins` holds the rules. `protected.json` tests them across bindings. `protected.mjs` exposes the engine synchronously:
|
|
161
163
|
|
|
@@ -276,7 +278,7 @@ A new discovery behaviour gets a corpus case, and a new guard behaviour gets a g
|
|
|
276
278
|
|
|
277
279
|
CI is [slicc-shared-web's pipeline](https://github.com/ai-ecoverse/slicc-shared-web#pipeline), called from `.github/workflows/ci.yml`. A pull request gets lint, then `npm test` split over shards by timing, then a Claude and a Codex review; the merge queue runs lint and the tests again. Tests run on Linux only.
|
|
278
280
|
|
|
279
|
-
|
|
281
|
+
semantic-release versions all three packages together on qualifying `main` merges. Never move or delete a pushed tag; fix a bad release in the next one.
|
|
280
282
|
|
|
281
283
|
## License
|
|
282
284
|
|
package/catalog.json
CHANGED
|
@@ -791,6 +791,87 @@
|
|
|
791
791
|
},
|
|
792
792
|
"unparseable": "protected",
|
|
793
793
|
"unparseableRefusal": "slicc: refused: slicc can't parse this URL, so it could be a protected page",
|
|
794
|
+
"sealedAllowed": [
|
|
795
|
+
"Page.navigate",
|
|
796
|
+
"Page.reload",
|
|
797
|
+
"Page.navigateToHistoryEntry",
|
|
798
|
+
"Page.stopLoading",
|
|
799
|
+
"Page.getNavigationHistory",
|
|
800
|
+
"Page.close",
|
|
801
|
+
"Page.bringToFront",
|
|
802
|
+
"Page.setLifecycleEventsEnabled",
|
|
803
|
+
"Page.setWebLifecycleState",
|
|
804
|
+
"Page.handleJavaScriptDialog",
|
|
805
|
+
"Target.attachToTarget",
|
|
806
|
+
"Target.detachFromTarget",
|
|
807
|
+
"Target.closeTarget",
|
|
808
|
+
"Target.getTargets",
|
|
809
|
+
"Target.getTargetInfo",
|
|
810
|
+
"Target.activateTarget",
|
|
811
|
+
"Target.setDiscoverTargets",
|
|
812
|
+
"Page.enable",
|
|
813
|
+
"Fetch.enable",
|
|
814
|
+
"Page.disable",
|
|
815
|
+
"Fetch.disable",
|
|
816
|
+
"Runtime.disable",
|
|
817
|
+
"DOM.disable",
|
|
818
|
+
"CSS.disable",
|
|
819
|
+
"Log.disable",
|
|
820
|
+
"Console.disable",
|
|
821
|
+
"Debugger.disable",
|
|
822
|
+
"DOMDebugger.disable",
|
|
823
|
+
"Accessibility.disable",
|
|
824
|
+
"LayerTree.disable",
|
|
825
|
+
"Network.disable",
|
|
826
|
+
"DOMSnapshot.disable",
|
|
827
|
+
"Overlay.disable"
|
|
828
|
+
],
|
|
829
|
+
"sealedEvents": [
|
|
830
|
+
"Page.screencastFrame",
|
|
831
|
+
"Runtime.*",
|
|
832
|
+
"Debugger.*",
|
|
833
|
+
"DOM.*",
|
|
834
|
+
"CSS.*",
|
|
835
|
+
"Log.*",
|
|
836
|
+
"Console.*",
|
|
837
|
+
"Accessibility.*",
|
|
838
|
+
"Overlay.*",
|
|
839
|
+
"LayerTree.*",
|
|
840
|
+
"DOMStorage.*",
|
|
841
|
+
"IndexedDB.*",
|
|
842
|
+
"Animation.*",
|
|
843
|
+
"Audits.*",
|
|
844
|
+
"Media.*",
|
|
845
|
+
"DOMSnapshot.*"
|
|
846
|
+
],
|
|
847
|
+
"sealedContent": [
|
|
848
|
+
"Runtime.evaluate",
|
|
849
|
+
"Runtime.callFunctionOn",
|
|
850
|
+
"Runtime.compileScript",
|
|
851
|
+
"Runtime.runScript",
|
|
852
|
+
"Runtime.awaitPromise",
|
|
853
|
+
"Runtime.getProperties",
|
|
854
|
+
"Runtime.queryObjects",
|
|
855
|
+
"Runtime.globalLexicalScopeNames",
|
|
856
|
+
"Debugger.*",
|
|
857
|
+
"DOMDebugger.*",
|
|
858
|
+
"DOM.*",
|
|
859
|
+
"CSS.*",
|
|
860
|
+
"DOMSnapshot.*",
|
|
861
|
+
"Accessibility.*",
|
|
862
|
+
"LayerTree.*",
|
|
863
|
+
"Overlay.*",
|
|
864
|
+
"Page.getResourceContent",
|
|
865
|
+
"Page.searchInResource",
|
|
866
|
+
"Page.captureSnapshot",
|
|
867
|
+
"Page.captureScreenshot",
|
|
868
|
+
"Page.printToPDF",
|
|
869
|
+
"Page.startScreencast",
|
|
870
|
+
"Page.screencastFrame",
|
|
871
|
+
"IO.read",
|
|
872
|
+
"Network.getResponseBody",
|
|
873
|
+
"Audits.getEncodedResponse"
|
|
874
|
+
],
|
|
794
875
|
"extensionWorlds": {
|
|
795
876
|
"schemes": [
|
|
796
877
|
"chrome-extension",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { Array, Map, Object, Reflect, RegExp, String, Uint8Array, WeakMap } = globalThis;
|
|
2
|
+
const { apply } = Reflect;
|
|
3
|
+
export const method =
|
|
4
|
+
(fn) =>
|
|
5
|
+
(self, ...args) =>
|
|
6
|
+
apply(fn, self, args);
|
|
7
|
+
const getter = (prototype, key) => method(Object.getOwnPropertyDescriptor(prototype, key).get);
|
|
8
|
+
export const typedLength = getter(Object.getPrototypeOf(Uint8Array.prototype), 'length');
|
|
9
|
+
export const byteLength = getter(globalThis.ArrayBuffer.prototype, 'byteLength');
|
|
10
|
+
export const typedSet = method(Uint8Array.prototype.set);
|
|
11
|
+
export const copyWithin = method(Uint8Array.prototype.copyWithin);
|
|
12
|
+
export const fill = method(Uint8Array.prototype.fill);
|
|
13
|
+
export const charCodeAt = method(String.prototype.charCodeAt);
|
|
14
|
+
export const wellFormed = method(String.prototype.toWellFormed);
|
|
15
|
+
export const startsWith = method(String.prototype.startsWith);
|
|
16
|
+
export const exec = method(RegExp.prototype.exec);
|
|
17
|
+
export const includes = method(Array.prototype.includes);
|
|
18
|
+
export const every = method(Array.prototype.every);
|
|
19
|
+
export const weakGet = method(WeakMap.prototype.get);
|
|
20
|
+
export const weakSet = method(WeakMap.prototype.set);
|
|
21
|
+
export const mapGet = method(Map.prototype.get);
|
|
22
|
+
export const mapSet = method(Map.prototype.set);
|
|
23
|
+
export const mapDelete = method(Map.prototype.delete);
|
|
24
|
+
export const forEachEntry = method(Map.prototype.forEach);
|
|
25
|
+
export const deref = method(globalThis.WeakRef.prototype.deref);
|
|
26
|
+
const { setPrototypeOf } = Object;
|
|
27
|
+
export function list(values, convert, accept = () => true) {
|
|
28
|
+
const out = setPrototypeOf([], null);
|
|
29
|
+
for (let i = 0; i < values.length; i++) {
|
|
30
|
+
const v = values[i];
|
|
31
|
+
if (accept(v)) out[out.length] = convert(v);
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
34
|
+
}
|