@ai-ecoverse/slicc-browsers 1.43.0 → 1.45.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
@@ -1,13 +1,6 @@
1
1
  # slicc-browsers
2
2
 
3
- The browser knowledge SLICC's tools share. SLICC drives Chromium over the Chrome DevTools Protocol (CDP), and several programs in different languages must agree on facts:
4
-
5
- - which browsers exist, where they are installed, and how to launch them for SLICC;
6
- - how to find a browser that is already running with a debugging port, and which one to pick;
7
- - which origins browser control must never touch, starting with seven and the vault;
8
- - how to prove a CDP guard keeps clients away from them.
9
-
10
- One catalog, four vector sets and schemas, shared as a Go module, Rust crate and npm package at one version.
3
+ SLICC drives Chromium over the Chrome DevTools Protocol (CDP). Its Go module, Rust crate and npm package share one version: a browser catalog, four vector sets and their schemas for finding, selecting and launching browsers and testing CDP guards.
11
4
 
12
5
  | who | uses it for |
13
6
  | --- | --- |
@@ -84,9 +77,11 @@ npm install @ai-ecoverse/slicc-browsers
84
77
 
85
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.
86
79
 
87
- ## The catalog
80
+ ## Engine
88
81
 
89
- `catalog.json` holds everything a program needs to know about browsers:
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.
83
+
84
+ ## The catalog
90
85
 
91
86
  - **Browsers.** Chrome, Edge, Brave, Opera, Vivaldi, Arc, Atlas, Dia and their pre-release channels, Chrome for Testing and Chromium, **in priority order**.
92
87
  - **Electron apps**: known apps by bundle id, and the ones that block remote debugging.
@@ -102,13 +97,11 @@ The catalog is `"schema": 1`. Minor releases only add fields; changing or removi
102
97
 
103
98
  A program lists the browsers it can attach to, from four sources: `DevToolsActivePort` files in known user-data dirs and SLICC profiles, `--cdp` URLs, a port probe, and the process list. It ranks the endpoints, adds the installed browsers it could launch, and prints the list in the shape of [`schema/browsers.schema.json`](schema/browsers.schema.json). Seven's tabs are reported by origin only, never with a path, query or title.
104
99
 
105
- ### The process source
106
-
107
- The process scan finds browsers that something else started with `--remote-debugging-port`. The exact parsing rules are in `catalog.json`'s `discovery.process` and the corpus's `process-*` cases.
100
+ The process scan finds other programs’ `--remote-debugging-port` browsers; see `discovery.process` and the `process-*` corpus cases.
108
101
 
109
102
  ### SLICC six's profiles
110
103
 
111
- SLICC six, the previous generation, launches Chrome in a profile of its own. Discovery lists such an endpoint, marks it `six: true` and ranks it last, but **never picks it by itself**. Only an explicit request uses it. The roots per OS are in `catalog.json`'s `profiles.six`.
104
+ SLICC six launches Chrome in its own profile (`profiles.six` lists the roots per OS). Discovery marks these endpoints `six: true`, ranks them last and selects them **only on explicit request**.
112
105
 
113
106
  ## The corpus
114
107
 
@@ -176,7 +169,7 @@ guard.target({ url: 'about:blank', opener: 'protected' });
176
169
 
