Repository navigation
fix(agents): PUT /operator-resume is human-only — an agent cannot switch on its own paid wake-ups (0.9.5 M3) - #2860
Conversation
…tch on its own paid wake-ups (0.9.5 M3, ent#329) An agent-scoped MCP key resolves to its OWNER on REST, so `OwnedAgentByName` alone was satisfied by the agent's own injected key: a (prompt-injected) agent could enable the respond→resume opt-in whose whole point is "each answer may now spend the owner's money". Add `reject_agent_principal` as the first statement (grant-vs-use line: the GET stays agent-reachable). Test pins the guard by source and at runtime — 403 with the human-only detail before the DB write or the audit write — and that a JWT owner still flips it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
/review ReportBranch: Critical Findings (block merge)None. Informational Findings (review required)[I1] Auth boundary (4.3) — verified, recorded for the reviewer (Confidence: 9/10) [I2] Test naming (4.7) (Confidence: 6/10) [I3] Test gap (4.9) — ordering proof is by loud stubs, not by the audit path (Confidence: 5/10 → appendix) Clean Categories
Summary
Review complete. Next: |
vybe
left a comment
There was a problem hiding this comment.
merge-train: validated individually against dev (2-PR run, no train branch). Guard is the first statement of the PUT, ahead of both the DB write and the audit write; the runtime tests go red if it is moved after the write. No other writer of operator_resume_enabled; not exposed as an MCP tool. Merged without a closing keyword by decision: ent#329 is already status-in-dev and no public issue tracks this fix.
0.9.5 work order M3. Related to abilityai/trinity-enterprise#329.
Summary
PUT /api/agents/{name}/operator-resumewasOwnedAgentByNameonly. An agent-scoped MCP key resolves to its owner on REST, so the agent's own injected key satisfied the owner check and a (prompt-injected) agent could enable the respond→resume opt-in — whose entire point is "each answer may now spend the owner's money" (ent#329). Addreject_agent_principal(current_user)as the first statement. Grant-vs-use line: the GET stays agent-reachable (an agent may read whether its answers resume it); only the grant is fenced — same shape as the ent#223 consent toggle and the ent#109 bind endpoint.Test
tests/unit/test_m3_operator_resume_human_only.py:Red before the fix (2 failed), green after;
test_ent329_operator_resume,test_1310_auth_wiring,test_293_admin_gate_rejects_agent_keysstill pass (65 passed).docs/memory/architecture/api-endpoints.mdrow updated.🤖 Generated with Claude Code