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(control): open-project admits only a verified caller (P1)

enes100f835318cb
diff --git a/src/core/agents/hook-server.ts b/src/core/agents/hook-server.ts
index d6c356c77..fba6cae34 100644
--- a/src/core/agents/hook-server.ts
+++ b/src/core/agents/hook-server.ts
@@ -175,11 +175,22 @@ export interface HookEventMeta {
* protect — the routes are new — which is the one place in the whole control surface where
* fail-closed from day one costs nobody anything.
*
+ * `open-project` (issue #338) is here for the same class of reason as `sticky`: the main-side
+ * grant ledger (src/main/project-grants.ts) mints per-caller targeting rights off a successful
+ * `open-project`, and a grant recorded for an unverifiable caller would authorize whoever can
+ * name that caller's node id. NEW verb, so fail-closed from day one strands nobody.
+ *
* Consulted in the `/control/` route BEFORE `identityGate`'s decision is, so no future change to
* the policy table can widen it; `messaging-verified-only.test.ts` drives the route on both sides
* of every hatch and is the test that fails if either half of this comment stops being true.
*/
-export const requiresVerified: ReadonlySet<string> = new Set(['send', 'reply', 'notify', 'sticky'])
+export const requiresVerified: ReadonlySet<string> = new Set([
+ 'send',
+ 'reply',
+ 'notify',
+ 'sticky',
+ 'open-project'
+])
/**
* The refusal for a messaging verb: one sentence, no diagnosis, no hint about tokens or restarts —
@@ -192,9 +203,15 @@ export const MESSAGING_CONTROL_REFUSAL = 'Agent messaging refused.'
* because "agent messaging refused" answering a note write is a diagnosis-delaying lie. */
export const STICKY_CONTROL_REFUSAL = 'Sticky write refused.'
+/** Same posture again for `open-project` (issue #338): one sentence naming what was refused, no
+ * diagnosis, no token or restart advice — a designed refusal, not a rollout accident. */
+export const OPEN_PROJECT_CONTROL_REFUSAL = 'Project open refused.'
+
/** The verified-only refusal, worded for the verb that was refused. */
export function verifiedRefusalFor(verb: string): string {
- return verb === 'sticky' ? STICKY_CONTROL_REFUSAL : MESSAGING_CONTROL_REFUSAL
+ if (verb === 'sticky') return STICKY_CONTROL_REFUSAL
+ if (verb === 'open-project') return OPEN_PROJECT_CONTROL_REFUSAL
+ return MESSAGING_CONTROL_REFUSAL
}
class HookServer {
diff --git a/src/core/agents/messaging-verified-only.test.ts b/src/core/agents/messaging-verified-only.test.ts
index 2e8827b23..39f7afd25 100644
--- a/src/core/agents/messaging-verified-only.test.ts
+++ b/src/core/agents/messaging-verified-only.test.ts
@@ -112,7 +112,7 @@ describe('send/reply require `verified` — and controlPolicy is NOT the decider
// from day one — there is no upgrade population to protect.
hookServer.clearNodeAuthSecretForTests()
try {
- for (const verb of ['send', 'reply'] as const) {
+ for (const verb of ['send', 'reply', 'open-project'] as const) {
const res = await post(verb, 'n-src')
expect(res.status, verb).toBe(403)
}
@@ -137,14 +137,31 @@ describe('where the verbs sit in the routing tables', () => {
}
})
- it('the verified-only set is exactly the messaging verbs plus sticky', () => {
+ it('the verified-only set is exactly the messaging verbs plus sticky plus open-project', () => {
// Pins that nothing ELSE ever drifts in: adding a SHIPPED verb here would strand its legacy
// population with no hatch, which is the one thing this set must never be casually grown by.
// `notify` (folded in from #98, Task 5.2) is a messaging verb like the other two — it writes
// into another agent's pane — so it takes the same gate. `sticky` (issue #144) is here
// because its "↻ <agent> · when" stamp replaces the confirm dialog, and a byline any
// bearer-holder could forge would be worse than no byline; it shipped verified-only from
- // day one, so no legacy population is stranded.
- expect([...requiresVerified].sort()).toEqual(['notify', 'reply', 'send', 'sticky'])
+ // day one, so no legacy population is stranded. `open-project` (issue #338) is here because
+ // the grant ledger binds targeting rights to the verified caller identity — a grant minted
+ // for a forgeable caller would authorize whoever forged it; new verb, so fail-closed from
+ // day one strands nobody.
+ expect([...requiresVerified].sort()).toEqual([
+ 'notify',
+ 'open-project',
+ 'reply',
+ 'send',
+ 'sticky'
+ ])
+ })
+
+ it('the open-project refusal is its own flat sentence, not the messaging one', () => {
+ // "Agent messaging refused." answering a project open would be a diagnosis-delaying lie —
+ // the same argument that gave sticky its own sentence. Same posture: one sentence, no
+ // token/restart advice.
+ expect(verifiedRefusalFor('open-project')).toBe('Project open refused.')
+ expect(verifiedRefusalFor('open-project')).not.toBe(MESSAGING_CONTROL_REFUSAL)
})
})