Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(workflows): preserve explicit empty sandbox

Rahman4cf54c94c53a
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index cc6c1be2..c2125d62 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `workflows` preserve explicit empty sandbox
- `auth` bind sessions to cookie scope
- `workflows` remount editors when sandbox policy changes
- `workflows` retain approved shared surface placements
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 6806a983..4c713d6b 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,11 @@
+## 2026-09-18 — Preserve the strictest reviewed external-editor sandbox
+
+PR review found that an explicit empty iframe sandbox was normalized as if the owner had
+omitted the field, causing the runtime default to add scripts, same-origin and forms.
+The surface registry now distinguishes omitted sandbox policy from an explicitly empty
+policy. Empty remains a valid, strict sandbox; non-empty values still use the same
+allowlist and byte bound. No permission token is added or broadened.
+
## 2026-09-18 — Bind signed sessions to their cookie policy
The external-editor security review found a migration edge case: after a broad Domain cookie
diff --git a/lib/host/workflow-embeds-api.test.ts b/lib/host/workflow-embeds-api.test.ts
index 2de08d3d..88eb1ad3 100644
--- a/lib/host/workflow-embeds-api.test.ts
+++ b/lib/host/workflow-embeds-api.test.ts
@@ -29,6 +29,11 @@ describe("reviewed Workflows embed registry", () => {
it.each([{ origin: "http://automation.example.test" }, { startPath: "//evil.example.test" }, { sandbox: "allow-top-navigation" }])("rejects unsafe destination or frame permission %j", async (change) => {
expect(await configuredSurfaceApps(JSON.stringify([{ ...app, placements: ["workflows"], ...change }]))).toEqual([]);
});
+ it("preserves an explicitly empty iframe sandbox as the strictest reviewed policy", async () => {
+ const apps = await configuredSurfaceApps(JSON.stringify([{ ...app, placements: ["workflows"], sandbox: "" }]));
+ expect(apps[0]).toHaveProperty("sandbox", "");
+ expect(workflowEmbeds(apps, [])[0].sandbox).toBe("");
+ });
it("keeps non-workflow apps and approved sandbox permissions unchanged", async () => {
const apps = await configuredSurfaceApps(JSON.stringify([app, { ...app, id: "reviewed", placements: ["workflows", "workflows"], sandbox: "allow-scripts allow-forms" }]));
expect(apps[0]).toEqual(app);
diff --git a/lib/surfaces/config.ts b/lib/surfaces/config.ts
index c601fa08..5d87f12c 100644
--- a/lib/surfaces/config.ts
+++ b/lib/surfaces/config.ts
@@ -66,7 +66,7 @@ function parseApp(entry: unknown, seen: Set<string>): SurfaceApp | null {
if (renderer !== "iframe" && renderer !== "remote") return null;
if (!PRESENTATIONS.has(presentation as SurfacePresentation) || !ENVIRONMENTS.has(environment as SurfaceEnvironment)) return null;
const sandbox = typeof row.sandbox === "string" ? row.sandbox.trim() : undefined;
- if (sandbox && (sandbox.length > 240 || !sandbox.split(/\s+/).every((token) => SAFE_SANDBOX.has(token)))) return null;
+ if (sandbox !== undefined && (sandbox.length > 240 || (sandbox.length > 0 && !sandbox.split(/\s+/).every((token) => SAFE_SANDBOX.has(token))))) return null;
const externalAuthPath = row.externalAuthPath === undefined ? undefined : safeAuthPath(row.externalAuthPath);
if (row.externalAuthPath !== undefined && !externalAuthPath) return null;
const project = boundedText(row.project, true);
@@ -78,7 +78,7 @@ function parseApp(entry: unknown, seen: Set<string>): SurfaceApp | null {
return {
id, title, description: boundedText(row.description) ?? "", origin, startPath, renderer,
presentation: presentation as SurfacePresentation, environment: environment as SurfaceEnvironment,
- ...(placements ? { placements } : {}), ...(project ? { project } : {}), ...(sandbox ? { sandbox } : {}), ...(externalAuthPath ? { externalAuthPath } : {}), ...(reason ? { reason } : {}),
+ ...(placements ? { placements } : {}), ...(project ? { project } : {}), ...(sandbox !== undefined ? { sandbox } : {}), ...(externalAuthPath ? { externalAuthPath } : {}), ...(reason ? { reason } : {}),
};
}