@braidlabs/core 0.6.0 → 0.7.1

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.
Files changed (75) hide show
  1. package/package.json +1 -1
  2. package/src/adapters/adapter.d.ts +11 -0
  3. package/src/adapters/adapter.js.map +1 -1
  4. package/src/adapters/compat-adapter.js +2 -2
  5. package/src/adapters/compat-adapter.js.map +1 -1
  6. package/src/compat/born-inert-scripts.d.ts +2 -0
  7. package/src/compat/born-inert-scripts.js +39 -0
  8. package/src/compat/born-inert-scripts.js.map +1 -1
  9. package/src/compat/cookie-partition.d.ts +25 -0
  10. package/src/compat/cookie-partition.js +79 -0
  11. package/src/compat/cookie-partition.js.map +1 -0
  12. package/src/compat/document-member-classification.js +3 -2
  13. package/src/compat/document-member-classification.js.map +1 -1
  14. package/src/compat/document-overrides.d.ts +6 -6
  15. package/src/compat/document-overrides.js +23 -0
  16. package/src/compat/document-overrides.js.map +1 -1
  17. package/src/compat/fragment-boundary.d.ts +5 -0
  18. package/src/compat/fragment-boundary.js +291 -36
  19. package/src/compat/fragment-boundary.js.map +1 -1
  20. package/src/compat/html-policy.d.ts +50 -0
  21. package/src/compat/html-policy.js +155 -0
  22. package/src/compat/html-policy.js.map +1 -0
  23. package/src/compat/realm-patches.d.ts +2 -1
  24. package/src/compat/realm-patches.js +117 -3
  25. package/src/compat/realm-patches.js.map +1 -1
  26. package/src/compat/script-execution.d.ts +24 -0
  27. package/src/compat/script-execution.js +177 -10
  28. package/src/compat/script-execution.js.map +1 -1
  29. package/src/compat/storage-partition.d.ts +47 -0
  30. package/src/compat/storage-partition.js +291 -0
  31. package/src/compat/storage-partition.js.map +1 -0
  32. package/src/compat/subresource-urls.d.ts +41 -0
  33. package/src/compat/subresource-urls.js +133 -0
  34. package/src/compat/subresource-urls.js.map +1 -0
  35. package/src/config.d.ts +28 -0
  36. package/src/config.js +24 -0
  37. package/src/config.js.map +1 -1
  38. package/src/elements/boot-gate.d.ts +47 -0
  39. package/src/elements/boot-gate.js +207 -0
  40. package/src/elements/boot-gate.js.map +1 -0
  41. package/src/elements/fragment-slot.d.ts +62 -15
  42. package/src/elements/fragment-slot.js +388 -26
  43. package/src/elements/fragment-slot.js.map +1 -1
  44. package/src/elements/late-content.d.ts +44 -0
  45. package/src/elements/late-content.js +107 -0
  46. package/src/elements/late-content.js.map +1 -0
  47. package/src/elements/prefetch.d.ts +27 -0
  48. package/src/elements/prefetch.js +100 -0
  49. package/src/elements/prefetch.js.map +1 -0
  50. package/src/elements/prerequisites.d.ts +42 -0
  51. package/src/elements/prerequisites.js +133 -0
  52. package/src/elements/prerequisites.js.map +1 -0
  53. package/src/elements/recovery.d.ts +46 -0
  54. package/src/elements/recovery.js +59 -0
  55. package/src/elements/recovery.js.map +1 -0
  56. package/src/env/create-env.js +2 -1
  57. package/src/env/create-env.js.map +1 -1
  58. package/src/env/fragment-env.d.ts +6 -0
  59. package/src/errors.d.ts +4 -1
  60. package/src/errors.js +2 -0
  61. package/src/errors.js.map +1 -1
  62. package/src/index.d.ts +5 -1
  63. package/src/index.js +11 -1
  64. package/src/index.js.map +1 -1
  65. package/src/realm/realm-manager.js +23 -0
  66. package/src/realm/realm-manager.js.map +1 -1
  67. package/src/weave/capabilities.d.ts +35 -7
  68. package/src/weave/capabilities.js +17 -0
  69. package/src/weave/capabilities.js.map +1 -1
  70. package/src/weave/guest.d.ts +2 -0
  71. package/src/weave/guest.js +2 -1
  72. package/src/weave/guest.js.map +1 -1
  73. package/src/weave/messages.d.ts +24 -0
  74. package/src/weave/messages.js +22 -0
  75. package/src/weave/messages.js.map +1 -1
@@ -3,6 +3,7 @@
3
3
  * arbitrary pre-bound native method wrappers. */
4
4
  import { assert } from '../utils/assert.js';
5
5
  import { getInternalReference } from './metadata.js';
