Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(app-actions): ask before remote commands, never offer the brain switch

rubenluetke10-beep1dc773f3b742
diff --git a/jarvis/app_actions/catalog.py b/jarvis/app_actions/catalog.py
index bca3e55f8c..e3eccab630 100644
--- a/jarvis/app_actions/catalog.py
+++ b/jarvis/app_actions/catalog.py
@@ -17,12 +17,13 @@ __all__ = [
_METHODS: Final[tuple[str, ...]] = ("get", "post", "put", "patch", "delete")
#: Never offered to the brain: credentials and sign-ins (voice must never carry
-#: a secret, AP-2), the raw control plane, webhooks, self-modification, and the
-#: action policy itself — Jarvis never edits its own permissions.
+#: a secret, AP-2), the raw control plane, webhooks, self-modification, the
+#: action policy itself — Jarvis never edits its own permissions — and the
+#: main-brain switch, which only the person may flip (the provider lock).
_EXCLUDED: Final[re.Pattern[str]] = re.compile(
r"(secret|api-?keys?|/keys?(/|$)|install-key|host-key|use-key|token|password|"
r"credential|oauth|/auth(/|$)|login|pairing|/callback|/hooks/|openapi|/ws$|"
- r"^/api/control/|^/api/self-mod|^/api/app-actions)",
+ r"^/api/control/|^/api/self-mod|^/api/app-actions|^/api/brain/switch$)",
re.IGNORECASE,
)
diff --git a/jarvis/ui/web/computers_routes.py b/jarvis/ui/web/computers_routes.py
index 5d8e7f69c7..9d5997c48c 100644
--- a/jarvis/ui/web/computers_routes.py
+++ b/jarvis/ui/web/computers_routes.py
@@ -358,7 +358,7 @@ async def check_computer(computer_id: str) -> dict[str, Any]:
raise _fail(exc) from exc
[email protected]("/{computer_id}/run")
[email protected]("/{computer_id}/run", openapi_extra={"x-jarvis-dangerous": True})
async def run_on_computer(computer_id: str, body: RunBody) -> dict[str, Any]:
try:
result = await get_service().run(computer_id, body.command, timeout_s=body.timeout_s)
@@ -406,7 +406,7 @@ async def trust_host_key(computer_id: str) -> dict[str, Any]:
raise _fail(exc) from exc
[email protected]("/{computer_id}/power")
[email protected]("/{computer_id}/power", openapi_extra={"x-jarvis-dangerous": True})
async def power_computer(computer_id: str, body: PowerBody) -> dict[str, Any]:
try:
return _row(await get_service().power(computer_id, body.action))
@@ -425,7 +425,7 @@ async def computer_readiness(computer_id: str) -> dict[str, Any]:
return {**readiness.to_dict(), "install": job.to_dict() if job else None}
[email protected]("/{computer_id}/install", status_code=202)
[email protected]("/{computer_id}/install", status_code=202, openapi_extra={"x-jarvis-dangerous": True})
async def install_tools(computer_id: str, body: InstallBody) -> dict[str, Any]:
try:
job = await toolbox.start_install(computer_id, list(body.items))
diff --git a/tests/unit/app_actions/test_app_actions.py b/tests/unit/app_actions/test_app_actions.py
index 5eaad91131..ccb510605c 100644
--- a/tests/unit/app_actions/test_app_actions.py
+++ b/tests/unit/app_actions/test_app_actions.py
@@ -79,6 +79,26 @@ def test_catalog_offers_actions_but_never_secrets_or_its_own_policy(app: FastAPI
assert not any(p.startswith("/api/app-actions") for p in paths)
+def test_remote_commands_ask_and_the_brain_switch_is_never_offered() -> None:
+ """A prompt-injected page must not reach a shell on the person's server or
+ flip the user-only main-brain switch through run-app-action."""
+ from jarvis.ui.web.computers_routes import router as computers_router
+
+ application = FastAPI()
+ application.include_router(computers_router)
+
+ @application.post("/api/brain/switch", tags=["providers"])
+ async def brain_switch() -> dict[str, Any]:
+ return {"ok": True}
+
+ catalog = build_catalog(application.openapi())
+ by_route = {(e.method, e.path): e for e in catalog.values()}
+ for path in ("run", "power", "install"):
+ entry = by_route[("POST", f"/api/computers/{{computer_id}}/{path}")]
+ assert default_tier(entry) == "ask", path
+ assert ("POST", "/api/brain/switch") not in by_route
+
+
def test_default_tiers_read_safe_change_monitor_delete_ask(app: FastAPI) -> None:
catalog = build_catalog(app.openapi())
tiers = {(e.method, e.path): default_tier(e) for e in catalog.values()}