mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4003] [Feature]: Windows server-extension sandbox (AppContainer) to match Seatbelt/Bubblewrap #2162
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SpicyMarinara on GitHub (Jul 23, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4003
Summary
Personal Extensions ship a server runtime that executes user/third-party JavaScript inside a real OS sandbox. Today only two backends exist — macOS Seatbelt and Linux Bubblewrap — so on Windows the server runtime fails closed: server extensions cannot be approved (HTTP 503) and cannot run. This issue scopes a genuine Windows sandbox backend so Windows users get the same capability at the same safety bar.
This is a follow-up to the extension-hardening work in #4000. Android is intentionally out of scope (unrooted Android cannot host a real process sandbox — Bubblewrap needs unprivileged user namespaces the kernel/SELinux block, and
prootprovides no isolation; Android users are served by the browser runtime, whose sandbox is the WebView).Why
The safety bar (non-negotiable)
A Windows backend must match what Seatbelt/Bubblewrap already guarantee. It ships only when it can demonstrably enforce all of:
If we cannot meet this bar, we keep Windows disabled. A weaker "sandbox" is worse than an honest "unavailable."
Proposed approach: AppContainer + restricted token + Job Object
This is the same primitive stack Chromium uses for its Windows renderer sandbox:
CreateAppContainerProfile) with an empty/minimal capability SID set, giving an isolated object namespace and default-deny access. No network capability SID ⇒ no outbound network.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, memory/active-process limits, and UI restrictions.--permissionas the inner layer — reuse the existing--permission --allow-fs-read/writeflags (already used by the Mac/Linux paths) as defense-in-depth under the OS boundary, not as the boundary itself.The existing file-based JSONL protocol (
runner.mjs, input/output/heartbeat/error files) is transport-only and can stay unchanged; only the spawn + confinement layer is new.Implementation options (needs a decision)
There is no CLI equivalent to
sandbox-exec/bwrapon Windows, so we need one of:.exe— a small C++/Rust launcher that sets up the AppContainer profile, token, ACLs, and Job Object, thenCreateProcessAsUser-es Node. Marinara spawns the helper. Pro: keeps Win32 complexity out of Node, easy to unit-test in isolation, no addon build in the main install. Con: a shipped binary to build/sign/maintain per arch.CreateProcessshim — likely insufficient; PowerShell can't cleanly build an AppContainer lowbox token + job in one shot without native calls. Probably a dead end; noted for completeness.Recommendation: (A) shipped helper exe. It isolates the security-critical code, is independently testable, and avoids per-install native builds. Decide before implementation.
Integration points
packages/server/src/services/extensions/personal-extension-sandbox.tsPersonalExtensionSandboxBackendwith"windows-appcontainer".win32branch togetPersonalExtensionSandboxStatus()that probes for the helper/addon and required OS support (AppContainer available, correct Windows edition/version), returning a clearreasonwhen unmet.spawnSandboxedPersonalExtension().packages/shared/src/types/personal-extension.ts— add"windows-appcontainer"toPersonalExtensionSandboxBackendandserverSandboxBackend.personal-server-extension-runtime.tsgating,runner.mjs, or the routes — they already key offserverSandboxAvailable/serverSandboxBackendgenerically.Proof harness (required, mirrors the existing ones)
Extend
scripts/regressions/extension-security.regression.tswith a Windows-only proof that, when run on Windows, asserts a sandboxed extension cannot: open a TCP connection, read a file outside the sandbox dir (e.g. the user profile), spawn a child process, or load a native addon — and can do its permitted protocol I/O. Gate it onprocess.platform === "win32"so other platforms skip. Wire it into Windows CI; the macOS/Linux proofs stay as-is.Out of scope
--permission-only Windows path and calling it equivalently safe — it has no network deny and no OS privilege drop, so it does not meet the bar above.Acceptance criteria
windows-appcontainerbackend that enforces the full safety bar, with fail-closed behavior when unmet.getPersonalExtensionSandboxStatus()reports it on supported Windows and a clear reason otherwise.@SpicyMarinara commented on GitHub (Jul 23, 2026):
Closing as not planned for now — recording the decision so it stays discoverable and re-openable if real demand appears.
Rationale:
--permission-only path is below the safety bar), so it's all-or-nothing.Instead, the fail-closed behavior stays as the correct safe state, and the docs now state plainly that server extensions require macOS or Linux (with Bubblewrap) and that Windows/Android users should use browser extensions. Re-open if server extensions grow into a capability where the Windows gap becomes a real product cost.