security: refine workspace trust controls

This commit is contained in:
Rohit P
2026-07-24 18:44:39 -07:00
parent 8ee0a0d082
commit 3f5ac872ca
11 changed files with 427 additions and 9 deletions
+14
View File
@@ -523,6 +523,17 @@ def create_app(manager: SessionManager) -> FastAPI:
body.get("path", ""), create=bool(body.get("create"))
)
@app.get("/v1/workspaces/trusted")
def trusted_workspaces() -> dict[str, Any]:
return {"workspaces": manager.trusted_workspaces()}
@app.post("/v1/workspaces/trust")
def set_workspace_trust(body: dict) -> dict[str, Any]:
return manager.set_workspace_trust(
str((body or {}).get("path", "")),
trusted=bool((body or {}).get("trusted", False)),
)
@app.post("/v1/workspaces/pick")
async def pick_workspace() -> dict[str, Any]:
# Native folder picker opened by the LOCAL sidecar (browser GUIs can't get absolute
@@ -1607,6 +1618,9 @@ def create_app(manager: SessionManager) -> FastAPI:
if getattr(engine, "executor", None)
else None
),
"command_trust": manager.workspace_command_trust(
str(getattr(engine, "audit_context", {}).get("workspace", ""))
),
},
}
)