6
+ import { isRunnable, markRunnable } from './born-inert-scripts.js';
6
7
  /**
7
8
  * Script execution machinery for compat fragments: any script that enters a fragment's DOM is
8
9
  * neutralized in the main document (an inert placeholder keeps the DOM shape the app expects)
@@ -21,10 +22,16 @@ export function compatDomInsertion(nodeToInsert, doInsertTheNode, realmDocument)
21
22
  // if the child is a script, then append and execute it in the fragment's realm
22
23
  if (nodeToInsert instanceof HTMLScriptElement) {
23
24
  // if the child is an unattached inline script that doesn't yet have any text content, then we need to treat it in a special way
24
- if (!nodeToInsert.src && !nodeToInsert.firstChild && !nodeToInsert.parentNode) {
25
+ if (!nodeToInsert.src && !nodeToInsert.firstChild && !nodeToInsert.parentNode && isRunnable(nodeToInsert)) {
25
26
  prepareUnattachedInlineScript(nodeToInsert, realmDocument);
26
27
  return doInsertTheNode();
27
28
  }
29
+ markStartedBeforeInsertion(nodeToInsert);
30
+ // a script nothing of Braid's or the fragment's own document made, or one that has run: it
31
+ // never runs (again) anywhere — and, marked started, cannot in the host either
32
+ if (!isRunnable(nodeToInsert) || alreadyExecutedScriptsAndLinks.has(nodeToInsert)) {
33
+ return doInsertTheNode();
34
+ }
28
35
  setInertScriptType(nodeToInsert);
29
36
  const returnVal = doInsertTheNode();
30
37
  restoreScriptType(nodeToInsert);
@@ -45,6 +52,7 @@ export function compatDomInsertion(nodeToInsert, doInsertTheNode, realmDocument)
45
52
  return doInsertTheNode();
46
53
  }
47
54
  // otherwise, append the child and execute all nested scripts in the fragment's realm
55
+ markStartedBeforeInsertion(nodeToInsert);
48
56
  nestedScriptsAndLinks.forEach((element) => makeElementInert(element));
49
57
  const returnVal = doInsertTheNode();
50
58
  nestedScriptsAndLinks.forEach((element) => restoreElement(element));
@@ -67,6 +75,9 @@ export function compatMultiNodeDomInsertion(nodes, doInsertTheNodes, realmDocume
67
75
  }
68
76
  const scriptsAndLinks = [];
69
77
  for (const node of nodes) {
78
+ if (typeof node !== 'string' && !(node instanceof HTMLScriptElement && !node.src && !node.firstChild && !node.parentNode && isRunnable(node))) {
79
+ markStartedBeforeInsertion(node);
80
+ }
70
81
  if (typeof node === 'string') {
71
82
  console.warn('Braid compat: string arguments to append/prepend/replaceChildren/replaceWith are not supported and could result in incorrect script execution. Inserted string: ', node);
72
83
  continue;
@@ -75,7 +86,7 @@ export function compatMultiNodeDomInsertion(nodes, doInsertTheNodes, realmDocume
75
86
  patchSpecialHtmlElement(node, realmDocument);
76
87
  }
77
88
  if (node instanceof HTMLScriptElement) {
78
- if (!node.src && !node.firstChild && !node.parentNode) {
89
+ if (!node.src && !node.firstChild && !node.parentNode && isRunnable(node)) {
79
90
  prepareUnattachedInlineScript(node, realmDocument);
80
91
  }
81
92
  else {
@@ -106,6 +117,7 @@ function makeElementInert(element) {
106
117
  }
107
118
  function restoreElement(element) {
108
119
  if (element instanceof HTMLScriptElement) {
120
+ // safe to give back its real type: the element was marked started before it was inserted
109
121
  restoreScriptType(element);
110
122
  }
111
123
  else {
@@ -161,10 +173,13 @@ export function executeInertScript(inertScript, realmDocument) {
161
173
  if (alreadyExecutedScriptsAndLinks.has(inertScript)) {
162
174
  return false;
163
175
  }
176
+ // nor one that was never Braid's or the fragment's own to run (see `isRunnable`)
177
+ if (!isRunnable(inertScript)) {
178
+ return false;
179
+ }
164
180
  // If the script does not have a valid type attribute, treat the script node as a data block.
165
181
  // Data blocks live in the main document as-is.
166
- const validScriptTypes = ['module', 'text/javascript', 'importmap', 'speculationrules', '', null];
167
- if (!validScriptTypes.includes(inertScript.getAttribute('type'))) {
182
+ if (!isExecutableType(inertScript.getAttribute('type'))) {
168
183
  return false;
169
184
  }
170
185
  assert(!!(inertScript.src || inertScript.textContent), `Can't execute script without src or textContent!`);
@@ -232,6 +247,34 @@ export function attachScriptToRealm({ inertScript, execScript, realmDocument, })
232
247
  getInternalReference(realmDocument, 'body').appendChild(execScript);
233
248
  alreadyExecutedScriptsAndLinks.add(inertScript);
234
249
  }
250
+ /**
251
+ * The preload links Braid itself made inert (`rel="inert-*"`), and so may bring back to life. A link
252
+ * the fragment's markup wrote with that rel is a forgery of the marker: natively it does nothing,
253
+ * and here it stays that way. Scripts are decided by provenance instead — see `isRunnable`.
254
+ */
255
+ const braidInertLinks = new WeakSet();
256
+ export function isBraidInertLink(link) {
257
+ return braidInertLinks.has(link);
258
+ }
259
+ export function markBraidInertLink(link) {
260
+ braidInertLinks.add(link);
261
+ }
262
+ export { isRunnable, markRunnable };
263
+ /** The marker selector: what Braid neutralizes, and the gateway too. */
264
+ export const INERT_SELECTOR = 'script[type="inert"],link[rel="inert-preload"],link[rel="inert-prefetch"],link[rel="inert-modulepreload"]';
265
+ /**
266
+ * Marks the gateway's prepared content under `root` as Braid's: its scripts may run, its inert links
267
+ * may be revived. Template contents included, which a selector does not enter.
268
+ */
269
+ export function markGatewayContent(root) {
270
+ const roots = [root];
271
+ while (roots.length) {
272
+ const current = roots.pop();
273
+ current.querySelectorAll('script').forEach((script) => markRunnable(script));
274
+ current.querySelectorAll('link[rel^="inert-"]').forEach((link) => markBraidInertLink(link));
275
+ current.querySelectorAll('template').forEach((template) => roots.push(template.content));
276
+ }
277
+ }
235
278
  /**
236
279
  * Set the type attribute of a script element to "inert".
237
280
  *
@@ -239,23 +282,146 @@ export function attachScriptToRealm({ inertScript, execScript, realmDocument, })
239
282
  * the main document.
240
283
  */
