Skip to content

fix(session-control): authorize a child's private-store binding on caller authority - #12185

Closed
chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/private-store-caller-isolation-11613
Closed

chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/private-store-caller-isolation-11613

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

create_session derived the child's memory route from the selected agent. Selecting
an agent is a caller-supplied string, so a caller with no private-memory record of
its own could mint a functioning worker inside a crew member's private V2 store by
naming that member's agent, and then read that memory through the child's turns.

The population that reached it was wider than an owner clicking in the dashboard. A
cron slot has no private record, and neither does anything a fenced caller created,
and both can name an agent. #11593 fenced the birth pin to the store the
delegation gate had cleared; the gate that produced that value was later removed by
the one-SQLite-store refactor, so nothing was left checking the caller at all -- while
the refusal table in docs/system-specs/modules/session-control.md still documented
memory_delegation_denied for exactly this case.

Why it matters

A member's private store is meant to be reachable only by that member. Reaching it
needed no credential, no race and no unusual timing: name the agent, then read the
child. A cron slot runs while nobody is watching, and a created child inherits its
creator's agent, so the reach survived a hop the ownership fence exists to catch.

What changed

One authorization, at the single point where every branch of agent resolution has
already produced the child's final route, and before the slot is allocated. Placing
it per branch is what left the surface open: the explicit member selection, the
inherited caller execution and the caller-agent fallback all reach a member store,
so a check on one of them leaves the others.

A private member store is now reachable on two authorities and no others:

  • the store is the caller's own, read from its protected execution record -- the
    same-store worker. The record is the only admissible input, because slot.agent
    and slot.memory_store are metadata a later write can change, and the selection
    itself is caller-supplied, so deriving authority from either lets the request
    authorize itself;
  • the caller is not ownership-fenced, which is the owner's own dashboard
    session.

Refused is the population _caller_is_ownership_fenced already treats as untrusted:
a cron slot, a member DM slot naming a peer member's agent, and anything either of
them created. The refusal reuses the existing memory_delegation_denied 403 with a
fixed message that names neither the store nor the member, so it cannot confirm a
guessed agent name. An app-token caller never reaches the route and an app-scoped one
cannot create at all, so the fence covers the whole remaining population.

The owner's dispatch capability is unchanged, so no shipped capability is removed and
no RFC is required. The nested-conductor design also survives: a member-created
worker is itself fenced but is on its own store, so the own-store authority still
admits its same-store children.

The fence verdict is carried in from the HTTP gate as caller_fenced, exactly as the
other session-control routes already carry precomputed_ownership_fenced, because the
inline predicate re-derives member status from the mutable config record and this
coroutine suspends many times before the check. It is only ever read as a refusal, so
a record that stops saying "member" in that window can turn a refusal into an
admission the owner already holds, never the reverse.

The spec's refusal row named the removed gate; it now states the two admissions, and a
new section records the model so the next reader does not reconstruct it from #11018.

Tests

test/test_member_session_control.py::TestPrivateStoreCallerIsolation, 10 cases,
both directions. Refused: a cron slot naming a member's agent; the second door on the
same store, where the child inherits caller_slot.agent and no agent argument is
passed; an agent-created child; a member naming a peer; and a carried fence verdict
deciding on its own with the config read monkeypatched to fail the test if reached.
Admitted: an owner's dashboard slot, a member's same-store worker by inheritance and
by explicit selection, a fenced caller's ordinary global-store worker, and a fenced
member-created worker dispatching its own same-store child. Each refusal also asserts
nothing was published (creator_slot_count == 0).

Mutation-checked in both directions, six mutations, all killed, each asserted to have
applied and run against a green unmutated baseline. Weakening the refusal (disable it;
key it on the explicit-selection branch only; drop the store comparison; ignore the
carried verdict) reddens the block tests and leaves the allow tests green. Weakening
the admission (remove the same-store authority; stop carrying the verdict at the
route) reddens the allow tests and leaves the block tests green.

