#11127·zeroclaw

[Bug]: Session-data tools bypass principal ownership checks

Author: Audacity88Created Sep 25, 2026Updated Sep 30, 2026
Labelsbugagentruntimetoolsecurity:policydomain:securitypriority:p1risk:high

Affected component

security/sandbox

Severity

S0 - data loss / security risk

Current behavior

Source review of the landed #10265 commit found that session-data tools can bypass the RPC principal-ownership boundary. A non-admin principal allowed to use sessions_history can read another principal's transcript when both sessions use the same agent. I have not executed a runtime reproduction.

The RPC ACP construction path passes the session store into the Agent, which constructs AcpSessionReadView with only the agent alias. The view classifies and loads records by agent, not principal. sessions_history then loads same-agent ACP history or a chat backend key without checking its owner. sessions_list also enumerates shared chat metadata without principal filtering.

sessions_send rejects ACP targets, but its chat fallback resolves an existing chat key and appends a user message without checking the target principal. A non-admin with sessions_send and the required tool-action permission can therefore modify another principal's chat history. sessions_current is different: it accepts no target ID and reports the turn's current session, so it is not evidence of this arbitrary-target bypass.

The new constrained-session path retains explicitly allowed session tools. The list, history, send, and current tool implementations do not override the default requires_unrestricted_principal() == false. Passing the current session ID into the turn identifies the caller's session but does not establish authority over the records a cross-session tool reads or writes. Existing different-agent isolation tests do not cover two principals sharing one agent.

The predecessor refused named/constrained tool sessions; #10265 admits that caller class without making this alternate data-access path principal-aware. #9746 concerns agent scoping, which is related but does not provide principal isolation. This repair belongs under the session-ownership contract in #8290.

Expected behavior

Cross-session data tools must apply the same canonical principal-ownership boundary as RPC session operations to both reads and writes, including chat fallback. A tool grant authorizes use of the tool, not access to every principal's records.

Either pass principal-aware read views/predicates into the tools or temporarily withhold principal-unaware cross-session tools from all authenticated non-admin callers. The containment must include non-admin callers with wildcard tool and agent selectors: marking the tools requires_unrestricted_principal alone is insufficient because that caller path skips narrowing.

A focused two-principal, same-agent test should deny foreign-session history while allowing the caller's own history. Cover the chat append boundary with a harmless message and verify that denial leaves the foreign transcript unchanged. Any temporary exclusion should also verify that wildcard non-admin grants cannot bypass it.

Steps to reproduce

bash
# Source-derived regression scenario; not executed.
# 1. Create principals zeroclaw_user and zeroclaw_operator, neither an admin.
# 2. Allow both to use zeroclaw_agent; allow zeroclaw_operator sessions_history.
# 3. Persist an ACP session owned by zeroclaw_user with a harmless marker.
# 4. Start zeroclaw_operator's own RPC session on the same agent.
# 5. Invoke its retained sessions_history tool with the other session's fixture ID.
# Expected: foreign transcript denied; own-session history remains available.
# Source path: agent-only classification accepts the foreign same-agent record.

Impact

Multi-principal deployments that share an agent and permit session-data tools can expose another principal's conversation content or session metadata. Permitted sessions_send use can also append a message to a foreign chat transcript. This does not require administrator status or grant revocation. Separate agent aliases provide a different boundary and do not fix same-agent principal isolation.

Logs / stack traces

No runtime logs captured. Evidence is the linked source at the landed commit.

ZeroClaw version

73e2a4a15ddbdb01ffb4a044dc6c5c8dd7835110 (landed #10265).

Rust version

Not built locally for this report; source inspection only.

Operating system

No runtime reproduction on a specific OS. The identified data-access path is platform-independent Rust code.

Regression?

Unknown

Source comparison establishes that constrained sessions are newly admitted; no before/after runtime comparison was performed.

Pre-flight checks

  • I reproduced this on the latest master branch or latest release.
  • I redacted secrets, tokens, and personal data from all submitted content.

The reproduction checkbox is intentionally unchecked because this is a source-review finding.