Decisions: the app marketplace (the marketplace install (2026-10-06), 2026-10-06)
This page is generated from the project corpus and rewritten on every docs build. Edit the source in corpus/, not here.
Split out of decisions-estate-era.md, which has a
200-line cap. Same rule: changing an entry needs an explicit revisit and a
log.md entry.
Built from the 2026-07-22 grill. Three locked decisions are revisited, as the brief required, and the build added some calls of its own.
Revisits.
- "No runtime package manager (
manifest.tsis it)": reversed, narrowly. The in-repo catalog (marketplace/<id>.json) drives an installer that clones and builds external apps in the live container. Build-from-source still holds: each app is cloned at a pinned commit and built on the machine, with no registry and no prebuilt artifacts. What flips is the system monitor work's "installing an app means adding a build-time module".manifest.tsstays the one place built-in add-ons are composed. Marketplace apps join the sameAPP_REGISTRYat runtime, so they are enabled, disabled and launched the same way. - "No separate supervisor daemon": extended, fenced. Service apps' servers
are supervised by the backend (
MarketplaceServers): a port from 41000–41999 on 127.0.0.1, a 30 s health wait, restarts with a growing delay, and a stop after five crashes in two minutes. At most four run at once. A server runs while an open window holds a lease or a proxied socket is open, and stops otherwise. It supervises marketplace servers and nothing else; it is not an init. - Native (unsandboxed) code from outside the repo: allowed only for in-repo
descriptors pinned to a commit. That pin is what keeps such an app
first-party ("buggy, not malicious"), so it runs in the desktop's own page
at full speed. An app from an arbitrary URL must use
runtime: "sandboxed"(the brief-48 iframe transport), built by sandboxed apps from a URL (2026-10-07) (below). The two stances differ on purpose.
Calls the build made.
refmust be a full 40-character commit id. The brief's example used a tag, but a tag can be moved after review. The installer also checks thatHEADafter checkout is that commit.- Commands are argv arrays, not shell strings. The brief's example had
"npm ci". With no shell, a descriptor cannot chain or substitute commands. - Each build is its own directory,
apps/<id>@<buildId>, and the database row names the live one. No rename is involved, so tools that bake absolute paths keep working. A failed build leaves the previous one live. At boot, a directory no row names is deleted (an install interrupted by a restart). The build id is in the served URL, so the files are cached as immutable and an update can never mix old and new chunks. - Builds see an allowlisted environment (
PATH, locale, a privateHOME,TMPDIRand npm cache underapps/.cache), not the backend's minus a denylist. So noWARD_*setting, no database path, and no~/.npmrcor~/.gitconfigtoken reaches them. Git runs with hooks off, no system or global config, andGIT_ALLOW_PROTOCOLset to the descriptor's scheme. Each step is its own process group, killed whole at a 15-minute deadline; the log keeps the last 64 KB of output. - Only the entry's directory is served, and the entry must be inside one
(
dist/app.mjs). The app's top level holds its source andnode_modules. Every file is resolved throughrealpathand must stay inside that directory, so a symlink out of the build is a 404. Dotfiles are refused, and the directory may hold at most 256 MB. mount(container, system, host): a third argument. The brief's contract gave a service app no way to find its server.hostcarries the app id, the URL of its module's directory, and the server'shttpandwsURLs through the proxy. It is not part ofSystemHandle: it is the native host's business, not a protocol promise.- Capabilities are a fence, not a sandbox. A member of
systemthat the descriptor did not list throws an error naming it. The app's code still runs in the page and could callfetchitself; the catalog is the trust anchor, as above. - A service app's server is reached only through the desktop's port.
WebSockets go through
UpgradeRoutes, whichPtyGateway's single upgrade handler dispatches to. Its checks are the terminal's: session, grant and Origin, with a revocation sweep every 30 s. Plain HTTP isGET/HEADonly. The server never receives the desktop's cookie orAuthorization, and itsSet-Cookieand CSP headers are dropped.connect-src 'self'already covers the same-origin socket, so CSP gains nothing. - Installed builds are left out of backups (
./.imbatranim/apps). They are hundreds of MB and can be rebuilt from the catalog. After a restore, the pane shows "build missing" and offers Reinstall. - The catalog is root-owned in the image (
/app/marketplace), like the rest of its code: the app reads it and never writes it. - The dev container now reaches the API through Vite's proxy (
/api, same origin), the way the deploy does. A cross-origin module import carries no cookie, so a marketplace app could not load fromlocalhost:3001. - Residual risks, accepted.
- A build runs as the desktop's user, so its code, including every npm
dependency it installs, can read what that user can: the home volume and
the backend's
/proc/<pid>/environ, which holds the Ward app key in Ward mode. The pinned commit and its lockfile narrow this to code someone chose, but they do not review transitive dependencies. - A build has no disk, memory or network limit beyond its deadline. The image has no namespace sandbox (bubblewrap) to give it one.
HOST=127.0.0.1is advice to a server, not a rule. One that binds0.0.0.0is still unreachable from outside a container that publishes none of those ports, but on a host network it would be exposed.
- A build runs as the desktop's user, so its code, including every npm
dependency it installs, can read what that user can: the home volume and
the backend's
Sandboxed apps from a URL (2026-10-07): apps from a URL (2026-10-07)
Revisited 2026-11-06: URL apps run natively once verified or trusted (decisions-app-identity-and-trust.md). Retired 2026-11-09 (brief 82): version 1 is refused, and what follows is history.
The owner parked arbitrary-URL installs on 2026-10-06 and asked for them on 2026-10-07. An app from a URL nobody reviewed is treated as malicious, not just buggy. That flips os-layering's threat model for these apps only, and every call below follows from it.
- Prebuilt only. The repo carries the built module; the OS runs no install, build or server for it, so code from an unreviewed URL never runs on the machine. Rejected: building on install (the repo's scripts and every npm dependency would run as the desktop's user with the home volume readable, the residual risk the marketplace install (2026-10-06) accepted only because the catalog is reviewed); service apps, for the same reason.
- Same port, opaque origin. The app runs in
<iframe sandbox="allow-scripts allow-pointer-lock">, and every sandbox response also carries the CSPsandboxdirective, so the document is opaque even when opened in a tab. Rejected: a second port like the Browser's (2026-10-04). The Browser needsallow-same-originbecause real sites need their storage; these apps don't, and a port costs deploy configuration. - The frame's files sit behind a per-window token, not the cookie. An
opaque-origin frame gets no
SameSite=Laxcookie (verified in Chrome:imb_sessionwithheld, API 401, mutations 403 onOrigin: null). Somarketplace/sandbox/<token>/is@Public(), and the token, 32 random bytes minted by an authenticated call, is the authentication. It is revoked when the window closes, on uninstall or update, and after 6 hours unused; restarts drop them all. - The frame's CSP is the network fence:
default-src 'none'and'self'(plusblob:/data:) for what the app loads.'self'carries no credentials, as above. CSP doesn't cover two exits, so they are closed separately: WebRTC (a peer connection reached an outside STUN server from the frame, measured) is removed by the runtime before the app's code runs, and DNS prefetching is off (X-DNS-Prefetch-Control). - Capabilities:
notifyonly, without actions, rate-limited per window, plus the always-present window, appearance and events.fs,http,intents,shortcutsandscheduleare refused at install by name; each can be added later, one at a time, with its own consent text. imbatranim.jsonin the app's repo, and a derived id (x-plus 12 hex of the source's SHA-256). Catalog ids may not start withx-.- GitHub only (plus
file:under the test flag). The URL names a branch, tag or full commit, or the default branch; the resolved commit is pinned. A bare commit must be the tip of an advertised branch or tag: GitHub serves a fork's commits through the parent's URL, so any other commit could be an attacker's code shown under the genuine repo's name (and id).git ls-remoteruns in an empty folder underGIT_CEILING_DIRECTORIES, because git otherwise reads the config of a repository around its working directory (aninsteadOfthere rewrote the URL in a test). - Consent on every install and update: repo, commit, capabilities and a plain warning, before anything is kept.
- An app cannot hold the screen. While its window is in the background,
a transparent shield covers the frame: the first click only raises the
window, and nothing the frame says can.
focus/showwork only while its window is in front and its frame has the keyboard;setTitleandnotifyare rate-limited per window; a second close within 10 s of a refusal closes without asking; the window is at most 1600×1000 and can shrink to 800×600. Without these, a URL app could draw a fake lock screen that stays on top and won't close. - A page-wide keyboard guard, because Chrome lets a frame take the
keyboard. Measured in headless Chrome 150 (a headed Chrome and Firefox are
not walked): a background frame calling
focus()gets every key the owner types into Notepad, and the page learns only awindowblur, withactiveElementnaming the stale textarea.inert,display: noneand thefocus-without-user-activationpolicy don't stop it, and a plainfocus()on an element the page already names is a no-op. SokeyboardGuard.ts(one listener for the page) takes the keyboard back withblur(); focus()to where the owner was, on every page blur that leaves focus inside the page. Frames we serve (the sandbox runtime, the Browser's host page) reportframe-blurwhen their keyboard leaves them, which covers a theft from a frame in front, and a URL app's frame is blurred when another window comes up over it. An app that takes it twice within 10 s is stopped. Verified in Chrome: typing into Notepad and into another URL app while a hostile app grabs every 400 ms, every key landed where it was typed and the thief was stopped. Rejected: per-frame detection fromactiveElement(stale in the real browser, though it passes in jsdom). - Windows render in a stable DOM order. They used to be sorted by z-index, so raising one moved its DOM node, and a browser reloads an iframe whose node moves: a URL app (and the Browser's page) restarted on every raise. Each window stacks by its CSS z-index, so DOM order never mattered for what is on top.
- The clone is sized before it is written. After the fetch and before
checkout,
.gitand the tree (ls-tree -r -l, duplicates counted) must be under 512 MB and 20 000 entries; a tiny pack can otherwise expand to hundreds of MB on the home volume before consent. - Module workers run as classic workers that
import()the module. Chrome refuses a module worker whose script is a blob from an opaque origin; the runtime's shim holds messages until the module has run.
Residual risks, accepted.
- A frame can navigate itself; its own CSP cannot stop that. The desktop's
frame-srcdoes ('self', plus the Browser's proxy origin when it is on), which is why wideningframe-srcwould open an egress path. The proxy is not one: its relay wants a session and the proxy's own Origin, and a sandboxed frame has neither (and cannot register the proxy's service worker). So a navigation reaches only this machine's servers. - Chrome may run the frame in the desktop's process, so an app that spins forever can still freeze the tab.
- The fetch itself is bounded only by its 5-minute timeout;
.gitis measured after it. The owner is the one pasting the URL. - Firefox is not walked; Chrome is. Firefox's SameSite rules for an opaque frame may differ, and CORS plus the Origin check are the backstop there.
Suites and kit apps (2026-10-21): decisions-marketplace-suites.md.