TestMemberChildExecutionContext::test_explicit_target_member_captures_selected_route
was parametrized over both caller classes while nothing enforced the refusal half. It
is narrowed to the global caller, which is the half the spec documents as admitted;
the private caller's case is now among the refusals above.

323 tests pass across test_member_session_control.py, test_cron_session_control.py,
test_session_control.py and test_session_control_member_gate.py. Black, flake8,
isort, brand-name, comment-history, docs-lint and subprocess-encoding gates pass.

Pattern harvest

A caller-supplied string cannot be an authorization input, however faithfully it is
resolved. The selection here was resolved correctly every time -- through config, under
the right locks, into a valid execution context -- and the store it produced was still
chosen by the caller. The record is the authority; the selection is a request.

An authorization placed per branch is an authorization with as many holes as the
branches nobody enumerated. Three branches reached a private store and one of them was
fenced, which reads as covered. The fix is one check on the value all of them produce.

Rule candidate: when several branches converge on one privileged value, authorize the
converged value at the single point every branch has already reached, not each branch.
A per-branch check is only as complete as the branch enumeration, and a fenced branch
among unfenced siblings reads as covered while the siblings stay open.

Rule candidate: an input the caller supplies can never be the authority for reaching
what that input names, even when it is resolved correctly. Derive authority from a
record the caller cannot write; treat the caller's value as a request against it.

Closes #11613

@chenmingwei23
chenmingwei23 requested review from a team and pepmach September 20, 2026 04:50
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
…ller authority

Selecting an agent is a caller-supplied string, so it cannot authorize the
private V2 store that agent names. create_session derived the child's store
from the selection, so an unbound caller minted a worker inside any member's
private memory by naming that member's agent, then read that memory through
the child's turns. The population is wider than the owner clicking in the
dashboard: a cron slot, and anything a fenced caller created, all name agents.

Authorize once, at the single point where every branch of agent resolution has
produced its final route, before the slot is allocated. Two admissions: the
store is the caller's own, read from its protected execution record, or the
caller is not ownership-fenced. Slot metadata authorizes nothing.

The refusal population is the one the ownership fence already distrusts, and
the owner's dispatch capability is unchanged, so no shipped capability is
removed. The fence verdict is carried from the HTTP gate as the other routes
already carry it.

Closes kirodotdev#11613
@chenmingwei23
chenmingwei23 force-pushed the fix/private-store-caller-isolation-11613 branch from c8e0374 to cd1f372 Compare September 20, 2026 05:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ⚠️ could not complete

The first-principles review did not produce a verdict for cd1f372867fdca2d327fe73ea5744cfb4fae010e (the review step failed). See the Fork First Principles Review job logs. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ⚠️ could not complete

The design review did not produce a verdict for cd1f372867fdca2d327fe73ea5744cfb4fae010e (the review step failed). See the Fork Design Review job logs. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ⚠️ review incomplete

Reviewed cd1f372867fdca2d327fe73ea5744cfb4fae010e via the fork AI-review pipeline; updated in place on each push.

No completed Opus verdict for this commit; see the Fork Opus 4.8 Review job logs.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed cd1f372867fdca2d327fe73ea5744cfb4fae010e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cd1f372

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Superseded by #12467, which carries the identical commit cd1f372867fdca2d327fe73ea5744cfb4fae010e on a same-repository branch.

Reason: the Opus 4.8 Review requirement on this PR is served by fork-opus-review.yml, whose runs have been failing in their own setup step for every fork PR in the repository, with no completed verdict produced. That is the absence of a review rather than a review with findings, so it cannot be cleared by a re-run or an override. The same-repository lane claude-review.yml is currently healthy and producing verdicts, so the identical tree is reviewable there.

Nothing about the change itself moved. GPT 5.6 Review returned no blocking findings on this exact commit. Every other lane on this head was green.

Closing in favour of #12467. The fork branch is left in place.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session-control: an unbound caller reaches a member's private store by selecting that member's agent

1 participant