Signed hook events: a per-agent token so no agent (or engine bridge) can impersonate another
Maintainers usually reply within 1 day
Assessment
This issue has not been assessed yet.
Description
Problem / motivation
Every agent reports its lifecycle (SessionStart, Stop, tool use, cost) to one shared hook channel, HIVE_SOCK (set at spawn for Claude in hive.ts:1258 and for the other engines' bridges in hive.ts:1120). HookServer takes the agent's identity from the payload itself (hooks.ts:331), and the shim fills that from the AGENT_ID env var (hive.ts:4270-4272). Nothing ties a frame to the process that sent it.
So a frame naming another agent is accepted as that agent. Concretely, it can:
- overwrite that agent's saved session id (hooks.ts:387), the id used for
claude --resumeon restart (hive.ts:1444), so the agent comes back on the wrong thread; - write cost rows for any agent via
CostSample(hooks.ts:395); - fire a fake Stop: the "Finished" notification and idle signal (hooks.ts:465), and for Michael the owner-notes path (hooks.ts:462).
This is already tracked as P2 in TODOS.md ("an agent can send a fake Stop or SessionStart event naming Michael"). The random Windows pipe name keeps outside programs off the channel, but every agent is handed it in HIVE_SOCK, and Windows has no shell sandbox (hive.ts:1505).
It grows with every engine: the Codex, Gemini, Antigravity, Grok, pi and opencode shims and the qwen proxy sidecar all post to this same channel. Worth closing before BUILD_ENGINES grows past ['claude'].
Proposed solution
- At spawn,
hive.tsmints a random per-agent token (crypto.randomBytes) and keeps the token → agent id map in main-process memory only, never in the hive folder. - Each bridge gets its token the way it already gets per-agent config (the agent's
settings.jsonhook command, itsCODEX_HOMEhooks, or env for the agy shim and the proxy sidecar), and every shim includes it in each frame. HookServerresolves the agent from the token, not from the payload'sagent_id, and drops frames with a missing or unknown token (logged likehook-frame-rejected). Asubagent_idis honoured only under its parent's token. An agent can still read its own token, which only lets it speak as itself.- Rotate the token on every respawn/restart, so an old one dies with its session.
- One test per bridge kind (Claude settings hook, hooks shim, proxy) asserting a frame with a forged
agent_idor no token is rejected. Any new engine has to pass it before joiningBUILD_ENGINES. - Second half of the same TODO: move
ownerSentDir/ownerStatePath(agents/human, hive.ts:2597) out of the folder agents can write.
Why: a contained change (hooks.ts, the spawn path in hive.ts, the shim templates) that closes a known P2 gap and makes multi-engine support safe by default, since every engine is authenticated the same way whatever its hook format. It complements #48 (per-engine policy enforcement) rather than overlapping it.
Screenshot, mockup or recording
Sketch: today vs. proposed (a frame forged by one agent, naming Michael)
sequenceDiagram
participant A as Agent sales (its own shell)
participant H as HookServer (main process)
Note over A,H: Today
A->>H: Stop, agent_id = michael, session_id = x
H->>H: identity read from payload (hooks.ts:331)
H-->>H: accepted as Michael, session id overwritten, Finished fired
Note over A,H: Proposed
A->>H: Stop, agent_id = michael, token = sales token
H->>H: token resolves to sales (map held in main memory)
H-->>A: agent_id does not match token owner, frame rejected and logged
Alternatives considered
Matching the frame to the agent's process id: weaker, because hook shims run as child processes of the CLI and the proxy sidecar is a separate process, so there is no single pid to check. Relying on the OS sandbox alone: it is off on Windows and does not apply the same way to every engine. A per-agent token works identically for every bridge kind and every OS.
Area
The hive (memory, routing, GOD agent)
Pre-flight
- I attached a screenshot, mockup or recording above.
- I searched existing issues and discussions, and this isn't a duplicate.
- Dominant language
- TypeScript
- Stars
- 273
- Forks
- 211
- Avg merge
- 14h 24m
- Merged PRs (30d)
- 203
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from agentvivekkumar/dontbemichael
-
Windows: a hidden Claude call cannot start when the CLI path has a spacePossibly taken @theshloksschauhan claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
agentvivekkumar/dontbemichael#426 ·
Maintainers usually reply within 1 day
-
Raise Home and Manager setup text to the 14px floorPossibly taken @glenmiracle18 claimed this 2 days ago. Openbug os:windows
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
agentvivekkumar/dontbemichael#416 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 15/100
agentvivekkumar/dontbemichael#499 ·
Maintainers usually reply within 1 day
-
Enhancement: read scans and photos on Windows with the OCR built into Windows, as the Mac already doesPossibly taken @MickyG03 claimed this 1 day ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 28/100
agentvivekkumar/dontbemichael#498 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 22/100
agentvivekkumar/dontbemichael#490 ·
Maintainers usually reply within 1 day
All issues in agentvivekkumar/dontbemichael
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
umami-software/umami#4637 ·
Maintainers usually reply within 3 days
-
Hotkeys fire when pressed with the Ctrl key, so browser shortcuts also trigger player actionsPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
muxinc/media-chrome#1332 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
polarsource/polar#15580 ·
Maintainers usually reply within 1 day
-
accepted bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
pingdotgg/t3code#20931 · 1 comment ·
Maintainers usually reply within 1 day
-
bug/1-unconfirmed kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day