241
284
  export function setInertScriptType(script) {
285
+ // `.type`, so a shadowed script (born inert, or kept inert) reports its real type
242
286
  const scriptType = script.type;
287
+ // always written, never kept: markup must not supply the "real" type Braid restores. Native
288
+ // methods, because a shadowed script's own redirect `type` writes to `data-script-type`.
243
289
  if (scriptType) {
244
- script.setAttribute('data-script-type', scriptType);
290
+ nativeSetAttribute.call(script, 'data-script-type', scriptType);
291
+ }
292
+ else {
293
+ nativeRemoveAttribute.call(script, 'data-script-type');
294
+ }
295
+ nativeSetAttribute.call(script, 'type', 'inert');
296
+ }
297
+ /** The JavaScript MIME type essences a browser runs as a classic script (HTML, "JavaScript MIME type"). */
298
+ const JAVASCRIPT_MIME_TYPES = new Set([
299
+ 'application/ecmascript', 'application/javascript', 'application/x-ecmascript', 'application/x-javascript',
300
+ 'text/ecmascript', 'text/javascript', 'text/javascript1.0', 'text/javascript1.1', 'text/javascript1.2',
301
+ 'text/javascript1.3', 'text/javascript1.4', 'text/javascript1.5', 'text/jscript', 'text/livescript',
302
+ 'text/x-ecmascript', 'text/x-javascript',
303
+ ]);
304
+ /**
305
+ * Whether a browser would run a script of this type, as the HTML spec decides it: absent or empty is
306
+ * classic, and otherwise the type is trimmed and compared case-insensitively. Anything else is a
307
+ * data block.
308
+ */
309
+ export function isExecutableType(type) {
310
+ if (type === null)
311
+ return true;
312
+ const essence = type.trim().toLowerCase();
313
+ return essence === '' || essence === 'module' || essence === 'importmap' || essence === 'speculationrules' || JAVASCRIPT_MIME_TYPES.has(essence);
314
+ }
315
+ /**
316
+ * The host document never runs a fragment's script: Braid runs a fresh copy in the realm instead.
317
+ * But a host element the browser has not marked "already started" is one it will run — when it is
318
+ * next connected (the host moving the slot, a keyed list reordering, a portal), or when its type,
319
+ * text or `src` changes. So before a script is inserted into the fragment's DOM, it is marked
320
+ * started the browser's own way: connected once to a document with no browsing context, under an
321
+ * executable type and with some text. Preparing it there sets the flag, then stops because scripting
322
+ * is disabled, and the flag survives the move into the host. Its real attributes are put back, and
323
+ * it can never run in the host, whatever happens to it after.
324
+ */
325
+ let parkingDocument;
326
+ const startedInHost = new WeakSet();
327
+ function scriptsIn(root) {
328
+ if (root instanceof HTMLScriptElement)
329
+ return [root];
330
+ if (root instanceof Element || root instanceof DocumentFragment)
331
+ return [...root.querySelectorAll('script')];
332
+ return [];
333
+ }
334
+ /** Arms each script for marking: an executable type and some text, returning how to undo it. */
335
+ function primeForMarking(scripts) {
336
+ const saved = scripts.map((script) => {
337
+ const type = nativeGetAttribute.call(script, 'type');
338
+ const emptied = !script.hasAttribute('src') && script.textContent === '';
339
+ nativeSetAttribute.call(script, 'type', 'text/javascript');
340
+ if (emptied)
341
+ script.textContent = '//';
342
+ return { script, type, emptied };
343
+ });
344
+ return () => {
345
+ for (const { script, type, emptied } of saved) {
346
+ if (type === null)
347
+ nativeRemoveAttribute.call(script, 'type');
348
+ else
349
+ nativeSetAttribute.call(script, 'type', type);
350
+ if (emptied)
351
+ script.textContent = '';
352
+ startedInHost.add(script);
353
+ }
354
+ };
355
+ }
356
+ function parkingBody() {
357
+ parkingDocument ??= document.implementation.createHTMLDocument('');
358
+ return parkingDocument.body;
359
+ }
360
+ /** Marks the scripts in a node about to be inserted, before it reaches the fragment's DOM. */
361
+ export function markStartedBeforeInsertion(root) {
362
+ const scripts = scriptsIn(root).filter((script) => !startedInHost.has(script));
363
+ if (!scripts.length)
364
+ return;
365
+ const restore = primeForMarking(scripts);
366
+ const body = parkingBody();
367
+ if (root instanceof DocumentFragment) {
368
+ const children = [...root.childNodes];
369
+ nativeAppend.call(body, ...children);
370
+ nativeFragmentAppend.call(root, ...children);
371
+ }
372
+ else {
373
+ const parent = root.parentNode;
374
+ const next = root.nextSibling;
375
+ nativeAppendChild.call(body, root);
376
+ if (parent)
377
+ nativeInsertBefore.call(parent, root, next);
378
+ else
379
+ nativeRemove.call(root);
380
+ }
381
+ restore();
382
+ }
383
+ /**
384
+ * Marks scripts already in the fragment's DOM — the gateway's markup, or a script that arrived by a
385
+ * path the boundary does not intercept — by moving each out and back.
386
+ */
387
+ export function markStartedInPlace(root) {
388
+ const scripts = [...root.querySelectorAll('script')].filter((script) => !startedInHost.has(script));
389
+ if (root instanceof HTMLScriptElement && !startedInHost.has(root))
390
+ scripts.unshift(root);
391
+ if (!scripts.length)
392
+ return;
393
+ const restore = primeForMarking(scripts);
394
+ const body = parkingBody();
395
+ for (const script of scripts) {
396
+ const parent = script.parentNode;
397
+ const next = script.nextSibling;
398
+ nativeAppendChild.call(body, script);
399
+ if (parent)
400
+ nativeInsertBefore.call(parent, script, next);
401
+ else
402
+ nativeRemove.call(script);
245
403
  }
246
- script.setAttribute('type', 'inert');
404
+ restore();
247
405
  }