177
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`.
178
171
 
179
- Credential origins (`catalog.credentialOrigins`) withhold cookie/storage export and refuse writes; pages stay drivable. Not covered hosts and Domain=.adobe.com stay exportable; see catalog + C7 notes.
172
+ Sign-in hosts are ordinary hosts. The catalog keeps `credentialOrigins.origins` for compatibility; its list is empty.
180
173
 
181
174
  ## Guard vectors
182
175
 
@@ -262,11 +255,12 @@ To find out what a vector checks, read it in `guard-vectors.json`: each one list
262
255
 
263
256
  ## Development
264
257
 
265
- You need Go 1.26, Rust stable with `wasm32-wasip1`, Node 24+, and Chrome or Chromium for the browser tests: they take `CHROME_PATH`, or Chrome for Testing from `npx slicc-cdp install-browser`, and run headless unless `CI` is set (`SLICC_HEADLESS=1` or `0` overrides).
258
+ Use Go 1.26, rustup (see `rust-toolchain.toml`), Node 24+ and Chrome/Chromium (`CHROME_PATH` or `npx slicc-cdp install-browser`). Browser tests run headless outside CI; override with `SLICC_HEADLESS=1` or `0`.
266
259
 
267
260
  | command | what it does |
268
261
  | --- | --- |
269
262
  | `npm run corpus` | rebuilds `corpus.json` from `corpus/` |
263
+ | `npm run engine` | rebuilds both artifacts on Linux; on macOS use `-- --out-dir <scratch>` for a non-release build |
270
264
  | `npm run validate` | checks every file against its schema and the rules a schema can't express, and runs `protected.json` through `protected.mjs` |
271
265
  | `npm run lint` | the JavaScript, Go and Rust linters and formatters, and a `wasm32-wasip1` check of each feature |
272
266
  | `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
@@ -773,7 +773,7 @@
773
773
  "refusal": "slicc: refused: target is on seven's origin"
774
774
  },
775
775
  "credentialOrigins": {
776
- "origins": ["https://ims-na1.adobelogin.com", "https://ims-na1-stg1.adobelogin.com"],
776
+ "origins": [],
777
777
  "refusal": "slicc: refused: this origin holds sign-in credentials"
778
778
  },
