📚 Encyclopedia

AI & Claude · updated 2026-10-26

Securing a shared AI agent that other users can drive

securityauthorizationai-agentspermissionsauditmulti-tenantprocrastinai

ProcrastinAI runs Claude Code on Justin's desktop. Once other TLDR users could post to it, every AI feature became an authorization question: which model, which project directory, whether the agent may run shell commands, whose session a reply continues. An August 2026 audit found that most "admin only" AI controls were enforced only in the app UI. This is the checklist that came out of it, plus the design proposed for letting users bring their own AI.

Privileges to model explicitly

Bypasses found (verified in code)

  1. Raw CLI flag passthrough (#opt:<flag>): only one value was filtered, so any AI user could pass dangerously-skip-permissions or arbitrary flags. Most serious.
  2. Self-grant through a generic preferences endpoint: setting a preference on yourself was ungated and had no key allowlist, so ai_danger_access=true granted itself.
  3. Cancel endpoint with no ownership check: anyone could cancel anyone's running job.
  4. Replies drive the agent with the post author's privileges. Any user who could reply to an AI post (no visibility check on replies) could continue an admin's session, with the admin's model, project and danger level. Tags in the replier's text were parsed too.
  5. Allowlist checked only at create time: the project was stored as editable post metadata, and the continue path re-read it without re-validating, so "create in an allowed project, rewrite the metadata, reply" escaped the allowlist.
  6. Timeout chosen by the client with no server clamp.

Fix pattern

How the bypasses were closed (October 2026)

The fixes shipped two months after the audit, as one API-only change, verified on production with a throwaway user before anyone else got AI access: 1. Raw options require the danger permission. Everyone else keeps only the options the app's own chips produce, each validated: model (a known id) and effort (low|medium|high|max). 2. Self-service preferences cannot set any ai_* key except a short allowlist of cosmetic ones (default-project display, forward model, quick responses, prompt shortcuts); anything else is 403. 3. Cancel: post author or admin only (404 for a missing job, 403 otherwise). 4. A reply drives the agent only when the replier is the post author or an admin. Anyone else's reply is stored as a plain comment and never reaches the agent. 5. AI metadata keys on posts are admin-only to write; the timeout is clamped (3600 s) on every write path; and every turn re-checks that the stored project is still permitted and that the author still has AI access, so revoking access takes effect on existing threads too.

A deeper fix came later: job state (status, request id, retries) moved out of the user-writable post metadata into its own table, so there is nothing for a user to rewrite (see Lifecycle of an async AI request (status machine, expiry, retries, failure)). The general lesson: don't keep privileged state in a store users can write through a generic endpoint, then fence it off; keep it somewhere they cannot reach.

Left open: replies still have no visibility check (anyone who knows a post id can comment on it, though it no longer drives the agent), and several UI-only admin gates remain cosmetic.

Untrusted users: a sandbox, not just gates

For users who should be able to build things but never touch the host, TLDR added a guest tier whose runs are forced into a private, network-less, bubblewrap-sandboxed workspace with a daily run cap. See Sandboxing Claude Code for untrusted users (bubblewrap, --restricted, token pipe).

Bring-your-own-AI design (spec, October 2026)

Instead of sharing one person's machine, let each user connect their own agent: - Pull, not push: users' machines are behind NAT, so a small agent binary polls the API for jobs (see Pull-based job queues for agents behind NAT (design)). - Only the post owner can drive their agent. Shared-with users and public-link viewers can read, never trigger. - The agent's local config is the ceiling: danger mode, allowed folders, max timeout are set on the user's machine; the server can request less, never more. This structurally removes bypasses 1 and 2 for non-admins. Raw flags are never forwarded to agents. - Agent tokens are scoped to agent endpoints, hashed at rest, revocable; pairing codes are single use, 10-minute TTL, rate-limited. - Prompts and answers still transit the server (not E2E); say so on the setup screen. - The per-turn job table makes a natural queue for agents: /agent/jobs becomes a view over it.

See also

Linked from

Sources: tldr memory (audit-ai-permission-surface, plan-byo-ai-agent, feature-ai-projects, feature-ai-model-discovery, release-v1.47.x, feature-ai-guest-mode, feature-ai-request-table), posts #1613, #1631, #1703, #1822, #1824