406
+ const nativeAppendChild = Node.prototype.appendChild;
407
+ const nativeInsertBefore = Node.prototype.insertBefore;
408
+ const nativeRemove = Element.prototype.remove;
409
+ const nativeAppend = Element.prototype.append;
410
+ const nativeFragmentAppend = DocumentFragment.prototype.append;
248
411
  /**
249
412
  * Restore the original script type and erase any signs of us making the script inert.
250
413
  */
251
414
  export function restoreScriptType(script) {
252
- const scriptType = script.getAttribute('data-script-type');
253
- script.removeAttribute('data-script-type');
254
- script.removeAttribute('type');
415
+ const scriptType = nativeGetAttribute.call(script, 'data-script-type');
416
+ nativeRemoveAttribute.call(script, 'data-script-type');
417
+ nativeRemoveAttribute.call(script, 'type');
255
418
  if (scriptType) {
256
- script.setAttribute('type', scriptType);
419
+ nativeSetAttribute.call(script, 'type', scriptType);
257
420
  }
258
421
  }
422
+ const nativeSetAttribute = Element.prototype.setAttribute;
423
+ const nativeGetAttribute = Element.prototype.getAttribute;
424
+ const nativeRemoveAttribute = Element.prototype.removeAttribute;
259
425
  /**
260
426
  * Neutralizes the original link, so that it doesn't result in a duplicate network call.
261
427
  */
@@ -263,6 +429,7 @@ export function setInertLinkRel(link) {
263
429
  const linkRel = link.rel;
264
430
  if (linkRel) {
265
431
  link.rel = 'inert-' + linkRel;
432
+ markBraidInertLink(link);
266
433
  }
267
434
  }