779
779
  "profiles": {
package/cookie-plant.mjs CHANGED
@@ -179,39 +179,15 @@ function cookieHeader(name, value, domain, extra = '', domainAttr = null) {
179
179
  return parts.join('; ');
180
180
  }
181
181
 
182
- const hstsPreloaded = (host) => {
183
- const name = String(host ?? '')
184
- .toLowerCase()
185
- .replace(/\.$/, '');
186
- return (
187
- name === 'adobe.com' ||
188
- name.endsWith('.adobe.com') ||
189
- name === 'adobelogin.com' ||
190
- name.endsWith('.adobelogin.com')
191
- );
192
- };
193
-
194
- function fixtureOriginFor(templateUrl, host, { insecurePreloaded = false } = {}) {
182
+ function adobeFixtureOrigin(templateUrl) {
195
183
  try {
196
- const parsed = new URL(templateUrl);
197
- const name = host ?? parsed.hostname;
198
- const port = parsed.port ? `:${parsed.port}` : '';
199
- const scheme =
200
- !insecurePreloaded && hstsPreloaded(name) ? 'https:' : (parsed?.protocol ?? 'http:');
201
- return `${scheme}//${name}${port}`;
184
+ const { port } = new URL(templateUrl);
185
+ return 'https://www.adobe.com' + (port ? ':' + port : '');
202
186
  } catch {
203
- return null;
187
+ return 'https://www.adobe.com';
204
188
  }
205
189
  }
206
190
 
207
- function siteHost(host) {
208
- const parts = String(host ?? '')
209
- .toLowerCase()
210
- .split('.')
211
- .filter(Boolean);
212
- return parts.length >= 2 ? parts.slice(-2).join('.') : String(host ?? '').toLowerCase();
213
- }
214
-
215
191
  function binaryHeaders(pairs) {
216
192
  const chunks = [];
217
193
  for (const { name, value } of pairs) {
@@ -907,14 +883,6 @@ function jarAuditFields(handle, jar) {
907
883
  };
908
884
  }
909
885
 
910
- function evidenceFormOf({ answered, refused, planted }) {
911
- if (answered !== true) return null;
912
- if (refused === true && planted === false) return 'commandRefused';
913
- if (refused === false && planted === true) return 'allowedPlant';
914
- if (refused === false && planted === false) return 'answeredNotPlanted';
915
- return null;
916
- }
917
-
918
886
  async function readJarWithCanary(handle, cookie) {
919
887
  requireAttemptHandle(handle, 'readJarWithCanary');
920
888
  const canary = handle.canary;
@@ -1363,14 +1331,6 @@ async function finishPlant({ out, cookie, notes, label, handle }) {
1363
1331
  ...jarAuditFields(handle, jar),
1364
1332
  ...timingOf(handle),
1365
1333
  };
1366
- if (handle.credential) {
1367
- const form = evidenceFormOf({
1368
- answered: evidence.answered,
1369
- refused: evidence.refused,
1370
- planted,
1371
- });
1372
- if (form) evidence.evidenceForm = form;
1373
- }
1374
1334
  note(notes, `cookie-plant.${label}`, evidence);
1375
1335
  return attemptRecord(out, planted);
1376
1336
  }
@@ -2670,11 +2630,8 @@ const FETCH_PATH_NAMES = [
2670
2630
  'continueAtRequest',
2671
2631
  ];
2672
2632
 
2673
- const CREDENTIAL_PATH_NAMES = ['hostOnly', 'domainCover', 'subHost'];
2674
-
2675
2633
  const ALL_PATH_NAMES = [
2676
2634
  ...FETCH_PATH_NAMES,
2677
- ...CREDENTIAL_PATH_NAMES,
2678
2635
  'legacyHeaders',
2679
2636
  'legacyRaw',
2680
2637
  'ordinary',
@@ -2894,7 +2851,6 @@ async function freshAttemptTab(ctx, run, retry) {
2894
2851
  browserContextId: tabContextId,
2895
2852
  browserContexts: Boolean(ctx.browserContexts),
2896
2853
  canary,
2897
- credential: Boolean(ctx.credential),
2898
2854
  transport: enabled.transport,
2899
2855
  fetchEnable: enabled.fetchEnable ?? null,
2900
2856
  internalSessions,
@@ -3842,8 +3798,7 @@ function controlAttacks(ctx) {
3842
3798
  adobe: () =>
3843
3799
  withFreshAttemptTab(ctx, (handle) => {
3844
3800
  const fetchReady = Boolean(handle.transport?.fetch);
3845
- const adobeOrigin =
3846
- fixtureOriginFor(ctx.ordinary, 'www.adobe.com') ?? 'https://www.adobe.com';
3801
+ const adobeOrigin = adobeFixtureOrigin(ctx.ordinary);
3847
3802
  const adobeCookie = {
3848
3803
  name: ctx.names.adobe,
3849
3804
  value: `a-${ctx.tag}`,
@@ -3965,7 +3920,6 @@ function fillMissingAttempts(results, legacyReady) {
3965
3920
  if (results[name]) continue;
3966
3921
  if (!legacyReady && (name === 'legacyHeaders' || name === 'legacyRaw'))
3967
3922
  results[name] = notSupportedAttempt();
3968
- else if (CREDENTIAL_PATH_NAMES.includes(name)) results[name] = notSupportedAttempt();
3969
3923
  else results[name] = EMPTY_ATTEMPT;
3970
3924
  }
3971
3925
  }
@@ -4130,138 +4084,7 @@ function legacySetupValue(setup, notes) {
4130
4084
  return 'not-supported';
4131
4085
  }
4132
4086
 
4133
- function credentialAttacks(ctx) {
4134
- if (!ctx.credential) return null;
4135
- const hostOnlyUrl = ctx.plantUrl;
4136
- const hostOnlyCookie = {
4137
- name: ctx.names.plant,
4138
- value: `ho-${ctx.tag}`,
4139
- domain: hostOf(hostOnlyUrl) || ctx.credentialHost,
4140
- url: `${ctx.plantOrigin}/`,
4141
- };
4142
- const coverCookie = {
4143
- name: ctx.names.plant,
4144
- value: `dc-${ctx.tag}`,
4145
- domain: ctx.credentialSiteDomain,
4146
- url: `${ctx.plantOrigin}/`,
4147
- };
4148
- const subHost = `x.${ctx.credentialHost}`;
4149
- const idpFixture =
4150
- fixtureOriginFor(ctx.plantOrigin ?? ctx.ordinary, ctx.credentialHost) ??
4151
- fixtureOriginFor(ctx.ordinary, ctx.credentialHost);
4152
- const subUrl = `${fixtureOriginFor(idpFixture ?? ctx.ordinary, subHost) ?? `https://${subHost}`}/data?n=sub-${ctx.tag}`;
4153
- const diag = (handle) => ({
4154
- handle,
4155
- budget: ctx.budget,
4156
- notes: ctx.notes,
4157
- fixtureLog: ctx.fixtureLog,
4158
- legStartedAt: ctx.legStartedAt,
4159
- firstIncomplete: ctx.firstIncomplete,
4160
- });
4161
- return {
4162
- hostOnly: () =>
4163
- withFreshAttemptTab(ctx, (handle) => {
4164
- const fetchReady = Boolean(handle.transport?.fetch);
4165
- return runPlant({
4166
- ...diag(handle),
4167
- url: hostOnlyUrl,
4168
- cookie: hostOnlyCookie,
4169
- label: 'hostOnly',
4170
- topLevel: true,
4171
- build: () =>
4172
- fetchReady
4173
- ? fetchFulfill({
4174
- responseHeaders: [
4175
- { name: 'content-type', value: 'text/plain' },
4176
- {
4177
- name: 'Set-Cookie',
4178
- value: cookieHeader(ctx.names.plant, hostOnlyCookie.value, null),
4179
- },
4180
- ],
4181
- body: b64text('ok'),
4182
- })
4183
- : legacyContinue({
4184
- rawResponse: rawHttpResponse({
4185
- code: 200,
4186
- phrase: 'OK',
4187
- headers: [
4188
- {
4189
- name: 'Set-Cookie',
4190
- value: cookieHeader(ctx.names.plant, hostOnlyCookie.value, null),
4191
- },
4192
- ],
4193
- body: 'ok',
4194
- }),
4195
- }),
4196
- });
4197
- }),
4198
- domainCover: () =>
4199
- withFreshAttemptTab(ctx, (handle) => {
4200
- const fetchReady = Boolean(handle.transport?.fetch);
4201
- return runPlant({
4202
- ...diag(handle),
4203
- url: subUrl,
4204
- cookie: coverCookie,
4205
- label: 'domainCover',
4206
- topLevel: true,
4207
- build: () =>
4208
- fetchReady
4209
- ? fetchFulfill({
4210
- responseHeaders: [
4211
- { name: 'content-type', value: 'text/plain' },
4212
- {
4213
- name: 'Set-Cookie',
4214
- value: cookieHeader(
4215
- ctx.names.plant,
4216
- coverCookie.value,
4217
- ctx.credentialSiteDomain
4218
- ),
4219
- },
4220
- ],
4221
- body: b64text('ok'),
4222
- })
4223
- : legacyContinue({
4224
- rawResponse: rawHttpResponse({
4225
- code: 200,
4226
- phrase: 'OK',
4227
- headers: [
4228
- {
4229
- name: 'Set-Cookie',
4230
- value: cookieHeader(
4231
- ctx.names.plant,
4232
- coverCookie.value,
4233
- ctx.credentialSiteDomain
4234
- ),
4235
- },
4236
- ],
4237
- body: 'ok',
4238
- }),
4239
- }),
4240
- });
4241
- }),
4242
- subHost: () =>
4243
- withFreshAttemptTab(ctx, (handle) => {
4244
- const fetchReady = Boolean(handle.transport?.fetch);
4245
- const subCookie = {
4246
- name: ctx.names.ordinary,
4247
- value: `sub-${ctx.tag}`,
4248
- domain: `.${subHost}`,
4249
- url: `${fixtureOriginFor(idpFixture ?? ctx.ordinary, subHost) ?? `https://${subHost}`}/`,
4250
- };
4251
- return allowedHeaderAttempt({
4252
- ...diag(handle),
4253
- url: subUrl,
4254
- label: 'subHost',
4255
- header: cookieHeader(ctx.names.ordinary, subCookie.value, `.${subHost}`),
4256
- cookie: subCookie,
4257
- fetchReady,
4258
- topLevel: true,
4259
- });
4260
- }),
4261
- };
4262
- }
4263
-
4264
- function sessionBlockedPlantResults(credential, notes = []) {
4087
+ function sessionBlockedPlantResults(notes = []) {
4265
4088
  const blocked = Object.fromEntries(
4266
4089
  ALL_PATH_NAMES.filter((name) => !['ordinary', 'adobe', 'deletion'].includes(name)).map(
4267
4090
  (name) => [
@@ -4287,7 +4110,6 @@ function sessionBlockedPlantResults(credential, notes = []) {
4287
4110
  );
4288
4111
  return finishCookiePlant({
4289
4112
  control: false,
4290
- credential,
4291
4113
  fetch: false,
4292
4114
  legacy: false,
4293
4115
  evidenceIncomplete: true,
@@ -4431,7 +4253,6 @@ async function openPlantClient({
4431
4253
  notes,
4432
4254
  internalSessions,
4433
4255
  control,
4434
- credential,
4435
4256
  tag,
4436
4257
  browserContextId = null,
4437
4258
  }) {
@@ -4475,7 +4296,7 @@ async function openPlantClient({
4475
4296
  if (enabled.incomplete) {
4476
4297
  await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
4477
4298
  if (sessionCut({ ok: false, error: { message: enabled.incomplete } }) && !control)
4478
- return { done: sessionBlockedPlantResults(credential, notes) };
4299
+ return { done: sessionBlockedPlantResults(notes) };
4479
4300
  return { done: { live: true, incomplete: enabled.incomplete } };
4480
4301
  }
4481
4302
  if (
@@ -4486,7 +4307,7 @@ async function openPlantClient({
4486
4307
  )
4487
4308
  ) {
4488
4309
  await outcome(reader.send('Target.closeTarget', { targetId: pageTarget }));
4489
- return { done: sessionBlockedPlantResults(credential, notes) };
4310
+ return { done: sessionBlockedPlantResults(notes) };
4490
4311
  }
4491
4312
  return { readerSession, pageTarget, pageSession, enabled };
4492
4313
  }
@@ -4501,8 +4322,6 @@ export async function cookiePlant({
4501
4322
  notes = [],
4502
4323
  budget = 5000,
4503
4324
  control = false,
4504
- mode = 'set-cookie',
4505
- credentialOrigin,
4506
4325
  fixtureLog,
4507
4326
  blockedMarkers,
4508
4327
  onlyPaths = null,
@@ -4511,27 +4330,18 @@ export async function cookiePlant({
4511
4330
  browserContexts = false,
4512
4331
  }) {
4513
4332
  if (!reader) return { incomplete: 'missing unguarded reader' };
4514
- const credential = mode === 'credential' || mode === 'credential-set-cookie';
4515
- const sourceOrigin = credential ? (credentialOrigin ?? protectedOrigin) : protectedOrigin;
4516
- if (!sourceOrigin) return { incomplete: 'missing protected origin' };
4333
+ if (!protectedOrigin) return { incomplete: 'missing protected origin' };
4517
4334
  if (!ordinary) return { incomplete: 'missing ordinary origin' };
4518
4335
 
4519
4336
  const names = cookieNames(tag);
4520
- const credentialHost = hostOf(sourceOrigin);
4521
- const mappedOrigin = fixtureOriginFor(ordinary, credentialHost) ?? sourceOrigin;
4522
- const plantOrigin = control ? ordinary : credential ? mappedOrigin : sourceOrigin;
4523
- const credentialSiteDomain = `.${siteHost(credentialHost)}`;
4524
- const domain = credential
4525
- ? control
4526
- ? `.${hostOf(ordinary)}`
4527
- : credentialSiteDomain
4528
- : `.${hostOf(plantOrigin)}`;
4337
+ const plantOrigin = control ? ordinary : protectedOrigin;
4338
+ const domain = `.${hostOf(plantOrigin)}`;
4529
4339
  const homeUrl = `${ordinary}/doc?n=cookie-plant-${tag}`;
4530
4340
 
4531
4341
  const door = await proveDoorOnOwnTab({
4532
4342
  reader,
4533
4343
  homeUrl,
4534
- doorOrigin: credential ? mappedOrigin : sourceOrigin,
4344
+ doorOrigin: protectedOrigin,
4535
4345
  tag,
4536
4346
  budget,
4537
4347
  notes,
@@ -4549,7 +4359,6 @@ export async function cookiePlant({
4549
4359
  notes,
4550
4360
  internalSessions,
4551
4361
  control,
4552
- credential,
4553
4362
  tag,
4554
4363
  browserContextId,
4555
4364
  });
@@ -4580,20 +4389,17 @@ export async function cookiePlant({
4580
4389
  tag,
4581
4390
  names,
4582
4391
  plantOrigin,
4583
- protectedOrigin: sourceOrigin,
4392
+ protectedOrigin,
4584
4393
  ordinary,
4585
4394
  homeUrl,
4586
4395
  transport,
4587
4396
  budget,
4588
4397
  notes,
4589
4398
  internalSessions,
4590
- credential,
4591
- credentialHost,
4592
- credentialSiteDomain,
4593
4399
  fixtureLog,
4594
4400
  legStartedAt: Date.now(),
4595
4401
  firstIncomplete: { noted: false },
4596
- guardedProtected: !control && !credential,
4402
+ guardedProtected: !control,
4597
4403
  control: Boolean(control),
4598
4404
  blockedMarkers: Array.isArray(blockedMarkers) ? blockedMarkers : [],
4599
4405
  proofTag: tag,
@@ -4606,12 +4412,7 @@ export async function cookiePlant({
4606
4412
  const { results, ran } = await runAttempts(
4607
4413
  control
4608
4414
  ? [controlAttacks(ctx)]
4609
- : [
4610
- controlAttacks(ctx),
4611
- fetchAttacks(ctx),
4612
- legacyAttacks(ctx, legacyReady),
4613
- credential ? credentialAttacks(ctx) : null,
4614
- ],
4415
+ : [controlAttacks(ctx), fetchAttacks(ctx), legacyAttacks(ctx, legacyReady)],
4615
4416
  budget,
4616
4417
  onlyPaths,
4617
4418
  legacyReady,
@@ -4632,7 +4433,6 @@ export async function cookiePlant({
4632
4433
 
4633
4434
  return finishCookiePlant({
4634
4435
  control,
4635
- credential,
4636
4436
  fetch: Boolean(transport.fetch),
4637
4437
  legacy: Boolean(legacyReady),
4638
4438
  legacySetupRefused,
@@ -4650,7 +4450,6 @@ function doorPremiseMissed(door) {
4650
4450
 
4651
4451
  function finishCookiePlant({
4652
4452
  control,
4653
- credential,
4654
4453
  fetch,
4655
4454
  legacy,
4656
4455
  legacySetupRefused = 'not-supported',
@@ -4665,7 +4464,6 @@ function finishCookiePlant({
4665
4464
  fetch,
4666
4465
  legacy,
4667
4466
  legacySetupRefused,
4668
- credential,
4669
4467
  ...(evidenceIncomplete && !control
4670
4468
  ? { incomplete: 'protected plant evidence incomplete' }
4671
4469
  : {}),
@@ -4681,7 +4479,6 @@ export const cookiePlantHandleApi = {
4681
4479
  requireAttemptHandle,
4682
4480
  jarContextIncomplete,
4683
4481
  jarAuditFields,
4684
- evidenceFormOf,
4685
4482
  plantCanary,
4686
4483
  clearCookie,
4687
4484
  readJar,