mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-03 22:12:01 +09:00
fix(security): managed-agent tools refuse sessions this project did not create (#4831)
* fix(security): managed-agent tools refuse sessions this project did not create managed_agent_prompt, status, events and terminate accepted any session id in the Anthropic organisation, so a prompt-injected caller could read, steer or delete sessions it never created. managed_agent_create now records each session and its environment in .claude-flow/managed-workflows/sessions.json, and the four tools refuse any session that is neither in that ledger nor in RUFLO_MANAGED_CONTROL_SESSIONS, before any provider request. Terminate also deletes only the environment recorded for the session, and forgets the session once it is deleted. Fixes #4751 * fix(managed-agent): keep the session ledger outside the workspace and check environments with the provider The ledger moves to ~/.claude-flow/managed/<sha256(realpath(cwd))>.json (the dispatch queue's state directory, RUFLO_AI_BUDGET_DIR honoured), so an agent that can write project files cannot grant itself another session. Terminate now asks the provider which environment a session runs in before deleting one, and refuses when the ledger disagrees. The ledger lock records its owner and is broken once older than 5 s, a corrupt ledger is set aside as .corrupt-<ts> on write, and create warns when the 1000-entry cap drops a session. The ruflo-agent managed-agent skill no longer says to terminate stale sessions from list (ruflo-agent 0.4.3). Tests cover a forged-ledger environment delete, a workspace ledger, a stale and a live lock, a corrupt ledger, the cap, and eight processes creating at once. Refs #4751 * ci(env-audit): register RUFLO_MANAGED_CONTROL_SESSIONS as a host-only escape hatch The managed-agent allowlist is a trust boundary (#4751): a caller must not be able to widen it, so there is deliberately no CLI flag to take precedence. Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x> Co-authored-by: RuFlo <ruv@ruv.net>
This commit is contained in:
8 files changed
+299
-23
No files matched your search
@@ -58,6 +58,7 @@ const KNOWN_ESCAPE_HATCHES = new Set([
|
||||
'RUFLO_SERAPHINA_DAILY_CAP', // gateway spend guard (#3275): shared daily Seraphina budget. Read by a long-running service, not a typed command — there is no invocation to attach a flag to.
|
||||
'RUFLO_SERAPHINA_IP_HOURLY_CAP',// gateway spend guard (#3275): per-client hourly Seraphina budget. Same service-only reasoning.
|
||||
'RUFLO_MANAGED_AGENTS_BASE_URL',// Trust boundary: the Managed Agents adapter sends the API key to this origin, so it is operator config only. MCP/CLI arguments cannot select another host; apiBase() accepts a bare HTTPS origin (no credentials, path, query or fragment) and every request uses redirect:'error'.
|
||||
'RUFLO_MANAGED_CONTROL_SESSIONS', // Trust boundary (#4751): the host allowlist of managed sessions this machine may control besides its own ledger. Deliberately env-only: an MCP/CLI caller (possibly a prompt-injected agent) must not be able to widen it, so there is intentionally no flag to take precedence.
|
||||
'CLAUDE_FLOW_HTTP_FETCH_ALLOW_PRIVATE', // Trust boundary (http_fetch SSRF guard): only the operator may let http_fetch reach loopback/private/link-local addresses. A CLI flag or tool argument would let the agent driving the MCP tool (possibly prompt-injected) switch the guard off, so it is env-only by design.
|
||||
'RUFLO_X_GATEWAY_URL', // Trust boundary: gateway reads/admin writes pin destinations to server config; MCP/CLI arguments cannot select another host.
|
||||
'SERAPHINA_METALLM_URL', // Trust boundary: credential-bearing Meta-LLM requests pin destinations to server config.
|
||||
|
||||
Reference in new issue
Block a user