268
435
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"script-execution.js","sourceRoot":"","sources":["../../../../../libs/core/src/compat/script-execution.ts"],"names":[],"mappings":"AAAA;;iDAEiD;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD;;;;GAIG;AAEH,MAAM,UAAU,kBAAkB,CAChC,YAAe,EACf,eAAyB,EACzB,aAAwB;IAExB,gGAAgG;IAChG,iGAAiG;IACjG,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,YAAY,YAAY,WAAW,IAAI,YAAY,YAAY,gBAAgB,CAAC,EAAE,CAAC;QACzG,OAAO,eAAe,EAAE,CAAC;IAC3B,CAAC;IAED,kHAAkH;IAClH,IAAI,YAAY,YAAY,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,YAAY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,CAAC;KAC9B,CAAC,CAAC;IACH,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAa,EAAE,aAAuB;IAC5E,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;IACrC,MAAM,aAAa,GAAG,sBAAsB,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACpE,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE;YAC5B,WAAW,EAAE;gBACX,GAAG;oBACD,OAAO,aAAa,CAAC,WAAW,CAAC;gBACnC,CAAC;aACF;YACD,YAAY,EAAE;gBACZ,GAAG;oBACD,OAAO,aAAa,CAAC,YAAY,CAAC;gBACpC,CAAC;aACF;YACD,QAAQ,EAAE;gBACR,GAAG;oBACD,OAAO,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACjD,CAAC;aACF;YACD,OAAO,EAAE;gBACP,GAAG;oBACD,OAAO,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACjD,CAAC;aACF;SACF,CAAC,CAAC;QAEH,yCAAyC;QACzC,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,6FAA6F;QAC7F,yCAAyC;QACzC,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC;QACvD,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC;IAC/D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"script-execution.js","sourceRoot":"","sources":["../../../../../libs/core/src/compat/script-execution.ts"],"names":[],"mappings":"AAAA;;iDAEiD;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,YAAY,EA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U,EAAE,EAAE,CAAC,CAAC;gBACjD,CAAC;aACF;SACF,CAAC,CAAC;QAEH,yCAAyC;QACzC,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,6FAA6F;QAC7F,yCAAyC;QACzC,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,CAAC;QACvD,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Per-fragment Web Storage for trusted fragments.
3
+ *
4
+ * A compat realm is a same-origin iframe, so its `localStorage` and `sessionStorage` *are* the
5
+ * host's. Two fragments whose libraries keep state under the same fixed key — an OIDC client's
6
+ * `okta-token-storage`, a PKCE transaction — overwrite each other, and the `storage` events those
7
+ * writes raise reach every other realm on the page, where a sync listener dutifully copies the
8
+ * wrong value back. A partition gives the fragment a view over the native store in which every key
9
+ * it sees is its own, and events for anyone else's keys never arrive.
10
+ *
11
+ * It is an accident barrier, not a security boundary: same-origin code can still reach
12
+ * `top.localStorage`. See docs/braid-boundary.md.
13
+ *
14
+ * Storage keys are prefixed `braid:storage:<partition>:`. A partition is the fragment's id by
15
+ * default (`storage: 'partitioned'`), or a name several fragments share
16
+ * (`storage: { partition: 'kcd' }`), which is how two fragments using one issuer keep one login.
17
+ */
18
+ /** The native-store key prefix for a partition. Encoded so a name can never reach into another's. */
19
+ export declare function storagePartitionPrefix(partition: string): string;
20
+ /**
21
+ * A `Storage` that reads and writes only the keys under `prefix`, with the prefix out of sight.
22
+ *
23
+ * A Proxy rather than a subclass, because `Storage` exposes its entries as named properties —
24
+ * `localStorage.token = 'x'`, `Object.keys(localStorage)` — and only a Proxy can answer those.
25
+ * Members (`getItem`, `length`…) come from the realm's own `Storage.prototype`, patched to route a
26
+ * view to its own entries.
27
+ */
28
+ export declare function createStorageView(native: Storage, prefix: string, storagePrototype: object,
29
+ /** Told of every write that changes the store, which is every write that raises a `storage` event. */
30
+ onChange?: (nativeKey: string, newValue: string | null) => void): Storage;
31
+ /** What a `storage` event looks like from inside the partition, or `null` if it is not its event. */
32
+ export interface PartitionedStorageEvent {
33
+ key: string | null;
34
+ storageArea: Storage;
35
+ }
36
+ export interface StoragePartition {
37
+ /** Translates a `storage` event raised on the host window into the partition's terms. */
38
+ adaptEvent(event: StorageEvent): PartitionedStorageEvent | null;
39
+ }
40
+ /**
41
+ * Replaces the realm window's `localStorage` and `sessionStorage` with views on `partition`.
42
+ *
43
+ * Must run before any fragment script, which the compat boot guarantees: the realm stub has no
44
+ * scripts of its own, and the fragment's are activated only after the patches are in place.
45
+ * Reaching for a store that the browser refuses (some privacy modes throw) throws, as natively.
46
+ */
47
+ export declare function installStoragePartition(realmWindow: Window, mainWindow: Window, partition: string, signal?: AbortSignal): StoragePartition;
@@ -0,0 +1,291 @@
1
+ /**
2
+ * Per-fragment Web Storage for trusted fragments.
3
+ *
4
+ * A compat realm is a same-origin iframe, so its `localStorage` and `sessionStorage` *are* the
5
+ * host's. Two fragments whose libraries keep state under the same fixed key — an OIDC client's
6
+ * `okta-token-storage`, a PKCE transaction — overwrite each other, and the `storage` events those
7
+ * writes raise reach every other realm on the page, where a sync listener dutifully copies the
8
+ * wrong value back. A partition gives the fragment a view over the native store in which every key
9
+ * it sees is its own, and events for anyone else's keys never arrive.
10
+ *
11
+ * It is an accident barrier, not a security boundary: same-origin code can still reach
12
+ * `top.localStorage`. See docs/braid-boundary.md.
13
+ *
14
+ * Storage keys are prefixed `braid:storage:<partition>:`. A partition is the fragment's id by
15
+ * default (`storage: 'partitioned'`), or a name several fragments share
16
+ * (`storage: { partition: 'kcd' }`), which is how two fragments using one issuer keep one login.
17
+ */
18
+ const PREFIX = 'braid:storage:';
19
+ /** The native-store key prefix for a partition. Encoded so a name can never reach into another's. */
20
+ export function storagePartitionPrefix(partition) {
21
+ return `${PREFIX}${encodeURIComponent(partition)}:`;
22
+ }
23
+ const METHODS = ['getItem', 'setItem', 'removeItem', 'clear', 'key'];
24
+ /** The argument counts `Storage`'s methods require, for the TypeError a native call throws. */
25
+ const ARITY = { getItem: 1, setItem: 2, removeItem: 1, clear: 0, key: 1 };
26
+ const patched = new WeakMap();
27
+ function requireArguments(method, args) {
28
+ if (args.length < ARITY[method]) {
29
+ throw new TypeError(`Failed to execute '${method}' on 'Storage': ${ARITY[method]} argument${ARITY[method] > 1 ? 's' : ''} required, but only ${args.length} present.`);
30
+ }
31
+ }
32
+ /**
33
+ * Makes the realm's own `Storage.prototype` answer for views, once per realm.
34
+ *
35
+ * A view is a Proxy, not a platform object, so the native methods would refuse it
36
+ * (`Storage.prototype.getItem.call(localStorage, k)` is an "Illegal invocation"). Wrapping them —
37
+ * the realm's copy only; the host's `Storage` is never touched — lets every route to a method work:
38
+ * `localStorage.getItem(k)`, `.call(localStorage, …)`, and a library that monkey-patches
39
+ * `Storage.prototype.setItem` sees the fragment's own key names. The views themselves call the
40
+ * captured originals, so such a patch runs once per call, as it would natively.
41
+ */
42
+ function patchStoragePrototype(storagePrototype) {
43
+ const existing = patched.get(storagePrototype);
44
+ if (existing)
45
+ return existing;
46
+ const descriptor = (name) => Object.getOwnPropertyDescriptor(storagePrototype, name);
47
+ const original = Object.fromEntries(METHODS.map((name) => [name, descriptor(name).value]));
48
+ const originalLength = descriptor('length').get;
49
+ const ops = {
50
+ getItem: (store, key) => original.getItem.call(store, key),
51
+ setItem: (store, key, value) => void original.setItem.call(store, key, value),
52
+ removeItem: (store, key) => void original.removeItem.call(store, key),
53
+ key: (store, index) => original.key.call(store, index),
54
+ length: (store) => originalLength.call(store),
55
+ };
56
+ const views = new WeakMap();
57
+ for (const name of METHODS) {
58
+ // a method definition, so the wrapper keeps the native's name and is not a constructor
59
+ const wrapper = {
60
+ [name](...args) {
61
+ const view = typeof this === 'object' && this !== null ? views.get(this) : undefined;
62
+ return view ? view[name](...args) : original[name].apply(this, args);
63
+ },
64
+ }[name];
65
+ Object.defineProperty(storagePrototype, name, { ...descriptor(name), value: wrapper });
66
+ }
67
+ Object.defineProperty(storagePrototype, 'length', {
68
+ ...descriptor('length'),
69
+ get() {
70
+ const view = typeof this === 'object' && this !== null ? views.get(this) : undefined;
71
+ return view ? view.length() : originalLength.call(this);
72
+ },
73
+ });
74
+ const record = { ops, views };
75
+ patched.set(storagePrototype, record);
76
+ return record;
77
+ }
78
+ /**
79
+ * A `Storage` that reads and writes only the keys under `prefix`, with the prefix out of sight.
80
+ *
81
+ * A Proxy rather than a subclass, because `Storage` exposes its entries as named properties —
82
+ * `localStorage.token = 'x'`, `Object.keys(localStorage)` — and only a Proxy can answer those.
83
+ * Members (`getItem`, `length`…) come from the realm's own `Storage.prototype`, patched to route a
84
+ * view to its own entries.
85
+ */
86
+ export function createStorageView(native, prefix, storagePrototype,
87
+ /** Told of every write that changes the store, which is every write that raises a `storage` event. */
88
+ onChange = () => undefined) {
89
+ const { ops, views } = patchStoragePrototype(storagePrototype);
90
+ /**
91
+ * The partition's keys, scanned once and kept until the next microtask: a loop over `key(i)` up
92
+ * to `length` would otherwise rescan the whole origin store at every step. Nothing can change the
93
+ * store inside one synchronous run except this view, whose writes drop the cache.
94
+ */
95
+ let cachedKeys = null;
96
+ const ownKeys = () => {
97
+ if (!cachedKeys) {
98
+ const keys = [];
99
+ const total = ops.length(native);
100
+ for (let i = 0; i < total; i++) {
101
+ const key = ops.key(native, i);
102
+ if (key !== null && key.startsWith(prefix))
103
+ keys.push(key.slice(prefix.length));
104
+ }
105
+ cachedKeys = keys;
106
+ queueMicrotask(() => {
107
+ cachedKeys = null;
108
+ });
109
+ }
110
+ return cachedKeys;
111
+ };
112
+ const set = (nativeKey, value) => {
113
+ const changed = ops.getItem(native, nativeKey) !== value;
114
+ ops.setItem(native, nativeKey, value);
115
+ cachedKeys = null;
116
+ if (changed)
117
+ onChange(nativeKey, value);
118
+ };
119
+ const remove = (nativeKey) => {
120
+ const existed = ops.getItem(native, nativeKey) !== null;
121
+ ops.removeItem(native, nativeKey);
122
+ cachedKeys = null;
123
+ if (existed)
124
+ onChange(nativeKey, null);
125
+ };
126
+ const members = {
127
+ getItem: (...args) => (requireArguments('getItem', args), ops.getItem(native, prefix + String(args[0]))),
128
+ setItem: (...args) => (requireArguments('setItem', args), set(prefix + String(args[0]), String(args[1]))),
129
+ removeItem: (...args) => (requireArguments('removeItem', args), remove(prefix + String(args[0]))),
130
+ // removes this partition's entries one by one, so other partitions and the host keep theirs
131
+ clear: () => [...ownKeys()].forEach((key) => remove(prefix + key)),
132
+ // WebIDL `unsigned long`: NaN and undefined are 0, negatives wrap past the end
133
+ key: (...args) => (requireArguments('key', args), ownKeys()[Number(args[0]) >>> 0] ?? null),
134
+ length: () => ownKeys().length,
135
+ };
136
+ const isMember = (property) => property in storagePrototype;
137
+ const entry = (property) => ops.getItem(native, prefix + property);
138
+ const view = new Proxy(Object.create(storagePrototype), {
139
+ get(target, property, receiver) {
140
+ if (typeof property === 'symbol')
141
+ return Reflect.get(target, property, receiver);
142
+ if (isMember(property))
143
+ return Reflect.get(storagePrototype, property, receiver);
144
+ // a named property: the entry, or undefined (not null) like a native Storage
145
+ return entry(property) ?? undefined;
146
+ },
147
+ // as natively: assigning any string property stores an entry (WebIDL's named setter wins on
148
+ // [[Set]]), while reading a member name still finds the member
149
+ set(target, property, value) {
150
+ if (typeof property === 'symbol')
151
+ return Reflect.set(target, property, value);
152
+ set(prefix + property, String(value));
153
+ return true;
154
+ },
155
+ has(target, property) {
156
+ if (typeof property === 'symbol')
157
+ return Reflect.has(target, property);
158
+ return isMember(property) || entry(property) !== null;
159
+ },
160
+ deleteProperty(target, property) {
161
+ if (typeof property === 'symbol')
162
+ return Reflect.deleteProperty(target, property);
163
+ remove(prefix + property);
164
+ return true;
165
+ },
166
+ ownKeys(target) {
167
+ return [...ownKeys(), ...Object.getOwnPropertySymbols(target)];
168
+ },
169
+ getOwnPropertyDescriptor(target, property) {
170
+ if (typeof property === 'symbol')
171
+ return Reflect.getOwnPropertyDescriptor(target, property);
172
+ if (isMember(property))
173
+ return undefined;
174
+ const value = entry(property);
175
+ return value === null ? undefined : { value, writable: true, enumerable: true, configurable: true };
176
+ },
177
+ defineProperty(target, property, descriptor) {
178
+ if (typeof property === 'symbol')
179
+ return Reflect.defineProperty(target, property, descriptor);
180
+ // natively a data descriptor stores its value as an entry
181
+ if (!('value' in descriptor))
182
+ return false;
183
+ set(prefix + property, String(descriptor.value));
184
+ return true;
185
+ },
186
+ });
187
+ views.set(view, members);
188
+ return view;
189
+ }
190
+ /** Finds the getter for a storage attribute wherever the engine defines it (instance or prototype). */
191
+ function nativeStorageGetter(target, name) {
192
+ for (let object = target; object; object = Object.getPrototypeOf(object)) {
193
+ const descriptor = Object.getOwnPropertyDescriptor(object, name);
194
+ if (descriptor?.get)
195
+ return descriptor.get.bind(target);
196
+ if (descriptor)
197
+ return () => descriptor.value;
198
+ }
199
+ throw new Error(`braid: this browser has no ${name}`);
200
+ }
201
+ /**
202
+ * Replaces the realm window's `localStorage` and `sessionStorage` with views on `partition`.
203
+ *
204
+ * Must run before any fragment script, which the compat boot guarantees: the realm stub has no
205
+ * scripts of its own, and the fragment's are activated only after the patches are in place.
206
+ * Reaching for a store that the browser refuses (some privacy modes throw) throws, as natively.
207
+ */
208
+ export function installStoragePartition(realmWindow, mainWindow, partition, signal) {
209
+ const prefix = storagePartitionPrefix(partition);
210
+ const storagePrototype = realmWindow.Storage.prototype;
211
+ const views = new Map();
212
+ // captured before the accessors below replace them, or the view would find itself
213
+ const native = {
214
+ localStorage: nativeStorageGetter(realmWindow, 'localStorage'),
215
+ sessionStorage: nativeStorageGetter(realmWindow, 'sessionStorage'),
216
+ };
217
+ /**
218
+ * A window never hears its own writes, but a realm listens on the host window, where its writes
219
+ * do raise events. Each write this realm makes is recorded, and the host event it raises is
220
+ * marked an echo — by a listener registered here, before any fragment code can add its own, so
221
+ * it always sees the event first.
222
+ */
223
+ const pending = new Map();
224
+ const echoes = new WeakSet();
225
+ const writeId = (area, nativeKey, newValue) => JSON.stringify([area, nativeKey, newValue]);
226
+ /** An echo arrives within a task or two; one that never comes must not swallow a later event. */
227
+ const ECHO_WINDOW_MS = 2_000;
228
+ const view = (name) => {
229
+ let existing = views.get(name);
230
+ if (!existing) {
231
+ existing = createStorageView(native[name](), prefix, storagePrototype, (nativeKey, newValue) => {
232
+ const id = writeId(name, nativeKey, newValue);
233
+ pending.set(id, [...(pending.get(id) ?? []), Date.now() + ECHO_WINDOW_MS]);
234
+ });
235
+ views.set(name, existing);
236
+ }
237
+ return existing;
238
+ };
239
+ for (const name of ['localStorage', 'sessionStorage']) {
240
+ // the native attributes are enumerable, configurable getters with no setter; so are these
241
+ Object.defineProperty(realmWindow, name, { get: () => view(name), set: undefined, configurable: true, enumerable: true });
242
+ }
243
+ const hostArea = (name) => {
244
+ try {
245
+ return nativeStorageGetter(mainWindow, name)();
246
+ }
247
+ catch {
248
+ return null;
249
+ }
250
+ };
251
+ const areaOf = (event) => {
252
+ const area = event.storageArea;
253
+ if (!area)
254
+ return null;
255
+ return area === hostArea('sessionStorage') ? 'sessionStorage' : area === hostArea('localStorage') ? 'localStorage' : null;
256
+ };
257
+ mainWindow.addEventListener('storage', (event) => {
258
+ const name = areaOf(event);
259
+ if (!name || event.key === null)
260
+ return;
261
+ const id = writeId(name, event.key, event.newValue);
262
+ const now = Date.now();
263
+ const live = (pending.get(id) ?? []).filter((expires) => expires > now);
264
+ if (live.length === 0) {
265
+ pending.delete(id);
266
+ return;
267
+ }
268
+ live.shift();
269
+ if (live.length > 0)
270
+ pending.set(id, live);
271
+ else
272
+ pending.delete(id);
273
+ echoes.add(event);
274
+ },
275
+ // capture, so it runs before any listener a fragment adds, in either phase
276
+ signal ? { capture: true, signal } : { capture: true });
277
+ return {
278
+ adaptEvent(event) {
279
+ const name = areaOf(event);
280
+ if (!name || echoes.has(event))
281
+ return null;
282
+ // a `clear()` outside the partition wiped this partition's entries too, so it is news here
283
+ if (event.key === null)
284
+ return { key: null, storageArea: view(name) };
285
+ if (!event.key.startsWith(prefix))
286
+ return null;
287
+ return { key: event.key.slice(prefix.length), storageArea: view(name) };
288
+ },
289
+ };
290
+ }
291
+ //# sourceMappingURL=storage-partition.js.map