Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(identity): a strict verb bucket that the escape hatch cannot release

Claude Codea76cedb3ef13
diff --git a/docs/node-identity.md b/docs/node-identity.md
index fd26e61f8..b29854c26 100644
--- a/docs/node-identity.md
+++ b/docs/node-identity.md
@@ -295,6 +295,12 @@ around. Anyone who can set the header can present an unjudgeable one, and the ap
it takes to set the header. So: the latch is a good bug-catcher and worth keeping; it is not a
boundary, and neither is the dated cutoff (the same probe walks past both).
+**The one place the probe stops.** A verb in `STRICT_CONTROL_VERBS` admits `verified` and nothing
+else, so a foreign kid — `legacy` by invariant 3 — is refused there with a flat sentence and no
+diagnosis. That is the only route in this document where the invented-kid escape does not apply, and
+it is affordable exactly because those verbs are new: there is no legacy population to strand, so
+nothing has to fail open. It buys nothing for the routes above, which keep the posture they have.
+
**The real hardening, if it is ever wanted.** Scope the remote token dir as
`node-tokens/<kid>/<nodeId>` (already sketched in `writeNodeTokens`' own doc comment). The *only*
scenario the foreign-kid escape exists for is two instances sharing one host account overwriting
@@ -330,7 +336,13 @@ because it is a tri-state:
| `false` | Not required | Keep the warning window open past the date **and** release the latch. |
`false` is for a user whose upgrade strands a live session: it gets the canvas back without
-downgrading the app. Neither value ever admits a `forged` token. Both shells wire it as a **live
+downgrading the app. Neither value ever admits a `forged` token, and neither releases a verb in
+**`STRICT_CONTROL_VERBS`** (today: `browser`) — that bucket is decided one line below the `forged`
+check, above every branch the hatch or the dated window can reach, and it admits `verified` only.
+The hatch exists to rescue a session that cannot present an identity; it must not double as a grant
+of the one capability where identity *is* the admission control. The cost is named rather than
+hidden: cross-instance failover loses those verbs, because another instance's token is a foreign
+kid and therefore `legacy`. Both shells wire it as a **live
getter** (`setIdentityStrictOverride`), so a change takes effect on the next request, not the next
launch — a stranded user must not have to restart the thing that is already broken.
diff --git a/src/core/agents/hook-identity-enforcement.test.ts b/src/core/agents/hook-identity-enforcement.test.ts
index b0dd515e1..d5ba04f0a 100644
--- a/src/core/agents/hook-identity-enforcement.test.ts
+++ b/src/core/agents/hook-identity-enforcement.test.ts
@@ -26,6 +26,8 @@ import {
IDENTITY_UNMINTABLE_NOTE,
IDENTITY_UNMINTABLE_WARN_NOTE,
NODE_IDENTITY_STRICT_AFTER,
+ STRICT_CONTROL_REFUSAL,
+ STRICT_CONTROL_VERBS,
TOLERANT_CONTROL_VERBS
} from './node-identity-policy'
import { CONTEXT_LINK_VERBS } from '../context-link-render'
@@ -656,3 +658,122 @@ describe('the injected clock', () => {
expect((await control('open-terminal', 'n-edge2')).status).toBe(403)
})
})
+
+/**
+ * The strict bucket, proven on the wire rather than only in `controlPolicy`'s table.
+ *
+ * `browser` is the first verb whose admission control IS the identity, so the two escapes this
+ * file documents elsewhere — the dated window and `hookIdentityStrict: false` — must both stop at
+ * it, and the third (an invented kid, which walks past the latch into /control/list) must stop too.
+ * "Refused" here means the handler never ran, not that the reply looked unhappy.
+ */
+describe('/control/<strict verb> admits only a verified caller', () => {
+ const STRICT = 'browser'
+ // Same shape as the invented kid above: eight arbitrary characters, a dot, an arbitrary tail.
+ const INVENTED = 'CCCCCCCC.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'
+
+ it('is in the strict bucket and not in the tolerant one', () => {
+ expect(STRICT_CONTROL_VERBS.has(STRICT)).toBe(true)
+ expect(TOLERANT_CONTROL_VERBS.has(STRICT)).toBe(false)
+ })
+
+ it('refuses a tokenless caller INSIDE the warning window', async () => {
+ // Every other mutation still executes here until 2026-10-13. This one never did.
+ const res = await control(STRICT, 'n-strict-window')
+ expect(res.status).toBe(403)
+ expect(await res.text()).toBe(`${STRICT_CONTROL_REFUSAL}\n`)
+ expect(controlCalls).toEqual([])
+ })
+
+ it('refuses even with the escape hatch OFF — the hatch must not double as a grant', async () => {
+ // settings.hookIdentityStrict:false is what docs/node-identity.md tells a stranded user to
+ // reach for. Before the bucket it returned allow-with-warning for every non-tolerant verb, so
+ // it handed browser control to any holder of the app-wide bearer, permanently.
+ hookServer.setIdentityStrictOverride(() => false)
+ const res = await control(STRICT, 'n-strict-hatch')
+ expect(res.status).toBe(403)
+ expect(await res.text()).toBe(`${STRICT_CONTROL_REFUSAL}\n`)
+ expect(controlCalls).toEqual([])
+ // …while the hatch keeps doing its actual job for an ordinary mutation past the cutoff.
+ hookServer.setIdentityClockForTests(() => PAST_CUTOFF)
+ const ordinary = await control('open-terminal', 'n-hatch-ordinary')
+ expect(ordinary.status).toBe(200)
+ expect(controlCalls).toEqual([{ verb: 'open-terminal', nodeId: 'n-hatch-ordinary' }])
+ })
+
+ it('lets a VERIFIED caller through, on both sides of the cutoff and with any hatch setting', async () => {
+ for (const clock of [IN_WINDOW, PAST_CUTOFF]) {
+ for (const override of [undefined, true, false] as const) {
+ controlCalls = []
+ hookServer.setIdentityClockForTests(() => clock)
+ hookServer.setIdentityStrictOverride(() => override)
+ const node = `n-strict-ok-${clock.getTime()}-${String(override)}`
+ const res = await control(STRICT, node, nodeAuthToken(SECRET, node))
+ expect(res.status, node).toBe(200)
+ expect(controlCalls, node).toEqual([{ verb: STRICT, nodeId: node }])
+ }
+ }
+ })
+
+ it('403s a forged token, as everywhere else', async () => {
+ const res = await control(STRICT, 'n-strict-forged', nodeAuthToken(SECRET, 'somebody-else'))
+ expect(res.status).toBe(403)
+ expect(controlCalls).toEqual([])
+ })
+
+ it('the invented-kid escape does NOT reach a strict verb', async () => {
+ // docs/node-identity.md and the test above pin that an invented kid walks past the latch and
+ // the cutoff into /control/list and every /context-link/* verb, because a FOREIGN kid must be
+ // `legacy` (invariant 3) and `legacy` is admitted there. Here `legacy` is a refusal — one of
+ // the very few routes where that escape does not apply. Stated because the surrounding doc's
+ // honest pessimism would otherwise be read as covering this verb too.
+ const res = await control(STRICT, 'n-strict-invented', INVENTED)
+ expect(res.status).toBe(403)
+ expect(await res.text()).toBe(`${STRICT_CONTROL_REFUSAL}\n`)
+ expect(controlCalls).toEqual([])
+ // The contrast, in one test: the SAME token, the same instant, on a tolerant verb.
+ const list = await control('list', 'n-strict-invented', INVENTED)
+ expect(list.status).toBe(200)
+ expect(controlCalls).toEqual([{ verb: 'list', nodeId: 'n-strict-invented' }])
+ })
+
+ it('answers a JSON caller with the same sentence in the same shape', async () => {
+ const res = await control(STRICT, 'n-strict-json', undefined, 'application/json')
+ expect(res.status).toBe(403)
+ expect(await res.json()).toEqual({ ok: false, error: STRICT_CONTROL_REFUSAL })
+ expect(controlCalls).toEqual([])
+ })
+
+ it('says nothing about tokens, kids or restarts — not even to an unmintable node', async () => {
+ // An id `isSafeNodeId` refuses normally earns IDENTITY_UNMINTABLE_NOTE, which names the cause
+ // and the escape hatch. On a strict verb that sentence would be both an instruction that
+ // cannot help (the hatch does not release this) and a map for whoever is probing.
+ const res = await control(STRICT, '../etc')
+ expect(res.status).toBe(403)
+ const body = await res.text()
+ expect(body).toBe(`${STRICT_CONTROL_REFUSAL}\n`)
+ expect(body).not.toContain(IDENTITY_UNMINTABLE_NOTE)
+ expect(body).not.toContain(IDENTITY_REFUSED_NOTE)
+ expect(controlCalls).toEqual([])
+ })
+
+ it('leaves every other verb on its old table — window, hatch and tolerance all intact', async () => {
+ // The regression net for the bucket being a THIRD branch rather than a re-shaping.
+ const inWindow = await control('open-terminal', 'n-unchanged-window')
+ expect(inWindow.status).toBe(200)
+ expect((await inWindow.text()).startsWith(IDENTITY_RESTART_NOTE)).toBe(true)
+
+ hookServer.setIdentityClockForTests(() => PAST_CUTOFF)
+ expect((await control('open-terminal', 'n-unchanged-cutoff')).status).toBe(403)
+ expect((await control('list', 'n-unchanged-list')).status).toBe(200)
+
+ hookServer.setIdentityStrictOverride(() => false)
+ expect((await control('open-terminal', 'n-unchanged-hatch')).status).toBe(200)
+
+ expect(controlCalls).toEqual([
+ { verb: 'open-terminal', nodeId: 'n-unchanged-window' },
+ { verb: 'list', nodeId: 'n-unchanged-list' },
+ { verb: 'open-terminal', nodeId: 'n-unchanged-hatch' }
+ ])
+ })
+})
diff --git a/src/core/agents/hook-server.ts b/src/core/agents/hook-server.ts
index cc7ac7725..c0df10798 100644
--- a/src/core/agents/hook-server.ts
+++ b/src/core/agents/hook-server.ts
@@ -17,6 +17,8 @@ import {
IDENTITY_RESTART_NOTE,
IDENTITY_UNMINTABLE_NOTE,
IDENTITY_UNMINTABLE_WARN_NOTE,
+ STRICT_CONTROL_REFUSAL,
+ STRICT_CONTROL_VERBS,
type IdentityDecision
} from './node-identity-policy'
@@ -444,7 +446,14 @@ class HookServer {
// Which sentence: a node in a case-folding collision group, or with an id
// `isSafeNodeId` refuses, can NEVER pick up an identity, and telling it to restart is
// an instruction to loop forever. See `identityRefusalNote`.
- const note = this.identityRefusalNote(nodeId)
+ //
+ // A STRICT verb answers with its own flat sentence instead: those refusals are not a
+ // rollout accident to be talked through, they are the designed state for anything but
+ // a verified caller, and naming tokens or restarts there is advice to whoever is
+ // probing. See STRICT_CONTROL_VERBS.
+ const note = STRICT_CONTROL_VERBS.has(verb)
+ ? STRICT_CONTROL_REFUSAL
+ : this.identityRefusalNote(nodeId)
if (wantsText) {
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' })
res.end(`${note}\n`)
diff --git a/src/core/agents/node-identity-policy.test.ts b/src/core/agents/node-identity-policy.test.ts
index c8e9f38ee..d36609f68 100644
--- a/src/core/agents/node-identity-policy.test.ts
+++ b/src/core/agents/node-identity-policy.test.ts
@@ -10,6 +10,8 @@ import {
isStrictInstant,
NODE_IDENTITY_CLOCK_HORIZON_MS,
NODE_IDENTITY_STRICT_AFTER,
+ STRICT_CONTROL_REFUSAL,
+ STRICT_CONTROL_VERBS,
TOLERANT_CONTROL_VERBS
} from './node-identity-policy'
import { NODE_IDENTITY_STRICT_DATE } from '@shared/node-identity'
@@ -234,3 +236,72 @@ describe('controlPolicy', () => {
})
})
})
+
+// The third bucket. Everything above this line is the two-move rollout for verbs that already had
+// a population; this is the posture for a verb that never did.
+describe('STRICT_CONTROL_VERBS admits `verified` and nothing else', () => {
+ const STRICT = 'browser'
+
+ for (const now of [BEFORE, AFTER]) {
+ for (const override of [undefined, true, false] as const) {
+ for (const proven of [true, false]) {
+ const where = `now=${now.toISOString()} override=${override} proven=${proven}`
+ it(`verified ⇒ allow (${where})`, () => {
+ expect(controlPolicy({ verdict: 'verified', proven, verb: STRICT, now, override })).toBe(
+ 'allow'
+ )
+ })
+ for (const verdict of ['legacy', 'forged'] as const) {
+ it(`${verdict} ⇒ refuse (${where})`, () => {
+ expect(controlPolicy({ verdict, proven, verb: STRICT, now, override })).toBe('refuse')
+ })
+ }
+ }
+ }
+ }
+
+ it('the escape hatch does NOT release it — this is the whole point of the bucket', () => {
+ // settings.hookIdentityStrict:false is the switch docs/node-identity.md tells a stranded user
+ // to reach for. It releases the latch and the dated cutoff. It must not release this.
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: false, verb: STRICT, now: BEFORE, override: false })
+ ).toBe('refuse')
+ })
+
+ it('the dated window does not release it either — refused from day one, not from the cutoff', () => {
+ // A tokenless caller would otherwise have driven a browser for the whole warning window.
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: false, verb: STRICT, now: BEFORE, override: undefined })
+ ).toBe('refuse')
+ })
+
+ it('a strict verb is in NEITHER tolerant path, ever', () => {
+ expect(TOLERANT_CONTROL_VERBS.has(STRICT)).toBe(false)
+ expect(STRICT_CONTROL_VERBS.has(STRICT)).toBe(true)
+ expect([...STRICT_CONTROL_VERBS].some((v) => TOLERANT_CONTROL_VERBS.has(v))).toBe(false)
+ })
+
+ it('leaves every other verb exactly as it was', () => {
+ // The regression net: the bucket is a THIRD branch, not a re-shaping of the other two.
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: false, verb: TOLERANT, now: AFTER, override: undefined })
+ ).toBe('allow')
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: false, verb: MUTATION, now: BEFORE, override: undefined })
+ ).toBe('allow-with-warning')
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: false, verb: MUTATION, now: AFTER, override: undefined })
+ ).toBe('refuse')
+ expect(
+ controlPolicy({ verdict: 'legacy', proven: true, verb: MUTATION, now: AFTER, override: false })
+ ).toBe('allow-with-warning')
+ })
+
+ it('says one sentence and diagnoses nothing — advice here is advice to whoever is probing', () => {
+ expect(STRICT_CONTROL_REFUSAL).toBe('Browser control refused.')
+ expect(STRICT_CONTROL_REFUSAL).not.toContain('\n')
+ for (const leak of ['token', 'kid', 'Restart', 'identity']) {
+ expect(STRICT_CONTROL_REFUSAL).not.toContain(leak)
+ }
+ })
+})
diff --git a/src/core/agents/node-identity-policy.ts b/src/core/agents/node-identity-policy.ts
index 6c3e80057..46cde479b 100644
--- a/src/core/agents/node-identity-policy.ts
+++ b/src/core/agents/node-identity-policy.ts
@@ -180,6 +180,38 @@ export const IDENTITY_UNMINTABLE_WARN_NOTE =
*/
export const TOLERANT_CONTROL_VERBS = new Set(['list'])
+/**
+ * Control verbs that admit ONLY a `verified` caller — no window, no latch, no override.
+ *
+ * `browser` is the whole bucket. It is a route through which an agent acts as the user on the
+ * internet, inside a session jar that may hold real logins, and it is NEW — so unlike every verb
+ * the two-move rollout was built for, there is no legacy population to strand and nothing to fail
+ * open FOR. Same posture `/codex-thread/{start,bind}` already holds, for the same reason.
+ *
+ * Checked BEFORE the `override === false` branch, deliberately. That branch returns
+ * `allow-with-warning` for any non-tolerant verb, so `settings.hookIdentityStrict: false` — the
+ * switch docs/node-identity.md tells a stranded user to reach for — would otherwise hand browser
+ * control to any holder of the app-wide bearer, permanently. The escape hatch exists to rescue a
+ * session that cannot present an identity; it must not double as a grant of the one capability
+ * where identity is the entire admission control.
+ *
+ * WHAT IT BUYS, precisely: an invented `kid` is a FOREIGN kid, which invariant 3 requires to be
+ * `legacy` (or cross-instance failover dies), so it walks past the latch and the cutoff into
+ * /control/list and every /context-link/* read. Here `legacy` is a refusal, so that probe fails.
+ *
+ * WHAT IT COSTS: cross-instance failover loses browser control. A second instance's token is a
+ * foreign kid, therefore `legacy`, therefore refused. Accepted. A verb must NEVER be moved from
+ * here into TOLERANT_CONTROL_VERBS.
+ */
+export const STRICT_CONTROL_VERBS: ReadonlySet<string> = new Set(['browser'])
+
+/**
+ * The refusal for a strict verb: one sentence, no diagnosis, no hint about tokens or kids.
+ * Advice here is advice to an attacker and a lie to nobody else — the doc's own phrasing for the
+ * `forged` case, applied to the whole non-`verified` set.
+ */
+export const STRICT_CONTROL_REFUSAL = 'Browser control refused.'
+
/**
* The verb `/context-link/*` presents to `controlPolicy`.
*
@@ -225,7 +257,9 @@ export interface ControlPolicyInput {
*
* `override === false` is the escape hatch: it releases the LATCH as well as the cutoff, because
* the latch is the likelier of the two to have stranded a user whose upgrade went wrong, and a
- * hatch that does not rescue them is not a hatch. It never releases `forged`.
+ * hatch that does not rescue them is not a hatch. It never releases `forged`, and it never
+ * releases a verb in `STRICT_CONTROL_VERBS` — that bucket is decided one line below `forged`,
+ * above every branch the hatch can reach.
*/
export function controlPolicy({
verdict,
@@ -235,6 +269,8 @@ export function controlPolicy({
override
}: ControlPolicyInput): IdentityDecision {
if (verdict === 'forged') return 'refuse'
+ // BEFORE the override and BEFORE the dated window — see STRICT_CONTROL_VERBS.
+ if (STRICT_CONTROL_VERBS.has(verb)) return verdict === 'verified' ? 'allow' : 'refuse'
if (verdict === 'verified') return 'allow'
if (override === false) {
return TOLERANT_CONTROL_VERBS.has(verb) ? 'allow' : 'allow-with-warning'
diff --git a/src/renderer/components/settings/sections/AgentsSection.tsx b/src/renderer/components/settings/sections/AgentsSection.tsx
index 377ed6bda..bf3ac98c6 100644
--- a/src/renderer/components/settings/sections/AgentsSection.tsx
+++ b/src/renderer/components/settings/sections/AgentsSection.tsx
@@ -265,7 +265,7 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El
<SearchableRow {...ROWS.nodeIdentity}>
<FieldRow
label="Require verified node identity for canvas control"
- description={`Commands that open, write to or close nodes — and that read a linked node's context — must present the identity NodeTerm issued to the node they say they came from. Automatic starts refusing the ones that can't from ${NODE_IDENTITY_STRICT_DATE}; until then they still run and the reply tells you to restart that node. Set this to "Not required" if an upgrade left a running session unable to drive the canvas: it restores the behaviour from before this feature, past ${NODE_IDENTITY_STRICT_DATE} as well. An identity that is actually forged is refused whatever you pick here.`}
+ description={`Commands that open, write to or close nodes — and that read a linked node's context — must present the identity NodeTerm issued to the node they say they came from. Automatic starts refusing the ones that can't from ${NODE_IDENTITY_STRICT_DATE}; until then they still run and the reply tells you to restart that node. Set this to "Not required" if an upgrade left a running session unable to drive the canvas: it restores the behaviour from before this feature, past ${NODE_IDENTITY_STRICT_DATE} as well. An identity that is actually forged is refused whatever you pick here. It does not release browser control, which always requires a verified identity.`}
control={
<Select
aria-label="Require verified node identity"