@ai-ecoverse/slicc-browsers 1.47.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 CHANGED
@@ -15,7 +15,7 @@ SLICC drives Chromium over the Chrome DevTools Protocol (CDP). Its Go module, Ru
15
15
  | --- | --- |
16
16
  | [`catalog.json`](catalog.json) | every known Chromium browser and Electron app, and the rules for finding, ranking and launching them ([below](#the-catalog)) |
17
17
  | [`corpus/`](corpus), `corpus.json` | discovery conformance cases: a fake machine each, with the ranked browser list it must produce |
18
- | [`protected.json`](protected.json), [`protected.mjs`](protected.mjs) | protected-origin test vectors, and a reference matcher in JavaScript |
18
+ | [`protected.json`](protected.json), [`protected.mjs`](protected.mjs) | protected-origin test vectors and the engine-backed JavaScript matcher |
19
19
  | [`guard-vectors.json`](guard-vectors.json) | the CDP scenarios every guard must pass |
20
20
  | [`debugger-stage1.json`](debugger-stage1.json) | shared Stage 1 debugger conformance data |
21
21
  | [`guard-runner.mjs`](guard-runner.mjs), [`guard-driver.mjs`](guard-driver.mjs), [`fixture-server.mjs`](fixture-server.mjs) | a reference runner for the guard vectors, its helpers, and the test server they run against |
@@ -75,11 +75,11 @@ 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
- Everything except `./fixture` runs in a browser as well as in Node. `protected.mjs` and `seven.mjs` import nothing, so an extension or a service worker can ship either file on its own.
78
+ Everything except `./fixture` runs in browsers and Node. `protected.mjs` bundles the engine and `seven.mjs` is standalone; neither imports anything. MV3 extensions using the engine need `'wasm-unsafe-eval'` in their extension pages CSP.
79
79
 
80
80
  ## Engine
81
81
 
82
- One rules engine classifies protected origins, targets, cookie domains, storage keys and HAR request URLs. Use Rust's `slicc_browsers::engine::Engine::embedded()?` (feature `engine`), import `engine` or async `loadEngine` from `@ai-ecoverse/slicc-browsers/engine` in JS, or call `engine.Default()` in Go's `github.com/ai-ecoverse/slicc-browsers/engine`. JS and Go run the same import-free wasm (under 512 KiB). Bindings check ABI 1; only incompatible request or answer changes bump it. Treat errors as refusals.
82
+ One rules engine classifies protected origins, targets, cookie domains, storage keys and HAR request URLs. Use Rust's `slicc_browsers::engine::Engine::embedded()?` (feature `engine`), import `engine` or async `loadEngine` from `@ai-ecoverse/slicc-browsers/engine` in JS, or call `engine.Default()` in Go's `github.com/ai-ecoverse/slicc-browsers/engine`. JS and Go run the same import-free wasm (under 512 KiB); on macOS, Go defaults to wazero’s interpreter for hardened-runtime compatibility (wazero issue 2393). Bindings check ABI 1; only incompatible request or answer changes bump it. Treat errors as refusals. `refusal(key)` returns the shared text from `catalog.json`’s `refusals` or errors on an unknown key.
83
83
 
84
84
  ## The catalog
85
85
 
@@ -147,15 +147,15 @@ slicc-cli's `test/integration/corpus_test.go` is a complete harness.
147
147
  ## Protected origins
148
148
 
149
149
  Browser control must never navigate to, open, attach to, or read cookies or storage of:
150
- - **seven and the vault**: `sliccy.ai` hosts one label deep, bar a few listed ones, over HTTP(S), any port; apex-domain cookies too, but not apex or deeper pages;
151
- - **the browser's own privileged pages**: `chrome://` and other Chromium browsers' equivalents, `devtools://`, `chrome-extension://` (where password managers and wallets live), `file://`, and Chrome's own UI targets. The new tab page is the one exception;
150
+ - **seven and the vault**: `sliccy.ai` hosts one label deep, bar a few listed ones, over HTTP(S), any port; apex-domain cookies too, not apex or deeper pages. Unprotected pages there read and write them via `document.cookie` and `cookieStore` as in any browser; CDP filtering is defence in depth; SLICC's cookies are host-only;
151
+ - **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
152
  - **a program's extra seven origins**.
153
153
 
154
- URLs are judged as the browser parses them, so `blob:`, `view-source:` and `about:` aliases, backslashes, encoded dots and full-width letters can't sneak past. A URL the guard can't parse counts as protected wherever the browser might load it. A tab seven opened keeps seven's origin on `about:blank`. A refused call fails with `slicc: refused: target is on seven's origin`.
154
+ All bindings use the same URL parser and apply the rules after unwrapping URL aliases. An unparseable URL is protected wherever the browser might load it. A tab seven opened keeps seven's origin on `about:blank`. A refused call fails with `slicc: refused: target is on seven's origin`.
155
155
 
156
- An extension's frame in an ordinary page doesn't make the tab protected. The frame stays out of reach: it can't be attached or read, and its URL never appears in target discovery, page reads, snapshots, accessibility trees or evaluate results. The tab's page can still be read and snapshotted. Screenshots and input are allowed only while every extension frame is hidden (no layout box or `visibility: hidden`) and none holds focus through nested documents or shadow roots; a screenshot taken as one became shown is dropped. Opacity and position don't count as hidden. A race between that check and the CDP reply is accepted. Whole-page captures and starting a screencast are refused while any extension frame is in the tab; an active screencast is stopped or its frames dropped until the frame is gone. These refusals name the extension frame, not seven. A frame of the program's own extension, or any other protected frame, still protects the whole tab. `protectedOrigins.extensionFrames` lists the schemes, methods and refusals; `protected.mjs` offers `extensionFrame(url)`.
156
+ An extension frame in an ordinary page doesn't protect the tab. The frame can't be attached or read, and its URL never appears in target discovery, page reads, snapshots, accessibility trees or evaluate results. The tab's page can still be read and snapshotted. Screenshots and input are allowed only while every extension frame is hidden (no layout box or `visibility: hidden`) and none holds focus through nested documents or shadow roots; a screenshot taken as one became shown is dropped. Opacity and position don't count as hidden. A race between that check and the CDP reply is accepted. Whole-page captures and new screencasts are refused while any extension frame is in the tab; an active one is stopped or its frames dropped until the frame is gone. These refusals name the extension frame, not seven. The program's own extension frame, like any other protected frame, still protects the whole tab. `protectedOrigins.extensionFrames` lists the schemes, methods and refusals; `protected.mjs` offers `extensionFrame(url)`.
157
157
 
158
- `catalog.json`'s `protectedOrigins` holds the rules, and `protected.json` the vectors: URLs, targets, cookie domains and storage keys, each with the expected answer. A target may carry `contextOrigin`, its default execution context's origin; the rule binds a live context origin too. Origins with leading whitespace or control characters are not exercised: browsers don't report them. `protected.mjs` is the reference implementation:
158
+ `catalog.json`’s `protectedOrigins` holds the rules. `protected.json` tests them across bindings. `protected.mjs` exposes the engine synchronously:
159
159
 
160
160
  ```js
161
161
  import catalog from '@ai-ecoverse/slicc-browsers' with { type: 'json' };
@@ -167,9 +167,9 @@ guard.cookieDomain('.sliccy.ai');
167
167
  guard.target({ url: 'about:blank', opener: 'protected' });
168
168
  ```
169
169
 
170
- It also offers `storageKey(key)` and `unparseable(text)`. A Go or Rust implementation needs a WHATWG URL parser, not `net/url`, and must pass every vector in `protected.json`.
170
+ It also offers `storageKey(key)` and `unparseable(text)`.
171
171
 
172
- Sign-in hosts are ordinary hosts. The catalog keeps `credentialOrigins.origins` for compatibility; its list is empty.
172
+ Sign-in hosts are ordinary. The catalog keeps an empty `credentialOrigins.origins` for compatibility.
173
173
 
174
174
  ## Guard vectors
175
175
 
@@ -261,7 +261,7 @@ Use Go 1.26, rustup (see `rust-toolchain.toml`), Node 24+ and Chrome/Chromium (`
261
261
  | command | what it does |
262
262
  | --- | --- |
263
263
  | `npm run corpus` | rebuilds `corpus.json` from `corpus/` |
264
- | `npm run engine` | rebuilds both artifacts on Linux; on macOS use `-- --out-dir <scratch>` for a non-release build |
264
+ | `npm run engine` | rebuilds the wasm and JS artifacts on Linux; on macOS use `-- --out-dir <scratch>` for a non-release build |
265
265
  | `npm run validate` | checks every file against its schema and the rules a schema can't express, and runs `protected.json` through `protected.mjs` |
266
266
  | `npm run lint` | the JavaScript, Go and Rust linters and formatters, and a `wasm32-wasip1` check of each feature |
267
267
  | `npm test` | every file in `test/integration/`: validation, the Node, Go and Rust tests, and the reference runner against real Chromium with no guard, where every control must pass and every protection must fail |
package/catalog.json CHANGED
@@ -702,6 +702,46 @@
702
702
  }
703
703
  ]
704
704
  },
705
+ "refusals": {
706
+ "surface.protected": "slicc: refused: this page or frame is protected and cannot be read or controlled.",
707
+ "url.invalid": "slicc: refused: this URL could not be parsed. Use a valid absolute URL.",
708
+ "url.navigation": "slicc: refused: this navigation cannot be tied to an allowed destination. Use an absolute page URL.",
709
+ "url.history": "slicc: refused: this history entry has no known destination. Navigate to the page URL instead.",
710
+ "request.redirect": "slicc: refused: this request would follow a protected or unchecked redirect. Choose a direct, allowed URL.",
711
+ "cookie.protectedWrite": "slicc: refused: this change would modify a protected cookie. Change only cookies scoped to ordinary sites.",
712
+ "cookie.unscopedClear": "slicc: refused: clearing this cookie jar would also clear protected cookies. Delete the ordinary cookies individually.",
713
+ "storage.unscoped": "slicc: refused: this change could affect other sites. Specify an ordinary origin or an owned, isolated browser context.",
714
+ "extension.shown": "slicc: refused: an extension frame is visible or focused here. Close it before trying again.",
715
+ "extension.present": "slicc: refused: a full-page capture would include an extension frame. Remove the frame or reload the tab.",
716
+ "extension.transport": "slicc: refused: this browser connection cannot address another extension’s frame. Choose a different frame.",
717
+ "world.foreign": "slicc: refused: this execution context belongs to a browser extension. Use a page context.",
718
+ "world.unavailable": "slicc: refused: this command does not identify an available page context or object. Select one from the current document.",
719
+ "world.profile": "slicc: refused: this profile could include an extension’s scripts. Profile only an isolated, ordinary context.",
720
+ "session.browserWide": "slicc: refused: this operation would affect protected pages outside the selected target.",
721
+ "session.flatten": "slicc: refused: nested browser commands cannot be checked. Attach with flatten: true and send commands on the returned session.",
722
+ "session.pageOnly": "slicc: refused: this session cannot run the command. Use a session for the target the command addresses.",
723
+ "session.unsupported": "slicc: refused: this browser connection does not offer this operation. Select a supported target or command.",
724
+ "session.invalid": "slicc: refused: this command has no active session for that target. Select a current target and attach again.",
725
+ "capability.persistence": "slicc: refused: this setting or script could remain active on a protected document. Change only the current document or request.",
726
+ "capability.debugger": "slicc: refused: this debugger operation is not available in this session. Use a supported operation on the current page.",
727
+ "request.legacy": "slicc: refused: legacy network interception is not supported. Use Fetch on a page session.",
728
+ "request.unseen": "slicc: refused: this session has no record of that request. Use a request ID reported to this session.",
729
+ "request.pause": "slicc: refused: this session has no matching pause at this stage. Wait for its next Fetch event.",
730
+ "request.bodyMode": "slicc: refused: this paused body was already read in another mode. Continue using the first mode.",
731
+ "stream.unissued": "slicc: refused: this session did not issue that stream handle. Use the handle returned for this resource.",
732
+ "stream.unsupported": "slicc: refused: this stream cannot be filtered on this connection. Request the complete body instead.",
733
+ "resource.protected": "slicc: refused: this resource came from a protected source and cannot be returned.",
734
+ "reply.unprojectable": "slicc: refused: the protected fields cannot be separated safely from this answer. Request a narrower result.",
735
+ "session.changed": "slicc: refused: the addressed document changed before this operation finished. Select its current document before trying again.",
736
+ "dialog.unavailable": "slicc: refused: this session has no current dialog it may answer. Answer it in the browser or wait for the next dialog event.",
737
+ "window.scope": "slicc: refused: this command cannot change the selected window. Choose the tab’s own window and a supported size.",
738
+ "session.unguarded": "slicc: refused: the browser connection cannot guard this target. Reconnect before sending another command.",
739
+ "signin.held": "slicc: refused: this sign-in window is reserved for its owner. Finish sign-in in the browser.",
740
+ "signin.unavailable": "slicc: refused: sign-in could not be opened safely on this connection. Reconnect before starting sign-in again.",
741
+ "input.protected": "slicc: refused: this input would reach a protected frame. Choose an ordinary frame.",
742
+ "command.invalid": "slicc: refused: this command is missing valid parameters or a usable call ID. Check the command and send it again.",
743
+ "engine.failure": "slicc: refused: the guard could not check this command. It was not sent."
744
+ },
705
745
  "protectedOrigins": {
706
746
  "domains": [],
707
747
  "hosts": ["vault.sliccy.ai"],