Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
PowerPoint import: bento.page/import and bento convert (#589)
nyblnetee196580e484
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 57a02636..cd6d05be 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -101,6 +101,13 @@ jobs:working-directory: slidesrun: node_modules/.bin/tsc -p ../kernel+ - name: Typecheck convert (standalone)+ # convert/ is a library beside the apps (the CLI and bento.page/import+ # use it; no shell does), so no app's tsc -b reaches it. Its own flags,+ # its own pass — the same as kernel's.+ working-directory: slides+ run: node_modules/.bin/tsc -p ../convert+- name: Build single-file shellworking-directory: slidesrun: npm run build:single@@ -938,10 +945,15 @@ jobs:# The pptx importer's resolver is where real decks' fidelity lives --# 91% of colour and 71% of run properties are indirect, and every hop# fails silently (a backwards clrMap still renders, just dark-on-dark).- # Seven rigs, 378 checks, negative controls proven against mutated- # implementations; load.ts is the gate that matters: every emitted- # document must pass the REAL slides parseDoc with zero validateDoc- # errors.+ # Negative controls proven against mutated implementations; load.ts is+ # the gate that matters for import: every emitted document must pass the+ # REAL slides parseDoc with zero validateDoc errors. The runner also+ # covers the `bento convert` CLI (it needs the shell built above and+ # Chrome for "it opens"; neither may skip in CI), the delivery chain+ # behind bento.page/import (signature, pin, version floor, untrusted-+ # input gate, zip limits, exactly two requests), the built page's CSP,+ # and the boundary: no app imports convert/, and the engine touches no+ # DOM global.run: node scripts/test-convert.ts- name: bento/dash zipdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8e367666..e66eccbc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,15 @@ pre-1.0.## [Unreleased]+- **Open a PowerPoint deck in Bento: bento.page/import.** Drop a `.pptx` on+ the page and get back a `.bento.html` deck you can edit and present. The+ conversion runs in your browser and the deck is never uploaded. The page+ fetches only the current signed slides release to build on, checks its+ signature and fingerprint, and refuses anything that fails. Before you+ download, it shows what was carried over, what was approximated and what+ was left out. Tables and charts become marked placeholders for now.+ The same conversion runs from a terminal as+ `node convert/cli.mjs deck.pptx`.- **A view-only or audience copy opened inside the editor stays view-only.**Dropping an audience copy (the hand-out for a live show) onto an open deck,or loading one by script, used to offer "Invite to edit…", "Go live" anddiff --git a/convert/cli.mjs b/convert/cli.mjsnew file mode 100755index 00000000..4e00a5bd--- /dev/null+++ b/convert/cli.mjs@@ -0,0 +1,129 @@+#!/usr/bin/env node+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// bento convert — a PowerPoint deck to a bento/slides file, from a terminal.+//+// node convert/cli.mjs <deck.pptx> [-o out.bento.html] [--shell path | --offline]+//+// A leading `convert` is accepted and ignored, so a future `bento` dispatcher+// can call this as `bento convert …` unchanged.+//+// The deck is written into the CURRENT signed slides shell: the release+// manifest's signature is verified, the shell's bytes are checked against the+// signed pin, and a shell that fails either, or is older than+// MIN_SHELL_VERSION, is refused. The document then passes the same+// untrusted-input gate slides applies to every foreign document, and is+// spliced in per the splice contract. `--shell` uses a local build instead+// (development, air-gapped use; no channel check, and it says so); `--offline`+// refuses the network entirely and requires `--shell`.+//+// The fidelity report goes to STDERR, so stdout stays clean for scripting.+// Exit codes: 0 converted, 1 refused or failed, 2 usage.+//+// HOW IT RUNS. The engine is TypeScript that imports slides' untrusted-input+// gate, whose own imports are extensionless — so, like scripts/bento-check.mjs,+// this bundles its entry with the repo's esbuild on each run and imports the+// result. No new dependency; slides/node_modules must be installed.++import { spawnSync } from 'node:child_process'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'+import { fileURLToPath, pathToFileURL } from 'node:url'++// The kernel's storage helper touches `localStorage`, which node 26 exposes+// only behind a flag and warns about on first access. Harmless here (a CLI has+// no preferences to read), but stderr carries the fidelity report, so that one+// warning is filtered and every other warning still prints.+process.removeAllListeners('warning')+process.on('warning', (w) => {+ if (w.name === 'ExperimentalWarning' && /localStorage/.test(w.message)) return+ process.stderr.write(`${w.name}: ${w.message}\n`)+})++const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')+const USAGE = `usage:+ bento convert <deck.pptx> [-o out.bento.html] [--shell path | --offline]`++function die(msg, code = 1) {+ process.stderr.write(`bento convert: ${msg}\n`)+ process.exit(code)+}++// --- arguments ---------------------------------------------------------------+const argv = process.argv.slice(2)+if (argv[0] === 'convert') argv.shift()+const opts = { out: null, shell: null, offline: false, input: null }+for (let i = 0; i < argv.length; i++) {+ const a = argv[i]+ const val = () => (i + 1 < argv.length ? argv[++i] : die(`${a} needs a value\n${USAGE}`, 2))+ if (a === '-o' || a === '--out') opts.out = val()+ else if (a === '--shell') opts.shell = val()+ else if (a === '--offline') opts.offline = true+ else if (a === '-h' || a === '--help') { process.stdout.write(USAGE + '\n'); process.exit(0) }+ else if (a.startsWith('-')) die(`unknown option ${a}\n${USAGE}`, 2)+ else if (opts.input) die(`one input at a time\n${USAGE}`, 2)+ else opts.input = a+}+if (!opts.input) die(USAGE, 2)+if (!/\.pptx$/i.test(opts.input)) die(`${opts.input}: expected a .pptx`, 2)+if (opts.offline && !opts.shell) die('--offline needs --shell: there is no other shell to use', 2)+if (!fs.existsSync(opts.input)) die(`no such file: ${opts.input}`)++// --- the engine, bundled -----------------------------------------------------+const esbuild = path.join(root, 'slides/node_modules/.bin/esbuild')+if (!fs.existsSync(esbuild)) die('slides/node_modules is missing — run `cd slides && npm install`')+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'bento-convert-'))+const bundle = path.join(tmp, 'api.mjs')+const built = spawnSync(esbuild, [+ path.join(root, 'convert/src/api.ts'), '--bundle', '--format=esm', '--platform=node',+ '--log-level=error', `--outfile=${bundle}`,+], { encoding: 'utf8' })+if (built.status !== 0) die(`could not build the engine:\n${built.stderr}`)+const api = await import(pathToFileURL(bundle).href)++// The engine reports only what it could NOT carry as-is, so "0 carried" would+// read as "nothing made it"; the carried tally is shown only when it is counted.+const count = (r) => [r.counts.carried ? `${r.counts.carried} carried` : '',+ `${r.counts.approximated ?? 0} approximated`, `${r.counts.dropped ?? 0} dropped`].filter(Boolean).join(' · ')+function printReport(r) {+ process.stderr.write(`fidelity: ${count(r)}\n`)+ // One line per (verdict, code), dropped first — the engine reports per slide,+ // so a long deck otherwise repeats the same code once per slide and the one+ // line that matters drowns. Same folding as the /import page.+ const folded = new Map()+ for (const e of r.entries) {+ if (e.verdict === 'carried') continue+ const k = `${e.verdict}\u0000${e.code}`+ const f = folded.get(k) ?? { ...e, count: 0 }+ f.count += e.count ?? 1+ folded.set(k, f)+ }+ const rank = { dropped: 0, approximated: 1 }+ for (const e of [...folded.values()].sort((a, b) => (rank[a.verdict] ?? 2) - (rank[b.verdict] ?? 2)))+ process.stderr.write(` ${e.verdict.padEnd(12)} ${e.code}${e.count > 1 ? ` ×${e.count}` : ''} — ${e.detail}\n`)+}++try {+ let shell+ if (opts.shell) {+ shell = fs.readFileSync(opts.shell, 'utf8')+ process.stderr.write(`shell: ${opts.shell} (local — NOT verified against the release channel)\n`)+ } else {+ const v = await api.fetchVerifiedShell()+ shell = v.html+ process.stderr.write(`shell: bento/slides ${v.version} — signature and pin verified\n`)+ }+ const res = await api.pptxToBento(new Uint8Array(fs.readFileSync(opts.input)), shell)+ const out = opts.out ?? opts.input.replace(/\.pptx$/i, '') + '.bento.html'+ fs.writeFileSync(out, res.html)+ printReport(res.report)+ if (res.gated.length)+ process.stderr.write(`gate: removed ${res.gated.length} value(s) the format does not allow\n`)+ process.stderr.write(`wrote ${out} — "${res.title}", ${res.slides} slide(s)\n`)+} catch (err) {+ die(err instanceof api.LimitError ? `refused: ${err.message}` : err.message)+} finally {+ fs.rmSync(tmp, { recursive: true, force: true })+}diff --git a/convert/page/import-page.ts b/convert/page/import-page.tsnew file mode 100644index 00000000..f73e590e--- /dev/null+++ b/convert/page/import-page.ts@@ -0,0 +1,136 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// bento.page/import — drop a .pptx, get a .bento.html back.+//+// Everything happens in this tab. The file is read with the File API, converted+// by convert/src/api.ts (the same composition the CLI runs), and handed back as+// a Blob. Nothing is uploaded, and the page's CSP (scripts/build-import-page.mjs)+// makes that a property the BROWSER enforces rather than one this code promises:+// `connect-src 'self'` — the only requests this page can make are to bento.page,+// and the only two it does make are the signed release manifest and the shell+// that manifest pins.+//+// The shell is verified before anything is written into it (signature over the+// pin, pin over the bytes — deliver.ts). A shell that fails is refused and the+// visitor is told so; there is no download from an unverified shell.++import { fetchVerifiedShell, pptxToBento, LimitError, LIMITS } from '../src/api.ts'+import type { FidelityReport } from '../src/report.ts'++const $ = <T extends HTMLElement>(sel: string) => document.querySelector(sel) as T+const drop = $<HTMLElement>('#drop')+const input = $<HTMLInputElement>('#file')+const status = $<HTMLElement>('#status')+const result = $<HTMLElement>('#result')++const esc = (s: string) => s.replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]!)+// engine messages start lowercase because they are written to follow a colon+const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1)+const mb = (n: number) => `${Math.round(n / 1024 / 1024)} MB`++$<HTMLElement>('#limit').textContent = mb(LIMITS.inputBytes)++function say(text: string, kind: 'busy' | 'error' | 'idle' = 'busy') {+ status.textContent = text+ status.dataset.kind = kind+ status.hidden = false+}++// A verified shell is fetched once per page load and reused: converting three+// decks does not ask the release server three times.+let shell: Promise<{ version: string; html: string }> | null = null++async function convert(file: File) {+ result.hidden = true+ result.innerHTML = ''+ if (!/\.pptx$/i.test(file.name)) return say('That is not a .pptx file. Choose a PowerPoint presentation.', 'error')+ if (file.size > LIMITS.inputBytes)+ return say(`That file is ${mb(file.size)}. This page takes presentations up to ${mb(LIMITS.inputBytes)}.`, 'error')+ try {+ say('Fetching the latest bento/slides and checking its signature…')+ // Both requests go to THIS origin: the manifest by relative path, and the+ // shell by re-rooting the signed URL's path here (deliver.ts `resolve`).+ // That is what lets the CSP be `connect-src 'self'` with no exceptions.+ shell ??= fetchVerifiedShell('/releases/slides/manifest.json', fetch,+ (u) => new URL(new URL(u).pathname, location.href).href)+ const s = await shell+ say(`Converting ${file.name}…`)+ const res = await pptxToBento(new Uint8Array(await file.arrayBuffer()), s.html)+ const name = file.name.replace(/\.pptx$/i, '') + '.bento.html'+ const url = URL.createObjectURL(new Blob([res.html], { type: 'text/html' }))+ status.hidden = true+ showResult(name, url, res.slides, s.version, res.report, res.gated.length)+ } catch (err) {+ // A refused shell must stay refused for this page load: never retry into a+ // fallback, and never keep a rejected promise that later looks settled.+ shell = null+ const msg = err instanceof LimitError+ ? `This file was refused: ${err.message}.`+ : /signature|pin|manifest|release server/i.test(String((err as Error)?.message))+ ? `Could not verify the bento/slides release, so nothing was produced. ${cap((err as Error).message)}.`+ : `This file could not be converted: ${(err as Error)?.message ?? String(err)}.`+ say(msg, 'error')+ }+}++// The report, in words a visitor can act on. The engine's `detail` strings are+// written for developers ("spcBef/spcAft have no bento equivalent"); the brief+// for this page is to say what did not come across PLAINLY. Codes not listed+// here fall back to the engine's own detail rather than to silence.+const PLAIN: Record<string, string> = {+ 'table-not-yet': 'Tables are not converted yet. A placeholder box marks where each one was.',+ 'chart-not-yet': 'Charts are not converted yet. A placeholder box marks where each one was.',+ 'text-needs-refit': 'Some text boxes may need resizing, because this device’s fonts differ slightly from the original’s.',+ 'font-substituted': 'Some fonts were not included in the file, so a similar font is used instead.',+ 'paragraph-spacing-dropped': 'Extra space between paragraphs is not kept.',+ 'run-formatting-flattened': 'Mixed formatting inside a text box (different colours or sizes) is simplified.',+ 'bullet-flattened': 'Bullet styles are simplified.',+ 'auto-number-frozen': 'Numbered lists keep their numbers, but no longer renumber automatically.',+ 'field-frozen': 'Slide numbers and dates are kept as plain text.',+ 'image-crop-dropped': 'Cropped pictures show in full.',+ 'image-external-dropped': 'Pictures linked from the web are left out. This page never downloads them.',+ 'effect-dropped': 'Some visual effects (glows, reflections, 3-D) are left out.',+ 'flip-dropped': 'Flipped shapes and pictures appear unflipped.',+ 'picture-fill-dropped': 'Shapes filled with a picture are left empty.',+ 'background-image-dropped': 'Slide background pictures are left out.',+ 'nested-group-flattened': 'Groups inside groups are flattened into one group.',+}++function showResult(name: string, url: string, slides: number, version: string, r: FidelityReport, gated: number) {+ // One line per KIND of loss. The engine folds findings per (code, where) —+ // right for a developer locating a problem, noise for a visitor, who would+ // read "extra space between paragraphs is not kept" once per text box.+ const byCode = new Map<string, { verdict: string; code: string; detail: string; count: number }>()+ for (const e of r.entries) {+ if (e.verdict === 'carried') continue+ const seen = byCode.get(e.code)+ if (seen) seen.count += e.count+ else byCode.set(e.code, { verdict: e.verdict, code: e.code, detail: e.detail, count: e.count })+ }+ // not-carried first: those are the ones worth checking before anything else+ const lossy = [...byCode.values()].sort((a, b) => (a.verdict === b.verdict ? 0 : a.verdict === 'dropped' ? -1 : 1))+ const rows = lossy.map((e) => `+ <li class="${e.verdict}"><span class="tag">${e.verdict === 'dropped' ? 'Not carried' : 'Approximated'}</span>+ ${esc(PLAIN[e.code] ?? e.detail)}${e.count > 1 ? ` <span class="n">×${e.count}</span>` : ''}</li>`).join('')+ result.innerHTML = `+ <h2>${esc(name)}</h2>+ <p class="meta">${slides} slide${slides === 1 ? '' : 's'} · built on bento/slides ${esc(version)}, signature verified</p>+ ${lossy.length+ ? `<p>Most of your deck came across. These did not come across exactly, so check them after you open it:</p><ul class="report">${rows}</ul>`+ : '<p>Everything the converter looked at came across.</p>'}+ ${gated ? `<p class="meta">${gated} value${gated === 1 ? '' : 's'} the bento/slides format does not allow were removed.</p>` : ''}+ <a class="btn" href="${url}" download="${esc(name)}">Download ${esc(name)}</a>+ <p class="meta">Open it in any browser to edit and present. Save once in bento/slides and it gets its file thumbnail.</p>`+ result.hidden = false+}++input.addEventListener('change', () => { if (input.files?.[0]) void convert(input.files[0]) })+drop.addEventListener('dragover', (e) => { e.preventDefault(); drop.classList.add('over') })+drop.addEventListener('dragleave', () => drop.classList.remove('over'))+drop.addEventListener('drop', (e) => {+ e.preventDefault()+ drop.classList.remove('over')+ const f = e.dataTransfer?.files?.[0]+ if (f) void convert(f)+})diff --git a/convert/src/api.ts b/convert/src/api.tsnew file mode 100644index 00000000..1d8fc863--- /dev/null+++ b/convert/src/api.ts@@ -0,0 +1,39 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// The import, composed once — the CLI and the public import page both call+// exactly this, so they cannot disagree about limits, gating or splicing.++import { convertPptx } from './pptx.ts'+import { gateDoc, spliceIntoShell } from './deliver.ts'+import { preflight } from './limits.ts'+import type { FidelityReport } from './report.ts'+import type { Dropped } from '../../slides/src/untrusted.ts'++export { fetchVerifiedShell, SLIDES_MANIFEST, MIN_SHELL_VERSION } from './deliver.ts'+export { LIMITS, LimitError } from './limits.ts'++export interface ImportResult {+ html: string+ title: string+ slides: number+ /** what the conversion carried, approximated and dropped */+ report: FidelityReport+ /** what the untrusted-input gate removed on top — expected to be empty for+ * anything this importer produced from a well-formed deck */+ gated: Dropped[]+}++/** .pptx bytes + a verified shell → a .bento.html. */+export async function pptxToBento(pptx: Uint8Array, shellHtml: string): Promise<ImportResult> {+ preflight(pptx)+ const { doc, report } = await convertPptx(pptx)+ const { doc: safe, dropped } = gateDoc(doc)+ return {+ html: spliceIntoShell(shellHtml, safe),+ title: safe.title,+ slides: safe.slides.length,+ report,+ gated: dropped,+ }+}diff --git a/convert/src/deliver.ts b/convert/src/deliver.tsnew file mode 100644index 00000000..b6b45e49--- /dev/null+++ b/convert/src/deliver.ts@@ -0,0 +1,170 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// Delivery: a converted document, into a verified shell, safely.+//+// Shared by the CLI (convert/cli.mjs) and the public import page+// (site-src/import/), so the two can never disagree about what makes a+// converted file safe to hand someone. Three steps, each refusing rather than+// degrading:+//+// 1. A SHELL WE CAN VOUCH FOR. The current slides release, fetched the way the+// home hosts fetch one for a new document: the signed manifest verified with+// `verifySigned` (kernel/src/update.ts — its own comment calls it the ONLY+// release-channel crypto in the kernel, and a second implementation "a+// second thing to get wrong", so this reuses it rather than mirroring it the+// way the unbundled webext must), then the shell's bytes checked against the+// signed sha256 pin by `fetchPinned`. A shell that fails anything is+// REFUSED. There is no "use it anyway".+//+// 2. A DOCUMENT GATED LIKE ANY FOREIGN ONE. A .pptx is attacker-controlled+// input — typeface names, text, slide names and notes all flow from it into+// the document. The converted document meets the SAME gate slides applies to+// every other foreign document, composed exactly as the existing intakes do:+// slides through `sanitizeSlide` with the drop report (compactload.ts),+// `sanitizeAssets` and `sanitizeFonts` (editor/clipboard.ts), then the top+// level through `parseDoc` (compactload.ts again). No new rule is invented+// here — a second copy of a security rule is how the two drift.+//+// 3. A SPLICE THAT HONOURS THE CONTRACT. The document goes into the shell's+// empty #bento-doc block with every `<` escaped (`<`), exactly as+// kernel/src/save.ts writes it, and the <title> is set the same way.+//+// NOT `serializeWith`, and deliberately. serializeWith also renders a+// first-page thumbnail, which needs slides' renderer and a DOM: the CLI has+// no DOM, and dragging the renderer onto the public page would multiply the+// code security has to review for a thumbnail. And it is what the hosts do+// for a new document anyway — home/webext writes the raw verified shell+// bytes, preview-less. The app writes the thumbnail on the first save, as it+// does for every new document.++import { configureApp } from '../../kernel/src/app.ts'+import { verifySigned, fetchPinned, compareVersions } from '../../kernel/src/update.ts'+import { parseDoc, type BentoDoc, type Slide } from '../../slides/src/model.ts'+import {+ sanitizeAssets, sanitizeFonts, sanitizeSlide, withDropReport, withPathSegment, type Dropped,+} from '../../slides/src/untrusted.ts'++export const SLIDES_MANIFEST = 'https://bento.page/releases/slides/manifest.json'++/**+ * THE OLDEST SHELL A CONVERTED FILE MAY BE BUILT ON. A converted deck carries+ * its shell for good, so a shell with a fixed security hole must never be+ * handed out again, even by a validly signed manifest (a stale mirror or a+ * cached manifest still verifies). Bump this in the release that ships a+ * security fix, to that release's version. scripts/release.mjs refuses a+ * release older than this floor, so the page can never refuse its own release.+ */+export const MIN_SHELL_VERSION = '1.2.5'+const APP_ID = 'bento-slides'++// verifySigned reads the app identity (and a fork's key override) from+// configureApp. Calling it here makes this module self-sufficient; the values+// are the upstream slides identity, the same ones slides/src/main.ts sets.+configureApp({ appId: APP_ID, appName: 'bento/slides', manifestUrl: SLIDES_MANIFEST })++export interface VerifiedShell {+ version: string+ html: string+}++/**+ * The current slides shell, or an Error that says which link of the chain+ * failed. Signature over the pin, pin over the bytes — both, or nothing.+ */+export async function fetchVerifiedShell(+ manifestUrl = SLIDES_MANIFEST,+ net: typeof fetch = fetch,+ /**+ * Map the signed shell URL to the one actually fetched. The public page uses+ * this to fetch from its OWN origin, so its `connect-src 'self'` CSP holds.+ * Safe by construction: trust comes from the signature over the pin and the+ * pin over the bytes, never from the URL, so a resolved URL that serves+ * different bytes is refused by fetchPinned exactly as a tampered CDN would be.+ */+ resolve: (url: string) => string = (u) => u,+): Promise<VerifiedShell> {+ const res = await net(manifestUrl, { cache: 'no-store' })+ if (!res.ok) throw new Error(`could not reach the release server (${res.status})`)+ // The payload shape, restated from kernel/src/update.ts's (private)+ // verifyManifest. The CRYPTO is verifySigned's alone; this is only "is the+ // signed payload a slides release".+ const info = (await verifySigned(await res.text(), 'release manifest')) as Record<string, unknown>+ if (+ info?.app !== APP_ID ||+ typeof info.version !== 'string' ||+ typeof info.sha256 !== 'string' || !/^[0-9a-f]{64}$/i.test(info.sha256) ||+ typeof info.url !== 'string'+ ) throw new Error('the release manifest payload is malformed — refusing it')+ // Before the shell is fetched: an old release is refused without downloading+ // it. A version that is not plain dotted numbers is refused outright, because+ // compareVersions would read its non-numeric parts as 0.+ if (!/^\d+(\.\d+)*$/.test(info.version))+ throw new Error(`the release server offered a bento/slides version this converter does not recognise ("${info.version.slice(0, 40)}") — refusing it.`)+ if (compareVersions(info.version, MIN_SHELL_VERSION) < 0)+ throw new Error(`the release server offered bento/slides ${info.version}, which is older than ${MIN_SHELL_VERSION}, the oldest version this converter will build on — refusing it. Try again later.`)+ const bytes = await fetchPinned(resolve(info.url), info.sha256)+ if (!bytes) throw new Error('the downloaded shell does not match its signed pin — refusing it')+ return { version: info.version, html: new TextDecoder().decode(bytes) }+}++export interface GateResult {+ doc: BentoDoc+ dropped: Dropped[]+}++/** The untrusted-input gate over a whole converted document (see header §2). */+export function gateDoc(raw: unknown): GateResult {+ if (!raw || typeof raw !== 'object') throw new Error('not a document')+ const src = raw as Record<string, unknown>+ const { result: slides, dropped } = withDropReport(() =>+ ((Array.isArray(src.slides) ? src.slides : []) as unknown[])+ .map((s, i) => withPathSegment('slides', () => withPathSegment(String(i), () => sanitizeSlide(s))))+ .filter((s): s is Slide => s !== null))+ const gated = { ...src, slides, assets: sanitizeAssets(src.assets), fonts: sanitizeFonts(src.fonts) }+ const doc = parseDoc(JSON.stringify(gated))+ if (!doc) throw new Error('the converted document did not pass the format check')+ return { doc, dropped }+}++const BLOCK_OPEN = '<script type="application/bento+json" id="bento-doc">'+// assembled so this source never contains the literal close tag (PLATFORM+// hard-won detail #4 — the same reason save.ts builds it by concatenation)+const SCRIPT_CLOSE = '</' + 'script>'++/**+ * Splice `doc` into a shell's #bento-doc block, the way save.ts writes it.+ * Refuses a shell without exactly one block, and verifies the result by+ * reading the block back.+ */+export function spliceIntoShell(shellHtml: string, doc: BentoDoc): string {+ const first = shellHtml.indexOf(BLOCK_OPEN)+ if (first < 0 || shellHtml.indexOf(BLOCK_OPEN, first + 1) >= 0)+ throw new Error('the shell does not carry exactly one #bento-doc block')+ const start = first + BLOCK_OPEN.length+ const end = shellHtml.indexOf(SCRIPT_CLOSE, start)+ if (end < 0) throw new Error('the #bento-doc block is not closed')+ const body = '\n' + JSON.stringify(doc).replace(/</g, '\\u003c') + '\n'+ let out = shellHtml.slice(0, start) + body + shellHtml.slice(end)+ const esc = (s: string) => s.replace(/&/g, '&').replace(/</g, '<')+ out = out.replace(/<title>[\s\S]*?<\/title>/, `<title>${esc(doc.title)} — bento/slides</title>`)+ // Belt: the close-tag count must not change, and the block must read back+ // as exactly the document we wrote.+ if (out.split(SCRIPT_CLOSE).length !== shellHtml.split(SCRIPT_CLOSE).length)+ throw new Error('splice changed the script-close count — refusing the output')+ if (JSON.stringify(extractDoc(out)) !== JSON.stringify(doc))+ throw new Error('the spliced document does not read back identically')+ return out+}++/** Read the #bento-doc block of a saved file, parsed. */+export function extractDoc(html: string): unknown {+ const first = html.indexOf(BLOCK_OPEN)+ if (first < 0) throw new Error('not a Bento file (no #bento-doc block)')+ const start = first + BLOCK_OPEN.length+ const end = html.indexOf(SCRIPT_CLOSE, start)+ if (end < 0) throw new Error('the #bento-doc block is not closed')+ const text = html.slice(start, end).trim()+ if (!text) throw new Error('the #bento-doc block is empty — a fresh shell, not a deck')+ try { return JSON.parse(text) } catch { throw new Error('the #bento-doc block is not valid JSON') }+}diff --git a/kernel/src/convert/inherit.ts b/convert/src/inherit.tssimilarity index 100%rename from kernel/src/convert/inherit.tsrename to convert/src/inherit.tsdiff --git a/convert/src/limits.ts b/convert/src/limits.tsnew file mode 100644index 00000000..1c87cc9c--- /dev/null+++ b/convert/src/limits.ts@@ -0,0 +1,83 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// Refuse a .pptx that would hurt the machine reading it — BEFORE inflating it.+//+// A .pptx is a ZIP from a program we do not control, and the public import page+// accepts one from anyone. `readZip` (kernel/src/convert/zip.ts) inflates each+// entry in full and only then compares it with the size the central directory+// declared, so a decompression bomb detonates before any check runs. This reads+// the central directory ONLY — a few hundred bytes of structure, no inflation —+// and refuses on what the archive itself declares.+//+// WHAT THIS DOES NOT COVER, stated rather than implied. An archive that LIES in+// its central directory (declares a small size, inflates to a huge one) passes+// this and is caught by readZip's size check only after inflating. Closing that+// needs a byte cap inside the kernel's inflateRaw — it is shared with dash's+// .xlsx import, which has the same exposure — so it belongs to the kernel zone+// under the lock. Reported there privately rather than duplicated here: a second+// ZIP reader in this directory would be a second thing to keep correct.++export const LIMITS = {+ /** the .pptx itself. The census's largest real deck is 275MB of photos, and a+ * file that size cannot become a usable self-contained HTML document anyway. */+ inputBytes: 100 * 1024 * 1024,+ /** sum of every entry's DECLARED uncompressed size */+ totalUncompressed: 300 * 1024 * 1024,+ /** parts in the archive. The census template, all 82 layouts and 386 icons+ * included, has well under 2,000. */+ entries: 5_000,+ /** a large part compressing better than this is not a document part. Text+ * XML runs ~5–20:1; deflate's theoretical ceiling is ~1032:1. */+ ratio: 200,+ /** ...but only judged above this size, where a bomb would matter at all */+ ratioFloor: 1024 * 1024,+} as const++export class LimitError extends Error {}++const SIG_EOCD = 0x06054b50+const SIG_CD = 0x02014b50++/**+ * Throw a LimitError naming the limit, or return the declared totals.+ * Structural damage is left to readZip, which reports it better.+ */+export function preflight(bytes: Uint8Array): { entries: number; uncompressed: number } {+ const mb = (n: number) => `${Math.round(n / 1024 / 1024)}MB`+ if (bytes.length > LIMITS.inputBytes)+ throw new LimitError(`this file is ${mb(bytes.length)}; the limit is ${mb(LIMITS.inputBytes)}`)+ if (bytes.length < 22) return { entries: 0, uncompressed: 0 }+ const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)+ let eocd = -1+ for (let i = bytes.length - 22, min = Math.max(0, bytes.length - 22 - 0xffff); i >= min; i--) {+ if (v.getUint32(i, true) === SIG_EOCD) { eocd = i; break }+ }+ if (eocd < 0) return { entries: 0, uncompressed: 0 } // not a zip: readZip says so+ const count = v.getUint16(eocd + 10, true)+ const cdOffset = v.getUint32(eocd + 16, true)+ // A real .pptx is nowhere near 4GB or 65,535 parts. The ZIP64 escape values+ // here mean an archive built to be large, which this page has no reason to+ // take on.+ if (count === 0xffff || cdOffset === 0xffffffff)+ throw new LimitError('this archive uses ZIP64 sizes; a presentation never needs them')+ if (count > LIMITS.entries)+ throw new LimitError(`this archive has ${count} parts; the limit is ${LIMITS.entries}`)++ let total = 0+ let p = cdOffset+ for (let i = 0; i < count; i++) {+ if (p + 46 > bytes.length || v.getUint32(p, true) !== SIG_CD) break // damage: readZip's to report+ const csize = v.getUint32(p + 20, true)+ const usize = v.getUint32(p + 24, true)+ if (usize === 0xffffffff || csize === 0xffffffff)+ throw new LimitError('this archive uses ZIP64 sizes; a presentation never needs them')+ total += usize+ if (total > LIMITS.totalUncompressed)+ throw new LimitError(`this file unpacks to more than ${mb(LIMITS.totalUncompressed)}`)+ if (usize > LIMITS.ratioFloor && usize > LIMITS.ratio * Math.max(csize, 1))+ throw new LimitError(`one part compresses ${Math.round(usize / Math.max(csize, 1))}:1 — that is not a document part`)+ p += 46 + v.getUint16(p + 28, true) + v.getUint16(p + 30, true) + v.getUint16(p + 32, true)+ }+ return { entries: count, uncompressed: total }+}diff --git a/kernel/src/convert/media.ts b/convert/src/media.tssimilarity index 99%rename from kernel/src/convert/media.tsrename to convert/src/media.tsindex 58f747c1..fe0496b7 100644--- a/kernel/src/convert/media.ts+++ b/convert/src/media.ts@@ -26,7 +26,7 @@import { NS, attr, intAttr, kid, kids, descendants, type XElem } from './xml.ts'import { EMU_PER_PX, type InheritCtx, type OutImage } from './types.ts'-import type { ZipParts } from './zip.ts'+import type { ZipParts } from '../../kernel/src/convert/zip.ts'// --- relationships -----------------------------------------------------------diff --git a/kernel/src/convert/pptx.ts b/convert/src/pptx.tssimilarity index 98%rename from kernel/src/convert/pptx.tsrename to convert/src/pptx.tsindex 426f940b..003b6e50 100644--- a/kernel/src/convert/pptx.ts+++ b/convert/src/pptx.ts@@ -33,7 +33,7 @@// as `s<n>-<spId>-t` immediately after its shape (later paints above), welded// by groupId. Ids are unique per slide only, by design (the morph idiom).-import { readZip, type ZipParts } from './zip.ts'+import { readZip, type ZipParts } from '../../kernel/src/convert/zip.ts'import {NS, parseXml, kid, kids, attr, intAttr, textOf, resolveAlternate, type XElem,} from './xml.ts'@@ -46,7 +46,7 @@ import {import { textFrom, type TextDeps } from './text.ts'import { shapeFrom, groupChildren, type ShapeDeps, type GroupFrame } from './shapes.ts'import {- EMU_PER_PX, METRIC_SUBSTITUTES,+ EMU_PER_PX, METRIC_SUBSTITUTES, safeFace, cssFace,type ConvertResult, type OutDoc, type OutSlide, type OutElement, type OutShape,type InheritCtx, type ThemeCtx,} from './types.ts'@@ -255,13 +255,14 @@ function notesTextOf(notesXml: XElem): string {// --- misc ---------------------------------------------------------------------const cssFace = (name: string): string => (/[^A-Za-z0-9-]/.test(name) ? `'${name}'` : name)-/** The theme face as a CSS stack: the original first (a machine that has the- * real font uses it), its metric-compatible substitute second. */+ * real font uses it), its metric-compatible substitute second. A face that is+ * not safe to write into CSS (types.ts safeFace) is left out entirely. */function fontStack(face: string): string {- const sub = METRIC_SUBSTITUTES[face]- return sub ? `${cssFace(face)}, ${cssFace(sub)}, sans-serif` : `${cssFace(face)}, sans-serif`+ const safe = safeFace(face)+ if (!safe) return 'sans-serif'+ const sub = METRIC_SUBSTITUTES[safe]+ return sub ? `${cssFace(safe)}, ${cssFace(sub)}, sans-serif` : `${cssFace(safe)}, sans-serif`}function picFlipped(pic: XElem): boolean {diff --git a/kernel/src/convert/report.ts b/convert/src/report.tssimilarity index 100%rename from kernel/src/convert/report.tsrename to convert/src/report.tsdiff --git a/kernel/src/convert/shapes.ts b/convert/src/shapes.tssimilarity index 100%rename from kernel/src/convert/shapes.tsrename to convert/src/shapes.tsdiff --git a/kernel/src/convert/text.ts b/convert/src/text.tssimilarity index 97%rename from kernel/src/convert/text.tsrename to convert/src/text.tsindex 725b2233..73925d78 100644--- a/kernel/src/convert/text.ts+++ b/convert/src/text.ts@@ -32,7 +32,7 @@import { NS, kid, kids, attr, intAttr, textOf, type XElem } from './xml.ts'import {- EMU_PER_PX, METRIC_SUBSTITUTES,+ EMU_PER_PX, METRIC_SUBSTITUTES, safeFace, cssFace,type InheritCtx, type OutText, type ThemeCtx,} from './types.ts'import type { TextDefaults, ResolvedFrame, ChainLink } from './inherit.ts'@@ -93,7 +93,6 @@ function cnvIdOf(shape: XElem): string {}/** CSS font-family token: quote anything a bare identifier cannot say. */-const cssFace = (name: string): string => (/[^A-Za-z0-9-]/.test(name) ? `'${name}'` : name)/** ST_TextAutonumberScheme → the literal a frozen list shows. Census carries* only arabicPeriod (46), but alpha/roman are cheap enough to number right —@@ -406,12 +405,18 @@ export function textFrom(sp: XElem, ctx: InheritCtx, deps: TextDeps): OutText |return out}).join('<br>')- const sub = METRIC_SUBSTITUTES[dom.family]+ // A typeface name is source-file text headed for CSS (types.ts safeFace).+ const face = safeFace(dom.family)+ if (dom.family && !face) {+ ctx.report.add('dropped', 'font-name-unsafe', 'font',+ 'a typeface name contained characters that are not safe in CSS — the text uses a default face')+ }+ const sub = face ? METRIC_SUBSTITUTES[face] : undefinedif (sub) {ctx.report.add('approximated', 'font-substituted', `font "${dom.family}"`,`'${dom.family}' is not embedded; emitted as a metric-compatible stack with '${sub}'`)}- const fontFamily = sub ? `${cssFace(dom.family)}, ${cssFace(sub)}, sans-serif` : `${cssFace(dom.family)}, sans-serif`+ const fontFamily = !face ? 'sans-serif' : sub ? `${cssFace(face)}, ${cssFace(sub)}, sans-serif` : `${cssFace(face)}, sans-serif`const frame = deps.resolveFrame(sp, ctx)const id = `txt${cnvIdOf(sp)}`diff --git a/kernel/src/convert/theme.ts b/convert/src/theme.tssimilarity index 100%rename from kernel/src/convert/theme.tsrename to convert/src/theme.tsdiff --git a/kernel/src/convert/types.ts b/convert/src/types.tssimilarity index 79%rename from kernel/src/convert/types.tsrename to convert/src/types.tsindex d4f6c95d..8d1ff244 100644--- a/kernel/src/convert/types.ts+++ b/convert/src/types.ts@@ -163,6 +163,33 @@ export const EMU_PER_PX = 9525* concern); the emitted stack keeps the original first so a machine that has* the real face uses it.*/+/**+ * A typeface name from the source file, or undefined when it is not safe to+ * write into CSS.+ *+ * A .pptx names its own fonts, so a typeface name is attacker-controlled text,+ * and it lands in `fontFamily`, which the renderer interpolates into CSS. A+ * name like `x;}</style><img src=x onerror=…>` used to reach the document+ * verbatim. slides' untrusted-input gate catches it downstream, and render.ts+ * validates again at render time, but an importer should not produce the value+ * at all. Three layers, each sufficient alone, is the point.+ *+ * DENY rather than allow: real face names span every script ("游ゴシック",+ * "Segoe UI Semibold", "Helvetica Neue LT Std 55"), so a character allow-list+ * would reject genuine fonts. What is refused are the characters that mean+ * something to CSS or HTML, plus control characters, which no font name needs.+ */+export function safeFace(name: string | undefined): string | undefined {+ if (!name) return undefined+ const n = name.trim()+ if (!n || n.length > 100 || /[<>{};"'\\`]/.test(n) || /[\u0000-\u001f\u007f]/.test(n)) return undefined+ return n+}++/** A SAFE face as one CSS family token: bare when it is a plain identifier,+ * single-quoted otherwise (safeFace guarantees it holds no quote to escape). */+export const cssFace = (name: string): string => (/[^A-Za-z0-9-]/.test(name) ? `'${name}'` : name)+export const METRIC_SUBSTITUTES: Record<string, string> = {Calibri: 'Carlito',Cambria: 'Caladea',diff --git a/kernel/src/convert/xml.ts b/convert/src/xml.tssimilarity index 100%rename from kernel/src/convert/xml.tsrename to convert/src/xml.tsdiff --git a/convert/tsconfig.json b/convert/tsconfig.jsonnew file mode 100644index 00000000..c6f23077--- /dev/null+++ b/convert/tsconfig.json@@ -0,0 +1,26 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "useDefineForClassFields": true,+ "module": "ESNext",+ "lib": [+ "ES2022",+ "DOM",+ "DOM.Iterable"+ ],+ "skipLibCheck": true,+ "moduleResolution": "bundler",+ "allowImportingTsExtensions": true,+ "isolatedModules": true,+ "moduleDetection": "force",+ "noEmit": true,+ "strict": true,+ "noUnusedLocals": true,+ "noUnusedParameters": true,+ "noFallthroughCasesInSwitch": true+ },+ "include": [+ "src",+ "page"+ ]+}diff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex 00544b46..f8868c76 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -7442,6 +7442,56 @@ rigs treat a drawn arrow as a deliberate difference: named in`test-maths-lite.ts`, counted with the identical ones in the coverage floor.Cost: +966 B of shell.+## 2026-10-04 — PowerPoint import lives in convert/, beside the apps, and builds only on a verified, current shell++**Where it lives.** The pptx importer moved from `kernel/src/convert/` to a+top-level `convert/` (engine in `convert/src/`, the bento.page/import page in+`convert/page/`, the CLI at `convert/cli.mjs`). The kernel is the machinery+every app imports; no app imports the importer, so it does not belong there.+`kernel/src/convert/zip.ts` stays, because dash's xlsx import uses it. No+shell grows: `scripts/test-convert/boundary.ts` fails if any app or kernel+source imports `convert/`, or if the engine's bundles use a DOM global (the+CLI runs it in node, the page in a browser).++**What a converted file is built on.** A converted deck carries its shell for+good, so the converter never uses a shell it cannot vouch for.+`convert/src/deliver.ts` fetches the release manifest, verifies its signature+with the kernel's `verifySigned`, then fetches the shell with `fetchPinned`+against the signed sha256. A failure at either step is a refusal, never a+fallback. The page fetches from its own origin (its CSP is `connect-src+'self'`) by re-rooting the signed URL's path. That grants no trust, because+trust comes from the signature and the pin, not the URL.++**The version floor.** A signature proves a shell is genuine, not that it is+current: a stale mirror or a cached manifest still verifies. `MIN_SHELL_VERSION`+in `deliver.ts` is the oldest release the converter will build on, checked+before the shell is downloaded. A version that is not plain dotted numbers is+refused rather than compared, since `compareVersions` reads non-numeric parts+as 0. **A release that ships a security fix bumps it to its own version.**+`scripts/release.mjs` refuses a slides release below the floor, so the page+can never refuse the release it shipped with.++**Converter output is untrusted input.** A `.pptx` is attacker-controlled, so+the converted document passes slides' untrusted-input gate (`sanitizeSlide`,+`sanitizeAssets`, `sanitizeFonts`) and `parseDoc` before it is spliced. A+preflight over the zip's central directory bounds input size, entry count,+total declared size and compression ratio, and refuses ZIP64, before anything+is inflated. Typeface names, which reach CSS, are filtered in the importer+too, so three independent layers refuse them.++**The page's privacy claim is its CSP.** `scripts/build-import-page.mjs`+inlines one script and one stylesheet and writes a policy of `default-src+'none'`, `connect-src 'self'`, and script and style allowed only by the+sha256 of that exact content. The build refuses a page with more than one+policy or an inline script that is not the hashed one (a `String.replace`+`$`-pattern once spliced a second page head into the output).+`scripts/test-convert/import-page.ts` checks the built page, including that+it loads no resource from anywhere and names no network destination but the+manifest.++**Not done here.** The splice writes the document block directly rather than+going through `serializeWith`, so a converted file has no first-page+thumbnail until its first save in the app.## 2026-10-04 — bento/spaces saves stamp `collab.sync`; which writes carry itSlides has always stamped the session's CRDT state into `doc.collab.sync` ondiff --git a/scripts/build-import-page.mjs b/scripts/build-import-page.mjsnew file mode 100644index 00000000..24016d1b--- /dev/null+++ b/scripts/build-import-page.mjs@@ -0,0 +1,85 @@+#!/usr/bin/env node+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// Build bento.page/import — the public .pptx → .bento.html page.+//+// node scripts/build-import-page.mjs <out/index.html>+//+// Bundles convert/page/import-page.ts (which runs the same convert/src/api.ts+// as the CLI) and inlines it into site-src/import.html, then writes a Content+// Security Policy built from the SHA-256 of the exact inline script and style.+//+// THE CSP IS THE PRIVACY PROMISE, ENFORCED. The page says the file never leaves+// the device. `connect-src 'self'` makes that the browser's rule rather than+// this code's intention: the page can talk to bento.page and nothing else, and+// it only ever does so twice — the signed release manifest and the shell it+// pins. `default-src 'none'` removes everything not named. Scripts and styles+// run only by hash, so nothing injected into the page — by a CDN edge, a+// browser extension rewriting markup, or a future edit that forgets — can run.+// `frame-ancestors` is not settable from a meta tag and is omitted rather than+// written somewhere it would be silently ignored.++import { spawnSync } from 'node:child_process'+import { createHash } from 'node:crypto'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'+import { fileURLToPath } from 'node:url'++const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')+const out = process.argv[2]+if (!out) { console.error('usage: build-import-page.mjs <out/index.html>'); process.exit(2) }++const esbuild = path.join(root, 'slides/node_modules/.bin/esbuild')+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'bento-import-page-'))+const bundle = path.join(tmp, 'page.js')+const built = spawnSync(esbuild, [+ path.join(root, 'convert/page/import-page.ts'), '--bundle', '--format=esm', '--minify',+ '--platform=browser', '--target=es2022', '--log-level=error', `--outfile=${bundle}`,+], { encoding: 'utf8' })+if (built.status !== 0) { console.error(built.stderr); process.exit(1) }+let js = fs.readFileSync(bundle, 'utf8')+fs.rmSync(tmp, { recursive: true, force: true })++// Same belt as save.ts (PLATFORM hard-won detail #4): the bundle is inlined into+// a <script>, so it must never contain a literal close tag.+const CLOSE = '</' + 'script'+if (js.toLowerCase().includes(CLOSE)) js = js.replace(/<\/(script)/gi, '<\\/$1')++let html = fs.readFileSync(path.join(root, 'site-src/import.html'), 'utf8')+const style = /<style>([\s\S]*?)<\/style>/.exec(html)?.[1]+if (style === undefined) { console.error('site-src/import.html has no <style> block'); process.exit(1) }+const sha = (s) => `'sha256-${createHash('sha256').update(s, 'utf8').digest('base64')}'`++const csp = [+ "default-src 'none'",+ `script-src ${sha(js)}`,+ `style-src ${sha(style)}`,+ "connect-src 'self'",+ "img-src 'self' data:",+ "base-uri 'none'",+ "form-action 'none'",+].join('; ')++// REPLACER FUNCTIONS, not replacement strings. A string replacement interprets+// `$&`, `$'` and `` $` `` — and a minified bundle is full of `$`. The first+// build used strings: a `` $` `` in the bundle spliced a second copy of the page+// head (CSP included) into the output, so the inline script was no longer the+// script that had been hashed and the page's own CSP would have blocked it.+html = html+ .replace('<!--IMPORT_CSP-->', () => `<meta http-equiv="Content-Security-Policy" content="${csp}">`)+ .replace('<!--IMPORT_SCRIPT-->', () => `<script type="module">${js}</script>`)++// Belt: the page must carry exactly one CSP, and the script it runs must be the+// one the CSP names. Cheap, and it is precisely the check that would have+// caught the bug above at build time rather than in a visitor's console.+if (html.split('http-equiv="Content-Security-Policy"').length !== 2)+ { console.error('built page does not carry exactly one CSP'); process.exit(1) }+const inline = /<script type="module">([\s\S]*)<\/script>/.exec(html)?.[1]+if (inline !== js || !csp.includes(sha(inline)))+ { console.error('inline script does not match its CSP hash'); process.exit(1) }++fs.mkdirSync(path.dirname(out), { recursive: true })+fs.writeFileSync(out, html)+console.log(`import page: ${out} (${Math.round(html.length / 1024)}KB, script ${Math.round(js.length / 1024)}KB)`)diff --git a/scripts/release.mjs b/scripts/release.mjsindex 5d5bebb8..ec1bfbf5 100644--- a/scripts/release.mjs+++ b/scripts/release.mjs@@ -57,6 +57,20 @@ if (!app) {}const version = JSON.parse(readFileSync(join(root, `${app.dir}/package.json`), 'utf8')).version++// bento.page/import refuses to build on a slides shell older than+// convert/src/deliver.ts MIN_SHELL_VERSION. A slides release below that floor+// would ship a page that refuses the very release it shipped with, so it is+// stopped here, before anything is built or signed.+if (app.ownsSiteContent) {+ const floor = /export const MIN_SHELL_VERSION = '([\d.]+)'/.exec(+ readFileSync(join(root, 'convert/src/deliver.ts'), 'utf8'))?.[1]+ if (!floor) { console.error('✗ convert/src/deliver.ts has no MIN_SHELL_VERSION'); process.exit(1) }+ if (cmpVer(version, floor) < 0) {+ console.error(`✗ ${app.appId} v${version} is below MIN_SHELL_VERSION ${floor} (convert/src/deliver.ts): bento.page/import would refuse this release`)+ process.exit(1)+ }+}const shellSrc = join(root, `${app.dir}/dist-single/${app.shell}`)// Where the site is assembled. `site/` for a real release — publish-site.mjs// mirrors exactly that path — and `--out` for a rehearsal, so@@ -379,6 +393,12 @@ if (app.ownsSiteContent) {execFileSync('node', [join(root, 'scripts/build-404-deck.mjs'), join(site, '404.bento.html')], { stdio: 'inherit' })cpSync(join(root, 'site-src/404.html'), join(site, '404.html'))+ // /import — drop a .pptx, get a .bento.html back, converted in the visitor's+ // browser (convert/page + convert/src; nothing uploaded). Built into a single+ // page with a hash-based CSP (scripts/build-import-page.mjs). No shell carries+ // any of it: the converter lives on this page and nowhere else.+ execFileSync('node', [join(root, 'scripts/build-import-page.mjs'), join(site, 'import/index.html')], { stdio: 'inherit' })+// /q — "this QR code is a presentation" (deck lives in the URL fragment).execFileSync('node', [join(root, 'scripts/build-qr-page.mjs'), join(site, 'q/index.html')], { stdio: 'inherit' })diff --git a/scripts/test-convert.ts b/scripts/test-convert.tsindex 777c06f3..5fe9e927 100644--- a/scripts/test-convert.ts+++ b/scripts/test-convert.ts@@ -11,8 +11,9 @@// alphabetical and deliberate: load.ts (the loadability gate) runs among the// rest, and any child's non-zero exit fails the suite.-import { readdirSync } from 'node:fs'+import { readdirSync, readFileSync, mkdtempSync, rmSync } from 'node:fs'import { spawnSync } from 'node:child_process'+import { tmpdir } from 'node:os'import { join, dirname } from 'node:path'import { fileURLToPath } from 'node:url'@@ -24,7 +25,23 @@ const rigs = readdirSync(dir)const failed: string[] = []for (const rig of rigs) {console.log(`\n== ${rig} ==`)- const r = spawnSync(process.execPath, [join(dir, rig)], { stdio: 'inherit' })+ // A rig that reaches slides' untrusted-input gate cannot run under plain+ // node: the gate's own imports are extensionless. Such a rig says `// @bundle`+ // near its top and is bundled with the repo's esbuild first — the same move+ // scripts/bento-check.mjs and the clipboard rig make.+ let target = join(dir, rig)+ let tmp = ''+ if (/^\/\/ @bundle\b/m.test(readFileSync(target, 'utf8').slice(0, 2000))) {+ tmp = mkdtempSync(join(tmpdir(), 'convert-rig-'))+ const out = join(tmp, rig.replace(/\.ts$/, '.mjs'))+ const b = spawnSync(join(dir, '../../slides/node_modules/.bin/esbuild'),+ [target, '--bundle', '--platform=node', '--format=esm', '--log-level=error', `--outfile=${out}`],+ { stdio: 'inherit' })+ if (b.status !== 0) { failed.push(rig); rmSync(tmp, { recursive: true, force: true }); continue }+ target = out+ }+ const r = spawnSync(process.execPath, [target], { stdio: 'inherit' })+ if (tmp) rmSync(tmp, { recursive: true, force: true })if (r.status !== 0) failed.push(rig)}diff --git a/scripts/test-convert/boundary.ts b/scripts/test-convert/boundary.tsnew file mode 100644index 00000000..1e063a3c--- /dev/null+++ b/scripts/test-convert/boundary.ts@@ -0,0 +1,66 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// Boundary rig: convert/ is a LIBRARY BESIDE the apps, never inside a shell.+//+// The maintainer's rule for #88 was "no app UI, nothing added to any shell".+// Two things keep that true after today:+// 1. No app or kernel source imports top-level convert/. Only the CLI, the+// /import page and the rigs may. (kernel/src/convert/zip.ts is kernel+// machinery the engine borrows — that direction is allowed.)+// 2. The engine is DOM-free, so the CLI can run it in node and the page in a+// browser from the same code. Checked on the minified bundle — comments+// and strings like "window" (a DrawingML colour name) cannot false-alarm+// there, and every reachable file is covered, not just the ones listed.++import { spawnSync } from 'node:child_process'+import fs from 'node:fs'+import path from 'node:path'+import { fileURLToPath } from 'node:url'++let failures = 0+let checks = 0+function ok(cond: boolean, msg: string) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) }+ else console.log(` ok ${msg}`)+}++const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')+const convertDir = path.join(root, 'convert') + path.sep++console.log('nothing in a shell reaches convert/')+function* walk(d: string): Generator<string> {+ if (!fs.existsSync(d)) return+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {+ if (e.name === 'node_modules' || e.name.startsWith('dist')) continue+ const p = path.join(d, e.name)+ if (e.isDirectory()) yield* walk(p)+ else if (/\.(ts|tsx|js|mjs)$/.test(e.name)) yield p+ }+}+const SPEC = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)['"]([^'"]+)['"]/g+for (const zone of ['slides/src', 'dash/src', 'spaces/src', 'type/src', 'kernel/src']) {+ const bad: string[] = []+ let files = 0+ for (const f of walk(path.join(root, zone))) {+ files+++ for (const m of fs.readFileSync(f, 'utf8').matchAll(SPEC)) {+ if (!m[1].startsWith('.')) continue+ if (path.resolve(path.dirname(f), m[1]).startsWith(convertDir)) bad.push(`${path.relative(root, f)} → ${m[1]}`)+ }+ }+ ok(files > 0 ? bad.length === 0 : true, `${zone}: ${files} files, none import convert/ ${bad.length ? '(' + bad.join('; ') + ')' : ''}`)+}++console.log('the engine is DOM-free')+const esbuild = path.join(root, 'slides/node_modules/.bin/esbuild')+const DOM = /(?<![.\w$"'`])(document|window|DOMParser|XMLSerializer|localStorage|sessionStorage|navigator|HTMLElement|Image|FileReader|createElement)(?=\s*[.(\[])/g+for (const entry of ['convert/src/pptx.ts', 'convert/src/limits.ts']) {+ const r = spawnSync(esbuild, [path.join(root, entry), '--bundle', '--format=esm', '--minify', '--platform=neutral', '--log-level=error'], { encoding: 'utf8' })+ const hits = [...new Set([...(r.stdout ?? '').matchAll(DOM)].map(m => m[1]))]+ ok(r.status === 0 && r.stdout.length > 1000 && hits.length === 0, `${entry} and all it reaches use no DOM global (${hits.join(', ') || 'none'})`)+}++console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)diff --git a/scripts/test-convert/cli.ts b/scripts/test-convert/cli.tsnew file mode 100644index 00000000..c405db07--- /dev/null+++ b/scripts/test-convert/cli.ts@@ -0,0 +1,116 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// bento convert, driven as a user drives it: a child process, real files, the+// real built slides shell, exit codes and stderr.+//+// Offline by construction — every import here passes --shell, so nothing is+// fetched. The signed-channel path is the delivery rig's (deliver.ts), which+// drives the real verifySigned with a throwaway key. What this rig owns is the+// command line: usage and refusals, the import itself, and that a converted+// file OPENS — booted in headless Chrome through+// scripts/bento-check.mjs, the same harness CI already trusts.+//+// Like the bento-check rig: without Chrome or a built shell it SKIPS locally,+// and in CI a skip is a failure.++import { spawnSync } from 'node:child_process'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'+import { fileURLToPath } from 'node:url'+import { fxMinimal } from './_fixtures.ts'++const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '../..')+const cli = path.join(root, 'convert/cli.mjs')+const shell = path.join(root, 'slides/dist-single/Bento_Slides.bento.html')+const inCI = !!process.env.CI || !!process.env.GITHUB_ACTIONS++let failures = 0+let checks = 0+function ok(cond: boolean, msg: string) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) }+ else console.log(` ok ${msg}`)+}++if (!fs.existsSync(shell)) {+ const why = `no built shell at ${shell} (cd slides && npm run build:single)`+ if (inCI) { console.log(` FAIL ${why} — cannot skip in CI`); process.exit(1) }+ console.log(` ⚠ SKIPPED — ${why}`)+ process.exit(0)+}++const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'convert-cli-rig-'))+const run = (args: string[]) => {+ const r = spawnSync(process.execPath, [cli, ...args], { encoding: 'utf8', timeout: 120_000 })+ return { code: r.status, out: r.stdout, err: r.stderr }+}+const BLOCK = '<script type="application/bento+json" id="bento-doc">'+const CLOSE = '</' + 'script>'+const docOf = (html: string) => {+ const s = html.indexOf(BLOCK) + BLOCK.length+ return JSON.parse(html.slice(s, html.indexOf(CLOSE, s)))+}++console.log('usage')+{+ const r = run([])+ ok(r.code === 2 && /usage:/.test(r.err), 'no arguments → exit 2 and the usage')+ ok(run(['x.pptx', '--offline']).code === 2, '--offline without --shell → exit 2 (checked before touching the disk)')+ ok(run(['x.bento.html']).code === 2, 'an input that is not a .pptx → exit 2')+ ok(run(['x.pptx', '--frobnicate']).code === 2, 'an unknown option → exit 2')+ ok(run(['missing.pptx', '--shell', shell]).code === 1, 'a missing input → exit 1')+ const h = run(['--help'])+ ok(h.code === 0 && /usage:/.test(h.out), '--help → exit 0, usage on STDOUT')+ ok(run(['convert', '--help']).code === 0, 'a leading `convert` is accepted, for a future `bento` dispatcher')+}++console.log('import')+const pptx = path.join(tmp, 'rig.pptx')+fs.writeFileSync(pptx, await fxMinimal())+const imported = path.join(tmp, 'rig.bento.html')+{+ const r = run([pptx, '--shell', shell, '-o', imported])+ ok(r.code === 0 && fs.existsSync(imported), `a .pptx imports into the real shell (exit ${r.code})`)+ ok(r.out === '', 'stdout stays clean — the report goes to stderr')+ ok(/fidelity:/.test(r.err) && /NOT verified against the release channel/.test(r.err),+ 'stderr carries the report, and says plainly that a --shell was not channel-verified')+ const doc = docOf(fs.readFileSync(imported, 'utf8'))+ ok(doc.format === 'bento/slides' && doc.title === 'Rig Deck', 'the file carries the converted document')+ const gate = spawnSync(process.execPath, [path.join(root, 'scripts/shell-gate.mjs'), imported], { encoding: 'utf8' })+ ok(gate.status === 0, 'the output passes the splice-contract gate every release runs')+}++console.log('it opens')+{+ const CHROME = [process.env.BENTO_CHROME, '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',+ '/usr/bin/google-chrome', '/usr/bin/google-chrome-stable', '/usr/bin/chromium', '/usr/bin/chromium-browser',+ ].find((p): p is string => !!p && fs.existsSync(p))+ ?? (spawnSync('which', ['google-chrome']).status === 0 ? 'google-chrome' : undefined)+ if (!CHROME) {+ if (inCI) ok(false, 'no Chrome — the "it opens" check cannot skip in CI')+ else console.log(' ⚠ SKIPPED — no Chrome found (set BENTO_CHROME)')+ } else {+ // The converted DOCUMENT, booted in the real shell through bento-check's+ // JSON input — not the spliced .bento.html. Measured 2026-09-26: on a+ // loaded machine bento-check's .bento.html input path runs to its 90s+ // ceiling for ANY file (the bare shell reports at 90042ms; a tiny+ // hand-written deck never reports), while the same document as JSON boots+ // in 738ms. That is bento-check's defect, filed for ops, and not a reason+ // to weaken this check. The spliced FILE is covered separately and fully+ // above: the splice-contract gate, and an exact read-back of the block.+ const json = path.join(tmp, 'imported.json')+ fs.writeFileSync(json, JSON.stringify(docOf(fs.readFileSync(imported, 'utf8'))))+ const r = spawnSync(process.execPath, [path.join(root, 'scripts/bento-check.mjs'), json, '--shell', shell, '--json', '--fail-on', 'error'],+ { encoding: 'utf8', timeout: 180_000, env: { ...process.env, BENTO_CHROME: CHROME } })+ let report: { ok?: boolean; slides?: number } | null = null+ try { report = JSON.parse(r.stdout) } catch { /* reported below */ }+ ok(r.status === 0 && report?.ok === true && report.slides === 1,+ `the converted document boots in the real shell in headless Chrome, no errors (exit ${r.status}, slides ${report?.slides})`)+ }+}++fs.rmSync(tmp, { recursive: true, force: true })+console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)diff --git a/scripts/test-convert/deliver.ts b/scripts/test-convert/deliver.tsnew file mode 100644index 00000000..af58922f--- /dev/null+++ b/scripts/test-convert/deliver.ts@@ -0,0 +1,200 @@+// @bundle — reaches slides' untrusted-input gate, whose imports are extensionless+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// Delivery rig: what makes a converted file safe to hand someone.+//+// THE VERIFY CHAIN, WITH THE REAL CODE. kernel/src/update.ts lets a fork supply+// its own release key through configureApp({ publicKeyJwk }). This rig mints a+// throwaway P-256 keypair, signs its OWN manifest with it, and drives the real+// verifySigned + fetchPinned — so every refusal below is the production check+// refusing, not a mock agreeing. Each negative control breaks exactly one link.+//+// THE NETWORK. globalThis.fetch is replaced by a recorder serving from a map,+// so "the page only talks to the manifest and the shell" is asserted as the+// exact list of URLs requested, not inferred.++import { configureApp } from '../../kernel/src/app.ts'+import { fetchVerifiedShell, gateDoc, spliceIntoShell, extractDoc, MIN_SHELL_VERSION } from '../../convert/src/deliver.ts'+import { pptxToBento, LIMITS, LimitError } from '../../convert/src/api.ts'+import { preflight } from '../../convert/src/limits.ts'+import { writeZip } from '../../kernel/src/convert/zip.ts'+import { buildPptx, slide, sp, xfrm, fxMinimal } from './_fixtures.ts'++let failures = 0+let checks = 0+function ok(cond: boolean, msg: string) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) }+ else console.log(` ok ${msg}`)+}+async function refuses(p: Promise<unknown>, want: RegExp, msg: string) {+ try { await p; ok(false, `${msg} (it was NOT refused)`) }+ catch (e) { ok(want.test(String((e as Error).message)), `${msg} — "${(e as Error).message}"`) }+}++// --- a throwaway release key, installed the way a fork would -----------------+const kp = await crypto.subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign', 'verify'])+const pub = await crypto.subtle.exportKey('jwk', kp.publicKey) as { kty: 'EC'; crv: 'P-256'; x: string; y: string }+configureApp({ appId: 'bento-slides', appName: 'bento/slides', manifestUrl: 'https://rig.test/m.json',+ publicKeyJwk: { kty: 'EC', crv: 'P-256', x: pub.x, y: pub.y } })++const b64 = (u: Uint8Array) => btoa(String.fromCharCode(...u))+const hex = (b: ArrayBuffer) => [...new Uint8Array(b)].map((x) => x.toString(16).padStart(2, '0')).join('')+async function sign(payload: object) {+ const text = JSON.stringify(payload)+ const sig = new Uint8Array(await crypto.subtle.sign({ name: 'ECDSA', hash: 'SHA-256' }, kp.privateKey, new TextEncoder().encode(text)))+ return JSON.stringify({ payload: text, sig: b64(sig) })+}++// A minimal but real-shaped shell: the block, a title, and other scripts whose+// close tags the splice must not disturb.+const SHELL = '<!DOCTYPE html>\n<html><head><meta charset="utf-8"><title>bento/slides</title>' ++ '<script type="application/bento+json" id="bento-doc"></' + 'script>' ++ '<script>/* runtime */ var a = 1</' + 'script></head><body><div id="bento-splash"></div>' ++ '<script type="bento/deflate-b64">AAAA</' + 'script></body></html>'+const shellBytes = new TextEncoder().encode(SHELL)+const pin = hex(await crypto.subtle.digest('SHA-256', shellBytes))++const requested: string[] = []+let served: Record<string, string | Uint8Array> = {}+globalThis.fetch = (async (input: string | URL) => {+ const url = String(input)+ requested.push(url)+ const body = served[url]+ if (body === undefined) return new Response('not here', { status: 404 })+ return new Response(body)+}) as typeof fetch++const M = 'https://rig.test/releases/slides/manifest.json'+const S = 'https://rig.test/releases/slides/Bento_Slides.bento.html'+const good = { app: 'bento-slides', version: '9.9.9', sha256: pin, url: S }++console.log('the verify chain')+served = { [M]: await sign(good), [S]: shellBytes }+requested.length = 0+const v = await fetchVerifiedShell(M)+ok(v.version === '9.9.9' && v.html === SHELL, 'a correctly signed manifest pinning the right bytes is accepted')+ok(requested.length === 2 && requested[0] === M && requested[1] === S,+ `exactly two requests, manifest then shell (got ${JSON.stringify(requested)})`)++// each negative control breaks exactly ONE link+served = { [M]: (await sign(good)).replace('9.9.9', '9.9.8'), [S]: shellBytes }+await refuses(fetchVerifiedShell(M), /signature|payload|JSON/i, 'NEGATIVE: a payload edited after signing is refused')+const other = await crypto.subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign'])+const forged = JSON.stringify({ payload: JSON.stringify(good), sig: b64(new Uint8Array(await crypto.subtle.sign(+ { name: 'ECDSA', hash: 'SHA-256' }, other.privateKey, new TextEncoder().encode(JSON.stringify(good))))) })+served = { [M]: forged, [S]: shellBytes }+await refuses(fetchVerifiedShell(M), /INVALID/, 'NEGATIVE: a manifest signed by a different key is refused')+const tampered = new Uint8Array([...shellBytes, 0x20])+served = { [M]: await sign(good), [S]: tampered }+await refuses(fetchVerifiedShell(M), /signed pin/, 'NEGATIVE: one extra byte on the shell is refused')+served = { [M]: await sign({ ...good, app: 'bento-spaces' }), [S]: shellBytes }+await refuses(fetchVerifiedShell(M), /malformed/, 'NEGATIVE: a genuine manifest for ANOTHER app is refused')+served = { [M]: JSON.stringify({ payload: JSON.stringify(good) }), [S]: shellBytes }+await refuses(fetchVerifiedShell(M), /malformed/, 'NEGATIVE: an unsigned manifest is refused')++console.log('the version floor')+// A GENUINE, correctly signed and pinned release below the floor: everything+// but the version is good, so only the floor can refuse it.+const below = MIN_SHELL_VERSION.replace(/(\d+)$/, (n) => String(Number(n) - 1))+served = { [M]: await sign({ ...good, version: below }), [S]: shellBytes }+requested.length = 0+await refuses(fetchVerifiedShell(M), /older than/, `NEGATIVE: a validly signed ${below} shell is refused (floor ${MIN_SHELL_VERSION})`)+ok(requested.length === 1 && requested[0] === M, `and its shell is never downloaded (requests: ${JSON.stringify(requested)})`)+served = { [M]: await sign({ ...good, version: MIN_SHELL_VERSION }), [S]: shellBytes }+ok((await fetchVerifiedShell(M)).version === MIN_SHELL_VERSION, `the floor itself (${MIN_SHELL_VERSION}) is accepted`)+for (const odd of [`${MIN_SHELL_VERSION}-rc1`, 'latest', ''])+{+ served = { [M]: await sign({ ...good, version: odd }), [S]: shellBytes }+ await refuses(fetchVerifiedShell(M), /does not recognise/, `NEGATIVE: a non-numeric version ${JSON.stringify(odd)} is refused, not read as 0`)+}++console.log('same-origin resolution (the public page)')+served = { [M]: await sign(good), ['https://page.test/releases/slides/Bento_Slides.bento.html']: shellBytes }+requested.length = 0+const r = await fetchVerifiedShell(M, fetch, (u) => new URL(new URL(u).pathname, 'https://page.test/import/').href)+ok(r.html === SHELL && requested[1] === 'https://page.test/releases/slides/Bento_Slides.bento.html',+ 'the shell is fetched from the resolved (own-origin) URL and still verified')+served = { [M]: await sign(good), ['https://page.test/releases/slides/Bento_Slides.bento.html']: tampered }+await refuses(fetchVerifiedShell(M, fetch, (u) => new URL(new URL(u).pathname, 'https://page.test/').href),+ /signed pin/, 'NEGATIVE: re-rooting the URL buys no trust — other bytes there are still refused')++console.log('the splice contract')+const { doc } = gateDoc({+ format: 'bento/slides', version: '1.0.0', title: 'A & B </' + 'script><b>', size: { width: 1280, height: 720 },+ theme: { background: '#FFFFFF', color: '#000000', accent: '#F7A600', fontFamily: 'system-ui' },+ assets: {}, fonts: null, slides: [{ id: 's1', name: 'one', background: '#FFFFFF', transition: 'none', notes: '', elements: [] }],+})+const out = spliceIntoShell(SHELL, doc)+const CLOSE = '</' + 'script>'+ok(out.split(CLOSE).length === SHELL.split(CLOSE).length, 'the script-close count is unchanged')+ok(out.split('id="bento-doc"').length === 2, 'exactly one #bento-doc block')+ok(!/<\/script><b>/.test(out.slice(out.indexOf('id="bento-doc"'))), 'a title containing a close tag cannot break out of the block')+ok(JSON.stringify(extractDoc(out)) === JSON.stringify(doc), 'the block reads back as exactly the document written')+ok(/<title>A & B <\/script><b> — bento\/slides<\/title>/.test(out), 'the <title> is set and escaped')+let twice = ''+try { spliceIntoShell(SHELL.replace('</head>', '<script type="application/bento+json" id="bento-doc"></' + 'script></head>'), doc) }+catch (e) { twice = String((e as Error).message) }+ok(/exactly one/.test(twice), 'NEGATIVE: a shell carrying two #bento-doc blocks is refused')++console.log('the untrusted-input gate')+// Hostile strings in every attacker-controlled place the importer reads.+const EVIL = 'x" onerror="alert(1)'+const hostile = await buildPptx({+ core: '<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"' ++ ' xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:title></script><script>alert(1)</script></dc:title></cp:coreProperties>',+ slides: [{+ xml: slide(sp(2, EVIL.replace(/"/g, '"'),+ `<p:spPr>${xfrm(914400, 914400, 2743200, 457200)}<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>` ++ '<p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="en-US">' ++ '<a:latin typeface="x;}</style><img src=x onerror=alert(1)>"/></a:rPr>' ++ '<a:t><img src=x onerror=alert(1)></script></a:t></a:r></a:p></p:txBody>')),+ }],+})+const res = await pptxToBento(hostile, SHELL)+const block = res.html.slice(res.html.indexOf('id="bento-doc"'), res.html.indexOf(CLOSE, res.html.indexOf('id="bento-doc"')))+ok(!block.includes('<'), 'no raw "<" survives into the #bento-doc block from any hostile field')+ok(res.html.split(CLOSE).length === SHELL.split(CLOSE).length, 'hostile content adds no script-close anywhere in the file')+ok(!/<img[^>]*onerror/i.test(res.html), 'no live <img onerror> anywhere in the output')+const back = extractDoc(res.html) as { slides: Array<{ elements: Array<{ type: string; fontFamily?: string; html?: string }> }> }+const texts = back.slides.flatMap((s) => s.elements).filter((e) => e.type === 'text')+// NON-VACUOUS: every check above passes trivially on a deck with no content.+ok(texts.length === 1 && /onerror/.test(texts[0].html ?? ''),+ 'the hostile text element SURVIVES, its content escaped rather than removed — the checks above tested something')+// LAYER 1 — the importer refuses to write an unsafe typeface at all.+ok(texts.length === 1 && texts[0].fontFamily === 'sans-serif',+ `the importer drops a typeface that is unsafe in CSS (got ${JSON.stringify(texts[0]?.fontFamily)})`)+ok(res.report.entries.some((e) => e.code === 'font-name-unsafe'), 'and says so in the fidelity report')+// LAYER 2 — the gate, on its own. Hand it the hostile value directly, as if the+// importer had regressed: it must still be dropped, and reported.+const direct = gateDoc({+ format: 'bento/slides', version: '1.0.0', title: 't', size: { width: 1280, height: 720 },+ theme: { background: '#FFFFFF', color: '#000000', accent: '#F7A600', fontFamily: 'system-ui' },+ assets: {}, fonts: null,+ slides: [{ id: 's1', name: 'one', background: '#FFFFFF', transition: 'none', notes: '', elements: [{+ id: 'e1', type: 'text', x: 0, y: 0, w: 100, h: 40, rotation: 0, opacity: 1, html: 'hi',+ fontSize: 20, fontWeight: 400, color: '#000000', align: 'left', valign: 'top', lineHeight: 1.2,+ fontFamily: "'x;}</style><img src=x onerror=alert(1)>', sans-serif",+ }] }],+})+ok(direct.dropped.some((d) => /fontFamily/.test(d.path)),+ 'NEGATIVE: the gate alone still drops a hostile fontFamily — the backstop holds if the importer regresses')+const clean = await pptxToBento(await fxMinimal(), SHELL)+ok(clean.gated.length === 0, 'a well-formed deck loses nothing to the gate')++console.log('limits, before anything is inflated')+const plain = await fxMinimal()+ok((() => { try { preflight(plain); return true } catch { return false } })(), 'a normal deck passes preflight')+const big = new Uint8Array(LIMITS.inputBytes + 1)+try { preflight(big); ok(false, 'NEGATIVE: an over-size input is refused') } catch (e) { ok(e instanceof LimitError, 'NEGATIVE: an over-size input is refused') }+// A real deflate bomb: 5MB of zeros compresses ~1000:1.+const bomb = await writeZip([{ name: 'ppt/zeros.xml', data: new Uint8Array(5 * 1024 * 1024) }])+try { preflight(bomb); ok(false, 'NEGATIVE: a high-ratio part is refused') }+catch (e) { ok(e instanceof LimitError && /compresses/.test((e as Error).message), `NEGATIVE: a ${Math.round(5 * 1024 * 1024 / bomb.length)}:1 part is refused before inflation`) }+const many = await writeZip(Array.from({ length: LIMITS.entries + 1 }, (_, i) => ({ name: `p${i}.xml`, data: new Uint8Array([1]) })))+try { preflight(many); ok(false, 'NEGATIVE: too many parts are refused') } catch (e) { ok(e instanceof LimitError && /parts/.test((e as Error).message), 'NEGATIVE: too many parts are refused') }+await refuses(pptxToBento(bomb, SHELL), /compresses/, 'the API applies the limits before converting')++console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)diff --git a/scripts/test-convert/import-page.ts b/scripts/test-convert/import-page.tsnew file mode 100644index 00000000..d2925dd4--- /dev/null+++ b/scripts/test-convert/import-page.ts@@ -0,0 +1,86 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// bento.page/import rig: the BUILT page keeps the promise it prints.+//+// The page says the file never leaves the device. The enforcement is its+// Content Security Policy — `connect-src 'self'` means the browser itself+// refuses any other destination — so this rig builds the page exactly as the+// release does and asserts the policy, not the intention:+// · one CSP, `default-src 'none'`, `connect-src 'self'` and nothing wider;+// · the inline script and style are the ones the CSP hashes (a mismatch+// means the page's own policy would block it — the $-pattern bug);+// · the page loads no resource from anywhere (no script/img/iframe/link+// that a browser fetches), and the script's only absolute URL is the+// bento.page manifest (XML namespace URIs are identifiers, never fetched).+// The network behaviour of the code itself — exactly [manifest, shell], and+// refusal on any broken signature or pin — is deliver.ts's rig.++import { spawnSync } from 'node:child_process'+import { createHash } from 'node:crypto'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'+import { fileURLToPath } from 'node:url'++let failures = 0+let checks = 0+function ok(cond: boolean, msg: string) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) }+ else console.log(` ok ${msg}`)+}++const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'bento-import-rig-'))+const out = path.join(tmp, 'import/index.html')+const b = spawnSync(process.execPath, [path.join(root, 'scripts/build-import-page.mjs'), out], { encoding: 'utf8' })+ok(b.status === 0 && fs.existsSync(out), `the page builds (exit ${b.status}${b.stderr ? ': ' + b.stderr.trim() : ''})`)+const html = fs.existsSync(out) ? fs.readFileSync(out, 'utf8') : ''+const sha = (s: string) => `'sha256-${createHash('sha256').update(s, 'utf8').digest('base64')}'`++console.log('the policy')+const metas = [...html.matchAll(/<meta http-equiv="Content-Security-Policy" content="([^"]*)">/g)]+ok(metas.length === 1, `exactly one CSP (${metas.length})`)+const csp = new Map<string, string[]>()+for (const d of (metas[0]?.[1] ?? '').split(';')) {+ const [k, ...v] = d.trim().split(/\s+/)+ if (k) csp.set(k, v)+}+const is = (k: string, v: string[]) => JSON.stringify(csp.get(k)) === JSON.stringify(v)+ok(is('default-src', ["'none'"]), `default-src 'none' (${csp.get('default-src')})`)+ok(is('connect-src', ["'self'"]), `connect-src is 'self' and nothing else (${csp.get('connect-src')})`)+ok(is('base-uri', ["'none'"]) && is('form-action', ["'none'"]), 'base-uri and form-action are none')+ok(is('img-src', ["'self'", 'data:']), `img-src 'self' data: only (${csp.get('img-src')})`)+const allowed = new Set(['default-src', 'script-src', 'style-src', 'connect-src', 'img-src', 'base-uri', 'form-action'])+ok([...csp.keys()].every(k => allowed.has(k)), `no unexpected directives (${[...csp.keys()].join(', ')})`)+const wide = [...csp.values()].flat().filter(v => /^(\*|https?:|'unsafe-|blob:)/.test(v) || /^[a-z0-9.-]+\.[a-z]{2,}/i.test(v))+ok(wide.length === 0, `no host, wildcard, blob: or unsafe-* source anywhere (${wide.join(' ') || 'none'})`)++console.log('the hashes')+const scripts = [...html.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/g)]+ok(scripts.length === 1 && !/\bsrc=/.test(scripts[0][1]), `one inline script, no src (${scripts.length})`)+const js = scripts[0]?.[2] ?? ''+ok(is('script-src', [sha(js)]), 'script-src is exactly the hash of the inline script')+const styles = [...html.matchAll(/<style>([\s\S]*?)<\/style>/g)]+ok(styles.length === 1 && is('style-src', [sha(styles[0][1])]), 'one <style>, and style-src is exactly its hash')+ok(!/\sstyle="/.test(html), 'no inline style attributes (the hashed policy would drop them)')+ok(!/\son[a-z]+=/i.test(html.replace(js, '')), 'no inline event handlers')++console.log('what it loads')+const markup = html.replace(js, '')+const loads = [+ ...markup.matchAll(/<(?:img|iframe|embed|object|audio|video|source|track|frame)\b[^>]*>/gi),+ ...[...markup.matchAll(/<link\b[^>]*>/gi)].filter(m => !/rel="canonical"/.test(m[0]) && !/href="data:/.test(m[0])),+].map(m => m[0])+ok(loads.length === 0, `no fetched resource in the markup (${loads.join(' ') || 'none'})`)+const NAMESPACES = /^https?:\/\/(schemas\.openxmlformats\.org|schemas\.microsoft\.com|www\.w3\.org|purl\.org)\//+const urls = [...new Set(js.match(/https?:\/\/[^\s"'`)\\]+/g) ?? [])].filter(u => !NAMESPACES.test(u))+ok(urls.every(u => u === 'https://bento.page/releases/slides/manifest.json'),+ `the script's only absolute URL is the bento.page manifest (${urls.join(' ') || 'none'})`)+ok(!/\b(XMLHttpRequest|WebSocket|EventSource|sendBeacon|RTCPeerConnection)\b/.test(js), 'no second network API in the bundle')+ok(/nothing is uploaded|never leaves/i.test(markup), 'the page says so in words')++fs.rmSync(tmp, { recursive: true, force: true })+console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)diff --git a/scripts/test-convert/inherit.ts b/scripts/test-convert/inherit.tsindex 02a2042c..b4806fc9 100644--- a/scripts/test-convert/inherit.ts+++ b/scripts/test-convert/inherit.ts@@ -20,13 +20,13 @@// • sz is centipoints; lIns="0" is an explicit zero, not an absence.// • a frame absent everywhere is zero + a report entry, never invented.-import { parseXml, kid, kids, descendants, attr, NS } from '../../kernel/src/convert/xml.ts'-import type { XElem } from '../../kernel/src/convert/xml.ts'-import { Report } from '../../kernel/src/convert/report.ts'-import type { ThemeCtx, InheritCtx } from '../../kernel/src/convert/types.ts'+import { parseXml, kid, kids, descendants, attr, NS } from '../../convert/src/xml.ts'+import type { XElem } from '../../convert/src/xml.ts'+import { Report } from '../../convert/src/report.ts'+import type { ThemeCtx, InheritCtx } from '../../convert/src/types.ts'import {placeholderChain, labeledChain, effectivePhType, resolveFrame, textDefaults, bodyInsets,-} from '../../kernel/src/convert/inherit.ts'+} from '../../convert/src/inherit.ts'let failures = 0let checks = 0diff --git a/scripts/test-convert/load.ts b/scripts/test-convert/load.tsindex 2a059a87..a7d995c3 100644--- a/scripts/test-convert/load.ts+++ b/scripts/test-convert/load.ts@@ -41,7 +41,7 @@ if (!process.env.BENTO_CONVERT_LOAD_BUNDLED) {process.exit(r.status ?? 1)}-const { convertPptx } = await import('../../kernel/src/convert/pptx.ts')+const { convertPptx } = await import('../../convert/src/pptx.ts')const { allFixtures } = await import('./_fixtures.ts')const { parseDoc } = await import('../../slides/src/model.ts')const { validateDoc } = await import('../../slides/src/validate.ts')diff --git a/scripts/test-convert/media.ts b/scripts/test-convert/media.tsindex 70a4ff0d..bd66a26b 100644--- a/scripts/test-convert/media.ts+++ b/scripts/test-convert/media.ts@@ -22,12 +22,12 @@// undefined with the right code, not as a missing-part fetch attempt.import { Buffer } from 'node:buffer'-import { parseXml } from '../../kernel/src/convert/xml.ts'-import { Report } from '../../kernel/src/convert/report.ts'-import type { InheritCtx } from '../../kernel/src/convert/types.ts'+import { parseXml } from '../../convert/src/xml.ts'+import { Report } from '../../convert/src/report.ts'+import type { InheritCtx } from '../../convert/src/types.ts'import {parseRels, parseContentTypes, mimeFor, toBase64, AssetStore, imageFrom, _internals,-} from '../../kernel/src/convert/media.ts'+} from '../../convert/src/media.ts'let failures = 0let checks = 0diff --git a/scripts/test-convert/pptx.ts b/scripts/test-convert/pptx.tsindex adfc4e19..43a4aa53 100644--- a/scripts/test-convert/pptx.ts+++ b/scripts/test-convert/pptx.ts@@ -30,9 +30,9 @@// end on the SAME connector survives.import { Buffer } from 'node:buffer'-import { convertPptx } from '../../kernel/src/convert/pptx.ts'-import type { ConvertResult } from '../../kernel/src/convert/types.ts'-import type { OutShape, OutText, OutImage } from '../../kernel/src/convert/types.ts'+import { convertPptx } from '../../convert/src/pptx.ts'+import type { ConvertResult } from '../../convert/src/types.ts'+import type { OutShape, OutText, OutImage } from '../../convert/src/types.ts'import {fxMinimal, fxThemed, fxPlaceholder, fxGroup, fxBullets, fxSvg, fxConnectors, fxStructure,SVG_BYTES,diff --git a/scripts/test-convert/shapes.ts b/scripts/test-convert/shapes.tsindex d9ddaedd..eb0f0b98 100644--- a/scripts/test-convert/shapes.ts+++ b/scripts/test-convert/shapes.ts@@ -19,13 +19,13 @@// directly, skipping the inner group's own scaling) is computed and// asserted to differ from the composed one.-import { parseXml } from '../../kernel/src/convert/xml.ts'-import type { XElem } from '../../kernel/src/convert/xml.ts'-import { parseTheme } from '../../kernel/src/convert/theme.ts'-import { Report } from '../../kernel/src/convert/report.ts'-import type { InheritCtx, ThemeCtx } from '../../kernel/src/convert/types.ts'-import { shapeFrom, groupChildren } from '../../kernel/src/convert/shapes.ts'-import type { ShapeDeps } from '../../kernel/src/convert/shapes.ts'+import { parseXml } from '../../convert/src/xml.ts'+import type { XElem } from '../../convert/src/xml.ts'+import { parseTheme } from '../../convert/src/theme.ts'+import { Report } from '../../convert/src/report.ts'+import type { InheritCtx, ThemeCtx } from '../../convert/src/types.ts'+import { shapeFrom, groupChildren } from '../../convert/src/shapes.ts'+import type { ShapeDeps } from '../../convert/src/shapes.ts'let failures = 0let checks = 0diff --git a/scripts/test-convert/text.ts b/scripts/test-convert/text.tsindex 8e1f804d..cf83a20a 100644--- a/scripts/test-convert/text.ts+++ b/scripts/test-convert/text.ts@@ -20,15 +20,15 @@// • a literal '<' in a:t must come out as < — the raw-emit answer would// open a tag (seen to fail with esc() bypassed: html gained '<script').-import { parseXml, kid, kids, attr, NS } from '../../kernel/src/convert/xml.ts'-import type { XElem } from '../../kernel/src/convert/xml.ts'-import { Report } from '../../kernel/src/convert/report.ts'-import type { ThemeCtx, InheritCtx } from '../../kernel/src/convert/types.ts'+import { parseXml, kid, kids, attr, NS } from '../../convert/src/xml.ts'+import type { XElem } from '../../convert/src/xml.ts'+import { Report } from '../../convert/src/report.ts'+import type { ThemeCtx, InheritCtx } from '../../convert/src/types.ts'import {effectivePhType, textDefaults, resolveFrame, labeledChain,-} from '../../kernel/src/convert/inherit.ts'-import { resolveColor } from '../../kernel/src/convert/theme.ts'-import { textFrom, type TextDeps } from '../../kernel/src/convert/text.ts'+} from '../../convert/src/inherit.ts'+import { resolveColor } from '../../convert/src/theme.ts'+import { textFrom, type TextDeps } from '../../convert/src/text.ts'let failures = 0let checks = 0diff --git a/scripts/test-convert/theme.ts b/scripts/test-convert/theme.tsindex 4a59eef6..b50ead90 100644--- a/scripts/test-convert/theme.ts+++ b/scripts/test-convert/theme.ts@@ -14,8 +14,8 @@// produce a DIFFERENT bg1 than the standard one (the backwards-clrMap failure,// made visible instead of silent).-import { parseXml } from '../../kernel/src/convert/xml.ts'-import { parseTheme, resolveColor, resolveFillRef, resolveLnRef } from '../../kernel/src/convert/theme.ts'+import { parseXml } from '../../convert/src/xml.ts'+import { parseTheme, resolveColor, resolveFillRef, resolveLnRef } from '../../convert/src/theme.ts'let failures = 0let checks = 0diff --git a/site-src/import.html b/site-src/import.htmlnew file mode 100644index 00000000..86c0d554--- /dev/null+++ b/site-src/import.html@@ -0,0 +1,98 @@+<!DOCTYPE html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<!--IMPORT_CSP-->+<title>Open a PowerPoint deck in bento/slides — bento.page</title>+<meta name="description" content="Turn a .pptx into a bento/slides deck: one self-contained HTML file you can edit and present in any browser. Converted on your device — nothing is uploaded.">+<link rel="canonical" href="https://bento.page/import">+<meta name="theme-color" content="#0D1B2E">+<meta property="og:type" content="website">+<meta property="og:site_name" content="bento">+<meta property="og:url" content="https://bento.page/import">+<meta property="og:title" content="Open a PowerPoint deck in bento/slides">+<meta property="og:description" content="Converted on your device — nothing is uploaded.">+<meta property="og:image" content="https://bento.page/og.png">+<meta name="twitter:card" content="summary_large_image">+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2316273E'/%3E%3Crect x='5' y='5' width='7' height='22' rx='2.5' fill='%235E7699'/%3E%3Crect x='14' y='5' width='13' height='10' rx='2.5' fill='%23FF9E8A'/%3E%3Crect x='14' y='17' width='13' height='10' rx='2.5' fill='%23F0EBE0'/%3E%3C/svg%3E">+<style>+:root{+ --ink:#0D1B2E; --panel:#16273E; --panel2:#1B2F49; --line:rgba(182,193,210,.16);+ --text:rgba(196,206,221,.92); --dim:rgba(182,193,210,.62); --white:#F4F6F9;+ --peach:#FF9E8A; --peach2:#ED8266; --steel:#5E7699; --bone:#F0EBE0; --bad:#FF8A8A;+ --in:'Instrument Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;+ --fr:Fraunces,Georgia,'Times New Roman',serif;+}+*{margin:0;padding:0;box-sizing:border-box}+body{background:var(--ink);color:var(--text);font-family:var(--in);line-height:1.6;-webkit-font-smoothing:antialiased}+a{color:var(--peach)}+.wrap{max-width:760px;margin:0 auto;padding:0 20px}+header{border-bottom:1px solid var(--line)}+.bar{display:flex;align-items:center;gap:16px;height:60px}+.mark{display:flex;align-items:center;gap:11px;text-decoration:none;color:var(--white);font-weight:800;font-size:19.5px}+.mark .sub{color:var(--dim);font-weight:500}+.spacer{flex:1}+.nav{color:var(--dim);text-decoration:none;font-weight:600;font-size:14px}+h1{font-family:var(--fr);color:var(--white);font-size:clamp(28px,5vw,40px);line-height:1.15;margin:48px 0 12px}+.lede{font-size:17px;margin-bottom:24px}+.private{display:flex;gap:12px;align-items:flex-start;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:14px 16px;margin-bottom:28px;font-size:14.5px}+.private strong{color:var(--white)}+#drop{display:block;border:2px dashed var(--line);border-radius:16px;padding:44px 20px;text-align:center;cursor:pointer;transition:border-color .15s,background .15s}+#drop.over,#drop:hover{border-color:var(--peach);background:rgba(255,158,138,.05)}+#drop strong{display:block;color:var(--white);font-size:18px;margin-bottom:6px}+#drop input{position:absolute;width:1px;height:1px;opacity:0}+.hint{color:var(--dim);font-size:13.5px}+#status{margin:22px 0;padding:12px 16px;border-radius:10px;background:var(--panel)}+#status[data-kind=error]{color:var(--bad);border:1px solid rgba(255,138,138,.35)}+#result{margin:24px 0;padding:20px;border:1px solid var(--line);border-radius:14px;background:var(--panel)}+#result h2{color:var(--white);font-size:19px;margin-bottom:4px;word-break:break-all}+.meta{color:var(--dim);font-size:13.5px;margin:6px 0}+.report{list-style:none;margin:12px 0 18px}+.report li{padding:8px 0;border-top:1px solid var(--line);font-size:14.5px}+.tag{display:inline-block;font-size:11.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;padding:2px 7px;border-radius:5px;margin-right:6px;background:var(--panel2);color:var(--bone)}+.dropped .tag{color:var(--bad)}+.n{color:var(--dim)}+.btn{display:inline-block;background:var(--peach);color:var(--ink);font-weight:800;text-decoration:none;padding:12px 20px;border-radius:10px;margin:6px 0 4px}+.btn:hover{background:var(--peach2)}+footer{border-top:1px solid var(--line);margin-top:56px;padding:22px 0;color:var(--dim);font-size:13px}+</style>+</head>+<body>+<header>+ <div class="wrap bar">+ <a class="mark" href="/">+ <svg width="30" height="30" viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="7" fill="#16273E"/><rect x="5" y="5" width="7" height="22" rx="2.5" fill="#5E7699"/><rect x="14" y="5" width="13" height="10" rx="2.5" fill="#FF9E8A"/><rect x="14" y="17" width="13" height="10" rx="2.5" fill="#F0EBE0"/></svg>+ bento<span class="sub">/import</span>+ </a>+ <div class="spacer"></div>+ <a class="nav" href="/slides/">Open the editor</a>+ </div>+</header>++<main class="wrap">+ <h1>Open a PowerPoint deck in bento/slides</h1>+ <p class="lede">Turn a .pptx into a bento/slides deck: one HTML file that edits and presents itself in any browser, with nothing to install.</p>++ <p class="private"><span aria-hidden="true">🔒</span><span><strong>Your file never leaves this device.</strong>+ Conversion runs entirely in this browser tab. Nothing is uploaded, and this page runs no analytics.+ The only things it downloads are the latest bento/slides app and its signed release record, so that the app it puts your deck into is verified as genuine.</span></p>++ <label id="drop">+ <strong>Drop a .pptx here, or choose one</strong>+ <span class="hint">PowerPoint presentations up to <span id="limit">100 MB</span></span>+ <input id="file" type="file" accept=".pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation">+ </label>++ <div id="status" role="status" aria-live="polite" hidden></div>+ <section id="result" aria-live="polite" hidden></section>++ <p class="hint">What comes across: text, shapes, colours, pictures, where everything sits on each slide, and your speaker notes.+ What doesn't yet: tables and charts are marked with a placeholder box, and animations are not carried.+ The list after converting says exactly what changed in your deck.</p>+</main>++<footer><div class="wrap">bento — self-contained office documents · <a href="/help">Help</a> · <a href="https://github.com/nyblnet/bento">Source</a></div></footer>+<!--IMPORT_SCRIPT-->+</body>+</html>diff --git a/site-src/sitemap.xml b/site-src/sitemap.xmlindex 0ea382d4..95062401 100644--- a/site-src/sitemap.xml+++ b/site-src/sitemap.xml@@ -1,6 +1,7 @@<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.w3.org/2000/sitemap/0.9"><url><loc>https://bento.page/</loc><changefreq>weekly</changefreq><priority>1.0</priority></url>+ <url><loc>https://bento.page/import</loc><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://bento.page/help</loc><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://bento.page/agents.md</loc><changefreq>monthly</changefreq><priority>0.6</priority></url><url><loc>https://bento.page/guestbook/</loc><changefreq>daily</changefreq><priority>0.5</priority></url>