Repository navigation
Conversation
One server per machine serves several people, each with their own workspace, instead of one server and port per person. Covers principals bound to the pairing subject, owner-stamped threads and projects, fail-closed RPC and HTTP surfaces, per-principal execution (recommends a per-user runner over one OS user with per-principal HOMEs), peer links per principal, migration, the threat model including pingdotgg#26490, and a C2 outline for groups. Also adds an unposted draft reply for Ideas pingdotgg#12283.
A pairing grant or session issued with --principal <id> carries subject principal:<id>. Threads that session creates are stamped with ownerPrincipal, and shell, thread, history and dispatch paths over WebSocket and HTTP only show or act on threads the caller's principal owns. Other threads fail as not found. Principals are capped at orchestration scopes, may call only an allowlist of RPCs, and every other scoped HTTP, raw and media route fails closed for them. Existing subjects map to the default "owner" principal, so single-user state and behavior are unchanged. Projects, MCP tool reads and per-principal execution are not covered yet; see docs/internals/multi-user.md.
Upstream's CI needs Blacksmith runners, so the fork gets one hosted job that typechecks and runs the contracts and server suites on pull requests.
…threads Agents reading or changing a thread through MCP now pass the same visibility check as clients: an agent acts as its thread's owner, and an outside MCP client as the default principal. Principals can launch threads; the launch is stamped with the caller's principal and a reused thread must be visible. The older-settled page filters by owner before its limit, so a hidden row no longer ends a principal's pagination early.
t3_thread_list and t3_thread_search now filter by the calling thread's owner before pagination and the hit limit, so a principal's agent sees neither the other principals' threads nor short pages. Threads an agent launches through t3_thread_launch inherit its owner.
Principals could not search their own threads because searchThread and searchThreadStream were missing from the principal RPC allowlist. Both now check thread visibility first. t3_thread_wait and the other tools that resolve a target through loadScopedThread skipped the ownership check; they now fail with thread_not_found for another principal's thread.
A shared server needs to know which person a client is without handing out pairing links by hand. With T3CODE_OIDC_ISSUER set, the server is a confidential OIDC client: /auth/oidc/start runs the authorization-code flow with PKCE, state and nonce, and /auth/oidc/callback verifies the ID token against the issuer's JWKS, requires the allowed group and takes the principal from preferred_username. The web client gets a principal browser session; the desktop app gets a two-minute principal pairing link through the existing t3code://pair deep link. The auth descriptor advertises oidcSignIn so clients can offer the button.
Principals now arrive through OIDC sign-in and must be able to use the app normally, so the prototype's owner-only filter and RPC allowlist were too tight. canAccessThread(principal, thread, read|write) is now the one rule every WS, HTTP, MCP and search path asks; the server's default owner principal sees every thread. Principal scopes cover orchestration, providers, terminals, source control and files, and a short deny-list keeps server-wide reads under those scopes (storage reports, agent session import, ACP registry, webhook delivery) for the owner only.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4836605e0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const found = yield* threadManagement.getThreadRecords(threadId, []).pipe(Effect.option); | ||
| return Option.isSome(found) && canAccessThread(principal, found.value.thread, action); |
There was a problem hiding this comment.
Gate the remaining thread-scoped RPCs
A principal with orchestration:operate can still call worktreeSetupCancel directly, and assetsCreateUrl can mint a signed URL for a tool-output-image using another thread's IDs without checking ownership. A principal who knows those IDs can cancel another user's setup or read its tool output; apply the visibility check to these auxiliary handlers too.
Useful? React with 👍 / 👎.
| pending.set(state, { | ||
| nonce, | ||
| verifier, | ||
| client: input.client, | ||
| origin: input.origin, | ||
| expiresAt: now + LOGIN_TTL_MS, |
There was a problem hiding this comment.
Bind OIDC state to the initiating browser
If an allowed user gives someone their callback URL before it is consumed, the process-wide pending entry lets that other browser complete the flow: the callback checks only state, while the PKCE verifier and nonce are also stored server-side. The victim can therefore be signed into the attacker's principal, causing subsequent prompts to land in an account the attacker can read; bind the state to the browser that started sign-in and require that binding at callback.
Useful? React with 👍 / 👎.
| WS_METHODS.scheduledTasksListWebhookDeliveries, | ||
| WS_METHODS.scheduledTasksGetWebhookDelivery, |
There was a problem hiding this comment.
Restrict global scheduled-task RPCs for principals
The principal-specific denylist blocks only delivery-log calls here, but scheduledTasksSubscribe is read-scoped and principals hold that scope; its shared service returns every task. Principals also hold the operate scope required by the upsert, disable, delete, run, and token-rotation RPCs, which act on task IDs without owner filtering. A signed-in principal can therefore read another user's prompts and webhook URLs, then mutate or trigger their scheduled agents; deny this RPC family to principals or scope task reads and mutations by principal.
Useful? React with 👍 / 👎.
requireThreadAccess read the thread on every request, even for the default principal that can reach every thread. That added a store read to the owner's snapshot path and failed the bounded snapshot transport tests, whose stub ThreadManagementService has no getThreadRecords.
…roles People on a shared server need to bring each other into their work without seeing everything. A thread owner can share a thread with a principal, and a group owner can put their threads in a named session group and invite members, each as viewer (read) or participant (read and write). canAccessThread stays the one rule and now takes the caller's grants; the older-settled SQL filter includes shared and group threads. Messages a participant sends carry a server-stamped senderPrincipal while the thread, and so its turns, stay the owner's. Exposed as sessionAccess.list/threadShares/mutate RPCs and `t3 group` / `t3 share`.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e872c55e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
| } | ||
| yield* assertThreadOwnedByCallerPrincipal( | ||
| parent?.thread.ownerPrincipal ?? DEFAULT_PRINCIPAL_ID, |
There was a problem hiding this comment.
Scope owner-thread MCP reads to owner-owned threads
When an MCP tool runs from an owner-owned thread, its ownerPrincipal is omitted, so this fallback passes DEFAULT_PRINCIPAL_ID to assertThreadOwnedByCallerPrincipal; canAccessThread treats that principal as an unrestricted admin. The agent can therefore use t3_thread_read and other cross-thread tools to access any principal’s private threads, contrary to the MCP isolation described in docs/internals/multi-user.md. Use an owner-only visibility check for thread-bound MCP callers instead of the admin bypass.
Useful? React with 👍 / 👎.
| whenThreadsVisible( | ||
| [input.threadId], | ||
| () => threadNotFound(input.threadId), | ||
| subscribeOrchestrationV2Thread(input), |
There was a problem hiding this comment.
Filter raw events before streaming to viewer grants
When a principal has only a viewer grant, this read check admits them and then returns the unfiltered subscribeOrchestrationV2Thread stream, which replays stored event payloads directly. That exposes raw thread events rather than the allowlisted projection required for group viewers by docs/internals/multi-user.md; apply the safe projection before streaming shared threads.
Useful? React with 👍 / 👎.
| }); | ||
| }), | ||
| ), | ||
| "write", |
There was a problem hiding this comment.
Restrict participant dispatch to collaboration actions
When an owner grants participant, this gate authorizes every existing-thread command as a write, not just the collaboration actions described for participants. A participant can submit checkpoint.rollback (which restores files by default) or thread.metadata.update against the shared thread, changing the owner's workspace or thread state; restrict dispatch by command type or keep those mutations owner-only.
Useful? React with 👍 / 👎.
| ); | ||
| return { | ||
| ...result, | ||
| matches: result.matches.filter((_, index) => visible[index]), |
There was a problem hiding this comment.
Filter principal search results before applying the limit
For a principal search, this filters only after the search has capped its results; if the first 50 hits belong to inaccessible threads, they are dropped without refilling the response, so matches in the caller's own or shared threads disappear. Apply thread visibility before ranking and limiting search results.
Useful? React with 👍 / 👎.
| const state = random(); | ||
| const verifier = random(); | ||
| const nonce = random(); | ||
| pending.set(state, { |
There was a problem hiding this comment.
Rate-limit unauthenticated OIDC login starts
On an OIDC-enabled server reachable at a configured public origin, /auth/oidc/start is unauthenticated and each request inserts a pending login here. A network caller can issue 1,000 starts to fill this process-wide map, after which legitimate starts are rejected until entries expire; repeated requests can keep the pool full. Throttle admissions so one caller cannot exhaust the global login pool.
Useful? React with 👍 / 👎.
| readonly oidcPrincipalClaim: string; | ||
| readonly oidcPublicOrigins: ReadonlyArray<string>; | ||
| }) { | ||
| const issuer = env.oidcIssuer?.trim().replace(/\/+$/, ""); |
There was a problem hiding this comment.
Preserve the configured OIDC issuer identifier
When T3CODE_OIDC_ISSUER contains a valid trailing slash, this normalization removes it before discovery, then OidcLogin.discover rejects providers whose metadata issuer retains that slash because it compares the identifiers exactly. Keep the original issuer for metadata validation and normalize separately when constructing the discovery URL.
Useful? React with 👍 / 👎.
|
Note 🤖 Claude Opus 5.5 responding on behalf of caniko Closing #1–#4 as superseded by #6, which rebased all 26 of their commits onto the 20261104 nightly and merged them into Access control (from #1, #2, #4)
OIDC (from #2)
Runner (from #3)
Web (from #4)
|
|
Note 🤖 Claude Opus 5.5 responding on behalf of caniko Superseded by #6, which rebased these commits onto the 20261104 nightly and merged them into |
Fork-only. Rebases the principals prototype (#1) onto v0.1.7-nightly.20261102.4066 and adds:
/auth/oidc/start,/auth/oidc/callback). The server is a confidential client of Kanidm, using code flow with PKCE, state and nonce. It verifies the ID token against JWKS, requirest3code_users, and takes the principal frompreferred_username. Web gets a principal browser session; desktop gets a 2-minute pairing link viat3code://pair. Configured throughT3CODE_OIDC_*env.canAccessThread(principal, thread, read|write)) used by WS, HTTP, MCP and search. The default owner principal sees everything. Principal scopes allow normal app use, and a short deny-list keeps server-wide reads owner-only.Not yet: session groups and invites, the per-user runner, the UI, and per-principal peer-link storage on the linking side.
Known CI-irrelevant local failures: 7 tests whose temp-repo
git commitfails under the operator's global hooks (also on the untouched tree).Supersedes #1.
Council review
Rounds: 1 (question: close as superseded by #6)
🤖 Generated with Claude Code