The environment issues its own sessions and enforces their capabilities. Cloud identity and relay credentials belong to a separate trust boundary, described in T3 Connect. A relay token is never an environment login. See SECURITY.md for the overall threat model.
- Narrowing only. Pairing delegates a set of scopes. Exchanging a bootstrap credential can narrow a grant, never widen it. Client labels and device metadata have no authorization role.
access:writehands out what the session holds and revokes anything. Every route that returns a credential to the caller requiresaccess:writeand every scope that credential carries: a pairing link, an MCP sign-in approval, a link code from a linked environment, and a guest link (which reads a thread). Revoking is not capped by the caller's scopes. Admitting a T3 Connect device is not delegation; see T3 Connect.- Why the default grant includes management scopes.
terminal:operateandorchestration:operatealready grant OS-user execution (which can invoket3 auth session issue), so withholding access or relay management from the default grant would not be a real boundary. Narrower clients receive explicit scopes. - No recoverable secrets in read models. Only the creation response returns a raw pairing credential; access listings expose metadata only.
- DPoP binding. Browser cookies, bearer tokens, and DPoP tokens share the scoped session model. DPoP binds tokens to a client proof key; an invalid proof must fail rather than fall back to bearer auth. Plain paired DPoP sessions renew in place so live sockets and Sharing & access rows stay stable; T3 Connect, CLI, and desktop sessions never self-renew so revoking/unlinking cuts them off.
- WebSocket tickets and per-RPC authorization. Bearer and DPoP clients mint short-lived tickets
over authenticated HTTP so long-lived tokens never appear in socket URLs. DPoP RPC tickets stay
proof-key bound at upgrade. A successful handshake grants no extra authority: every RPC declares
and checks its required scope in
RpcAuthorization.ts. - Secret references need
providers:manage. A request that names a secret for the server to read needsproviders:manageon top of its method's scope, whether the reference is saved in settings or used once, as in a secret request answered with a reference. Typed values need only the method's scope. Clients hide the secret provider picker from sessions without it. - Project scripts need
orchestration:operate. The host runs a saved project script itself, on worktree creation and on settle, so saving one needsorchestration:operateon top ofsettings:write, whether it arrives in a settings patch or a project update. - Backward-compatible scope evolution. Token exchange intersects requested scopes with the
pairing grant, dropping retired/unknown names and failing before consuming a link if none remain.
Stored grants are never expanded when scopes split. Auth responses preserve legacy
scopesalongside exactpermissionsso older clients and servers stay compatible.
- Guest links are not sessions. GuestShareService
issues HMAC tokens bound to one share in the thread projection—never
SessionStorerows—so no RPC, WebSocket, or MCP route can accept one. Closing, replacing, or archiving the share revokes every token. Guest routes also require T3 Connect to still serve the link's hostname (never rely on the requestHostheader alone). - MCP clients (
mcp-client) are a separate audience. Outside agents authenticate on/mcpvia PKCE OAuth (McpOAuth), with stateless client registration so unauthenticated callers cannot grow server state. Users grant read-only access or a runtime-mode ceiling rather than raw scopes. Every non-/mcpHTTP and WebSocket route rejectsmcp-clientsessions (except the read-only thread relay and client-pairing routes restricted to peer links). Every MCP tool must statically declare its access level inMcpToolAccess.ts, and thread-only tools must still refuse outside callers in handlers—hiding from tool listings is only discovery. A workflow run picks its own modes, so only a caller at the broadest mode a thread may run in here (full access, or an administrator's ceiling below it) can start or change runs, change what workflows store, or read webhook paths. Narrower callers can still read runs. - A project's worktree layout commands run only as a person approved them. The commands come
from the project folder's
t3.jsonand run as the server's OS user, so each runs only after a client session holdingterminal:operateapproved its exact text for that project.TaskFoldersis the only place they run and checks the approval, managed policy, and who asked at every run. Recording an approval is a client RPC only:t3code/no-layout-command-approval-writeskeeps the write side out of every other module, MCP tools included. For an agent's own worktree request, a thread below Full access gets neither these commands nor the project's setup script, approved or not. The asking thread's modes are read when each is about to run, a thread recorded above the administrator'smaxRuntimeModeis not in Full access, and neither is an asking thread that can no longer be read. A command that waited for another one's turn is checked again, who asked, file and approval, before it starts; one refused then ran nothing, so the project'sremovedoes not run for it either. - Peer-link client pairing. Only a full-access peer link may mint a one-time client pairing on
the linked environment (since full-access agents can already run
t3 auth pairing create). The linked side enforces this itself, and the operation stays a human-triggered RPC/HTTP route rather than an MCP tool. The same route mints a code that links another environment at a chosen access level, and the linking side's RPC requires the caller to hold that level's scopes.
Web development servers can accept a fixed T3CODE_DEV_AUTH_TOKEN across worktrees and ports on one
hostname (see the development runbook). It
grants administrative access and is ignored by desktop and non-development servers.
Each environment hashes the value into its own database record and keeps independent SQLite state, signing keys, and revocation state. Normal credentials always take precedence: a rejected normal credential never falls back to the reusable dev credential.
Projects are organizational boundaries, not filesystem sandboxes. filesystem:read permits reading
any file the server's OS user can read (for example, artifacts an agent writes in a temp directory);
relative paths and writes remain constrained by
WorkspaceFileSystem.ts.
Signed asset URLs are bearer credentials for a single canonical file, rechecked by device/inode
identity on serve (AssetAccess.ts). They never
grant access to sibling files, and because filesystem:read is checked only at mint time, an issued
URL remains valid until it expires even if the session or grant is revoked.