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(security): restore federation gate checks

Rahman52263c9ddbb3
diff --git a/.gitleaksignore b/.gitleaksignore
index ac175d7b..60c671ed 100644
--- a/.gitleaksignore
+++ b/.gitleaksignore
@@ -24,3 +24,9 @@ db292708a0ce5554a1a265091a65fb6a19636538:lib/infra/portable/ui.ts:generic-api-ke
# all provider calls mocked/in-memory. Exact historical fingerprints, not path/rule suppression.
2c0723d5df847fa3e4f4e0a2b966cfae052e7c71:lib/infra/sc-sync.test.ts:generic-api-key:4
2c0723d5df847fa3e4f4e0a2b966cfae052e7c71:lib/infra/sc-sync.test.ts:generic-api-key:15
+
+# Reviewed channel-schema test fixtures: Discord snowflake-shaped IDs are synthetic routing targets,
+# not credentials. Exact historical fingerprints only; no path/rule suppression.
+d73f8a16ef1f1971350c0c1f9b1f7885358b650a:lib/channels/schema.test.ts:discord-client-id:18
+837aff008dac31e97ceec583ce12e658dbe3f2e4:lib/channels/schema.test.ts:discord-client-id:18
+29d881c9e2f123fcc30f1136f43f79ac8a305f0d:lib/channels/schema.test.ts:discord-client-id:18
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index ecde28be..8a03d135 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `security` restore federation gate checks
- `termux` pin guest bootstrap and align platform contracts
- `ci` keep PAT scope case parseable by strict Semgrep
diff --git a/lib/federation/si-coder-runtime.test.ts b/lib/federation/si-coder-runtime.test.ts
index 4865affc..b9e63ada 100644
--- a/lib/federation/si-coder-runtime.test.ts
+++ b/lib/federation/si-coder-runtime.test.ts
@@ -1,4 +1,45 @@
-import { describe, expect, it } from "vitest";
+import { describe, expect, it, vi } from "vitest";
+
+const runtimeFixture = vi.hoisted(() => {
+ const required = [
+ "sc.product.interview",
+ "sc.user.connection.manage",
+ "sc.doku.mcp.call",
+ "sc.flow.run",
+ ];
+ const filler = Array.from({ length: 52 }, (_, index) => `sc.fixture.${index + 1}`);
+ return {
+ tools: [...required, ...filler].map((name) => ({ name, description: "synthetic reviewed function", inputSchema: { type: "object" } })),
+ };
+});
+
+vi.mock("@/lib/host/sc-installation.mjs", () => ({
+ inspectScInstallation: vi.fn(async () => ({
+ name: "si-coder-agent",
+ version: "0.9.8",
+ root: "/synthetic/si-coder",
+ bin: "/synthetic/si-coder/sc",
+ mcpEntrypoint: "/synthetic/si-coder/scripts/sc-mcp.js",
+ })),
+}));
+vi.mock("@/lib/host/sc-managed", () => ({
+ resolveManagedSc: vi.fn(async (server) => ({
+ name: server.name,
+ transport: "stdio",
+ command: process.execPath,
+ args: ["/synthetic/si-coder/scripts/sc-mcp.js"],
+ cwd: server.cwd,
+ env: {},
+ headers: {},
+ oauthConfigured: false,
+ consumer: "mso",
+ })),
+}));
+vi.mock("@/lib/host/project-mcp-client", () => ({
+ listMcpServerTools: vi.fn(async () => runtimeFixture.tools),
+ callMcpServerTool: vi.fn(),
+}));
+
import { inspectSiCoderFederationRuntime, siCoderFederationScope } from "./si-coder-runtime";
describe("SI-Coder federation runtime", () => {
@@ -9,9 +50,10 @@ describe("SI-Coder federation runtime", () => {
expect(siCoderFederationScope("sc.flow.run")).toBe("exec");
});
- it("discovers the reviewed installed runtime instead of a shell-provided function list", async () => {
+ it("discovers reviewed runtime metadata without depending on a host installation", async () => {
const runtime = await inspectSiCoderFederationRuntime(process.cwd());
- expect(runtime.version).toMatch(/^0\./);
+ expect(runtime.version).toBe("0.9.8");
+ expect(runtime.functionCount).toBe(runtimeFixture.tools.length);
expect(runtime.functionCount).toBeGreaterThanOrEqual(55);
expect(runtime.tools.map((tool) => tool.name)).toEqual(expect.arrayContaining([
"sc.product.interview",
diff --git a/lib/mcp/federation/batonly-worker.test.ts b/lib/mcp/federation/batonly-worker.test.ts
index 737bd1d4..a3036bf0 100644
--- a/lib/mcp/federation/batonly-worker.test.ts
+++ b/lib/mcp/federation/batonly-worker.test.ts
@@ -1,5 +1,17 @@
import { describe, expect, it, vi } from "vitest";
+
vi.mock("server-only", () => ({}));
+vi.mock("@/lib/federation/si-coder-runtime", () => ({
+ inspectSiCoderFederationRuntime: vi.fn(async () => ({
+ version: "0.9.8",
+ functionCount: 56,
+ tools: [],
+ })),
+ executeSiCoderFederation: vi.fn(async () => {
+ throw new Error("SI-Coder execution is outside this Batonly protocol test");
+ }),
+}));
+
import {
executeMsoFederation,
runBatonlyFederationPoll,
diff --git a/scripts/cli/commands.sh b/scripts/cli/commands.sh
index 97df9097..cf6a85e3 100755
--- a/scripts/cli/commands.sh
+++ b/scripts/cli/commands.sh
@@ -46,7 +46,8 @@ U_org="org flow-custom-nodes|flow-nodes-move|flow-update|flow-replace|flow-node-
U_a2a="a2a list|state|sessions|spawn <source-session> <objective> [title]|inbox <session>|discover <url>|add <url> [alias]|rm <target>|send <target> <message> [--wait]|stream <target> <message>|task <target> <taskId> [history]|cancel <target> <taskId>|handoff <target> <objective> [context] [--wait]|local sessions|local handoff <session> <objective>|local spawn <sourceSession> <objective> [title]|local inbox <session>|auth list [target]|auth add <target> [label] [bearer|api-key|oauth2]|auth use <target> <credentialId|none>|auth rm <credentialId>|inbound list|inbound create [label] [read|write|exec]|inbound rm <tokenId>"
U_memory="memory list|add <text>|rm <id>"
U_config="config show|set <json>|key <provider>|style <off|caveman|ponytail>|rm <provider>"
-U_prefs="prefs show|set <json>"\nU_federation="federation status"
+U_prefs="prefs show|set <json>"
+U_federation="federation status"
U_models="models [status|list|add|auth <provider>|rm <provider>|catalog [provider]|test]"
U_skills="skills list|read <id>|search <query…>|available|info <id>|install <id…> [-y] [--force]|remove <id…> [-y]|store list|store install|remove <id> <revision>"
U_mcp="mcp project <JSON>|list|pat <label> [read|write|exec] [ttlDays]|activity [n]|service-token --label <label> --client-id <id> --scope <read|write|exec> --tools <name,name> [--constraints-json <json>]|revoke <id>|revoke all"