[PR #4006] [MERGED] Give Browser Personal Extensions a constrained window UI #6197

Closed
opened 2026-10-23 04:08:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4006
Author: @SpicyMarinara
Created: 7/23/2026
Status: ✅ Merged
Merged: 7/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feature/extension-ui-window


📝 Commits (1)

  • 6d72b6a Add a constrained window UI capability to Browser Personal Extensions

📊 Changes

6 files changed (+316 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+1 -1)
📝 docs/development/personal-extensions.md (+4 -1)
📝 docs/extending/personal-extensions.md (+1 -1)
📝 packages/client/src/components/layout/PersonalExtensionInjector.tsx (+33 -1)
📝 packages/server/src/routes/personal-extensions.routes.ts (+236 -3)
📝 scripts/regressions/extension-security.regression.ts (+41 -0)

📄 Description

Linked issue

No pre-existing issue — this addresses a maintainer report that Professor Mari refuses reasonable browser-extension requests (e.g. "a small extension that opens a closable window showing an ASCII bunny", or extensions that add buttons/tools). One should be opened to track it if desired.

Why this change

The extension hardening in #4000 moved Browser Extensions into a Worker inside a hidden, opaque-origin iframe whose only capabilities are storage, logging, timers, and cleanup — no way to render anything on screen. That was correct for safety but left browser extensions unable to show UI at all, so Professor Mari (accurately) refuses to build display or interactive extensions and won't write placebo code that can't escape containment.

This adds a narrow, host-rendered UI surface so extensions can present windows, buttons, and simple input tools — while keeping every sandbox guarantee from #4000.

What changed

  • Worker API: marinara.ui.showWindow({ title, elements, onEvent, onClose }) returns a handle with update({ title?, elements? }) and close(). elements is a fixed whitelist — heading, text, pre, button, input, spacer — with plain-string fields; button/input require an id. A button click delivers { windowId, elementId, values } to onEvent, where values maps each input id to its current string value.
  • Rendering (trusted bootstrap): descriptors are rendered with textContent only (never parsed markup) inside the existing opaque-origin, allow-scripts, connect-src 'none' iframe. The extension code runs in the Worker and still has no DOM, network, host-window, or Marinara access.
  • Host injector: reveals the otherwise-hidden sandbox iframe as a centered overlay only while a window is open, hides it on close. The backdrop and an in-card close button both dismiss and notify the worker.
  • Limits: window count (4), elements per window (60), and text length (8000) are capped; window messages count toward the existing message rate limit; a busy/broken window is still caught by the heartbeat watchdog.
  • Docs: updated the user-facing capability description (the exact sentence Professor Mari reads when scoping a browser extension) and the developer API/runtime reference.

Security posture (unchanged from #4000)

The extension never receives DOM, HTML injection, network, or host access. It can only describe a window in a constrained vocabulary that the trusted host renders as text. Making the sandbox iframe visible grants no new powers — it is still opaque-origin with the same strict CSP.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated: pnpm check and pnpm regression:extensions-security (including the real macOS Seatbelt server-sandbox proof) pass. The regression now also asserts the generated worker exposes marinara.ui, never touches the DOM, and that the bootstrap renders via textContent, never assigns markup, and reveals the iframe only through the ui-window-open signal.

Manual verification notes

  • Ask Professor Mari for "a small personal browser extension that opens a closable window showing an ASCII bunny", approve the exact hash in Settings > Addons, and confirm the window opens, renders the bunny, and closes via the ✕ and the backdrop.
  • Build one with a button + input (e.g. reverse the text) and confirm the button reports the input value and the window updates.
  • Confirm dark/light and mobile viewport; confirm disabling the extension removes the window; confirm the external gate still applies to non-Professor-Mari extensions.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

docs/extending/personal-extensions.md, docs/development/personal-extensions.md, and CHANGELOG.md updated; no version bump.

UI evidence

New capability renders inside the sandbox iframe overlay; screenshots to be added during manual verification.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4006 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 7/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feature/extension-ui-window` --- ### 📝 Commits (1) - [`6d72b6a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6d72b6ad917886211d4cac66747c7b7d82b7f15a) Add a constrained window UI capability to Browser Personal Extensions ### 📊 Changes **6 files changed** (+316 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -1) 📝 `docs/development/personal-extensions.md` (+4 -1) 📝 `docs/extending/personal-extensions.md` (+1 -1) 📝 `packages/client/src/components/layout/PersonalExtensionInjector.tsx` (+33 -1) 📝 `packages/server/src/routes/personal-extensions.routes.ts` (+236 -3) 📝 `scripts/regressions/extension-security.regression.ts` (+41 -0) </details> ### 📄 Description ## Linked issue No pre-existing issue — this addresses a maintainer report that Professor Mari refuses reasonable browser-extension requests (e.g. "a small extension that opens a closable window showing an ASCII bunny", or extensions that add buttons/tools). One should be opened to track it if desired. ## Why this change The extension hardening in #4000 moved Browser Extensions into a Worker inside a hidden, opaque-origin iframe whose only capabilities are storage, logging, timers, and cleanup — **no way to render anything on screen**. That was correct for safety but left browser extensions unable to show UI at all, so Professor Mari (accurately) refuses to build display or interactive extensions and won't write placebo code that can't escape containment. This adds a narrow, host-rendered UI surface so extensions can present windows, buttons, and simple input tools — while keeping every sandbox guarantee from #4000. ## What changed - **Worker API:** `marinara.ui.showWindow({ title, elements, onEvent, onClose })` returns a handle with `update({ title?, elements? })` and `close()`. `elements` is a fixed whitelist — `heading`, `text`, `pre`, `button`, `input`, `spacer` — with plain-string fields; `button`/`input` require an `id`. A button click delivers `{ windowId, elementId, values }` to `onEvent`, where `values` maps each input `id` to its current string value. - **Rendering (trusted bootstrap):** descriptors are rendered with `textContent` only (never parsed markup) inside the existing opaque-origin, `allow-scripts`, `connect-src 'none'` iframe. The extension code runs in the Worker and still has no DOM, network, host-window, or Marinara access. - **Host injector:** reveals the otherwise-hidden sandbox iframe as a centered overlay only while a window is open, hides it on close. The backdrop and an in-card close button both dismiss and notify the worker. - **Limits:** window count (4), elements per window (60), and text length (8000) are capped; window messages count toward the existing message rate limit; a busy/broken window is still caught by the heartbeat watchdog. - **Docs:** updated the user-facing capability description (the exact sentence Professor Mari reads when scoping a browser extension) and the developer API/runtime reference. ### Security posture (unchanged from #4000) The extension never receives DOM, HTML injection, network, or host access. It can only *describe* a window in a constrained vocabulary that the trusted host renders as text. Making the sandbox iframe visible grants no new powers — it is still opaque-origin with the same strict CSP. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated: `pnpm check` and `pnpm regression:extensions-security` (including the real macOS Seatbelt server-sandbox proof) pass. The regression now also asserts the generated worker exposes `marinara.ui`, never touches the DOM, and that the bootstrap renders via `textContent`, never assigns markup, and reveals the iframe only through the `ui-window-open` signal. ### Manual verification notes - Ask Professor Mari for "a small personal browser extension that opens a closable window showing an ASCII bunny", approve the exact hash in **Settings > Addons**, and confirm the window opens, renders the bunny, and closes via the ✕ and the backdrop. - Build one with a button + input (e.g. reverse the text) and confirm the button reports the input value and the window updates. - Confirm dark/light and mobile viewport; confirm disabling the extension removes the window; confirm the external gate still applies to non-Professor-Mari extensions. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) `docs/extending/personal-extensions.md`, `docs/development/personal-extensions.md`, and `CHANGELOG.md` updated; no version bump. ## UI evidence New capability renders inside the sandbox iframe overlay; screenshots to be added during manual verification. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:04 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6197
No description provided.