@ai-ecoverse/slicc-browsers 1.44.0 → 1.46.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
@@ -146,16 +146,16 @@ slicc-cli's `test/integration/corpus_test.go` is a complete harness.
146
146
 
147
147
  ## Protected origins
148
148
 
149
- Browser control must never navigate to, open, attach to, or read the cookies or storage of:
150
- - **seven and the vault**: every `sliccy.ai` host, on any port and scheme, and `vault.sliccy.ai` by name;
151
- - **the browser's own privileged pages**: `chrome://` and the 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;
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;
152
152
  - **a program's extra seven origins**.
153
153
 
154
- URLs are judged the way 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 that seven opened keeps seven's origin when it goes to `about:blank`. A refused call fails with `slicc: refused: target is on seven's origin`.
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`.
155
155
 
156
- A browser extension's frame inside an ordinary page doesn't make the tab protected. The frame itself 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 own 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 while one became shown is thrown away. Opacity and position don't count as hidden. A race between the visibility or focus 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 from the program's own extension, and any other protected frame, still makes the whole tab protected. `protectedOrigins.extensionFrames` lists the schemes, methods and refusals; `protected.mjs` offers `extensionFrame(url)`.
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)`.
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 do not report them. `protected.mjs` is the reference implementation:
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:
159
159
 
160
160
  ```js
161
161
  import catalog from '@ai-ecoverse/slicc-browsers' with { type: 'json' };
@@ -169,6 +169,8 @@ guard.target({ url: 'about:blank', opener: 'protected' });
169
169
 
170
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`.
171
171
 
172
+ Sign-in hosts are ordinary hosts. The catalog keeps `credentialOrigins.origins` for compatibility; its list is empty.
173
+
172
174
  ## Guard vectors
173
175
 
174
176
  A guard sits between a CDP client and the browser and keeps the client away from protected origins. `guard-vectors.json` holds the attacks every guard must pass.
package/catalog.json CHANGED
@@ -703,9 +703,14 @@
703
703
  ]
704
704
  },
705
705
  "protectedOrigins": {
706
- "domains": ["sliccy.ai"],
706
+ "domains": [],
707
707
  "hosts": ["vault.sliccy.ai"],
708
- "keptOrigins": ["https://lease-pilot.sliccy.ai"],
708
+ "zones": [
709
+ {
710
+ "domain": "sliccy.ai",
711
+ "unprotectedLabels": ["get", "mcpcat", "echo", "lease-pilot"]
712
+ }
713
+ ],
709
714
  "schemes": ["https", "http"],
710
715
  "innerSchemes": ["blob", "filesystem", "view-source"],
711
716
  "anySchemes": ["devtools"],
@@ -773,7 +778,7 @@
773
778
  "refusal": "slicc: refused: target is on seven's origin"
774
779
  },
775
780
  "credentialOrigins": {
776
- "origins": ["https://ims-na1.adobelogin.com", "https://ims-na1-stg1.adobelogin.com"],
781
+ "origins": [],
777
782
  "refusal": "slicc: refused: this origin holds sign-in credentials"
778
783
  },
779
784
  "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,