Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Document the file:// shared-origin fix (changelog + decisions) (#526)

nyblnet84faf1b7d199
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bc304af4..29dc9048 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,21 @@ pre-1.0.
## [1.2.2] — 2026-09-19
+- **Security: update this file. Another local file could read this deck's
+ collaboration keys, and steer where it looks for updates.** On a desktop
+ browser, a deck opened straight from disk (a `file://` page) shares one
+ storage area with every other local Bento file the user opens — a quirk of
+ how browsers treat local files. A malicious `.bento.html` opened from disk
+ could read the auto-save store and lift a shared deck's room keys (read and
+ write access to that live session), and could plant the address this app
+ checks for updates, sync, and language packs so the next deck contacted a
+ server of its choosing (signed-update verification still blocked any
+ unsigned build). Auto-save now stores document content only — never the
+ collaboration keys — and those addresses are honoured only from a real web
+ origin, never a local file. **The iOS and Android apps were never affected**
+ — each document already runs in its own isolated origin. Affects desktop
+ browsers opening a local file, with or without the extension.
+
- **A deck full of photos can be shared live again.** A deck whose pictures
were each under the sharing limit but together came to more than about a
megabyte could not be shared at all — the copy a joining collaborator
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 2d25cdb1..f2920a16 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -7313,3 +7313,40 @@ transport surfaces `refused('too-large', null)` → the session emits a notice w
deck is too large to share" rather than "that change is too large". (Wording is
the slides zone's.)
+
+## 2026-09-19 — file:// is one shared origin; keep secrets and trust out of it
+
+Chrome (and other browsers) give EVERY `file://` document one shared,
+enumerable storage origin: `localStorage`, IndexedDB and the rest are common
+to every local `.bento.html` the user opens. Measured with two decks in
+different folders — deck B read deck A's IndexedDB and localStorage.
+Consequences and the rule they leave:
+
+- **Auto-save leaked collaboration secrets.** `putRecovery`/`addVersion`
+ wrote `JSON.stringify(doc)`, and `doc.collab` carries the room read key,
+ `ownerPriv`, `writerPriv` and the audience show key. Any local file read the
+ auto-save store and lifted them — silent read+write to those live rooms,
+ plus every auto-saved deck's plaintext. Fixed: snapshots are content-only
+ (`collab` dropped before the write); restore re-attaches `collab` from the
+ file being restored into, so recovery is unchanged. Encrypted decks were
+ already skipped.
+- **Boot-read URL overrides were forgeable.** `bento-update-url`,
+ `bento-sync-url`, `bento-packs-url` are dev overrides read at startup; a
+ malicious local file could plant one and steer the next deck to a hostile
+ server. `sharedStorageOrigin()` now gates all three — honoured only from a
+ real web origin (https, or http on localhost), never `file://` or an opaque
+ origin, fail-safe to "shared" when the origin can't be determined. The
+ auto-save strip and the update/sync gate shipped in #520; the pack-URL
+ override gate in #523.
+- **The native hosts were never exposed.** iOS serves each document from
+ `bento-tray://<hash-of-path>/` and Android from
+ `https://<hash-of-uri>.bento-tray.invalid/` — a per-document origin, so
+ cross-deck reads are impossible there. The webext does NOT change this: it
+ supplies a directory handle but the deck still opens as a `file://` page.
+
+The rule: on `file://` there is no origin identity to bind a capability to.
+Nothing secret goes into a `file://`-reachable store unstripped, and no
+boot-time trust decision is taken from one. Still open, for the follow-up:
+the `bento-member-<docId>` device signing key and plaintext auto-save content
+(a per-file key in `#bento-doc`); and #519's persistent file-handle grant,
+which for the same reason is safe only under a real origin.