Repository navigation
fix(tlon): never treat group DM authors as the owner - #165801
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR prevents unverified Tlon group-DM author claims from gaining ship privileges and preserves that restriction through approval replay. Example: A club member sends a message claiming author ~nec, the configured owner.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a privilege bypass still present on main and in v2026.10.2; the reviewed patch has no actionable introduced defects. Priority: P0 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Tlon plugin receives Urbit chat events, resolves sender access, persists pending approvals, and passes admitted messages into Gateway command and agent execution. flowchart TD
A[Urbit chat events] --> B[Tlon sender classification]
B --> C[Ingress authorization]
C --> D[Pending approval store]
D --> B
C --> E[Gateway commands and agent]
E --> F[Tlon replies and tool effects]
Technical reviewBest possible solution: Land the scoped privilege fix with the accepted resend behavior while retaining ordinary club delivery within its documented limits. Do we have a high-confidence way to reproduce the issue? Main and v2026.10.2 visibly route a non-ship chat conversation through its claimed author into owner checks; the supplied Gateway probes exercise forged club claims and authenticated controls. Is this the best way to solve the issue? The patch fixes identity at the Tlon boundary, carries it through replay, and prevents name-based privilege matching without introducing a competing core authorization owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e3ec1f2eeaf6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +120, Tests +427, Docs +10. Total +557 across 9 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (12 earlier review cycles; latest 8 shown)
Reviewed October 12, 2026, 5:59 PM ET / 21:59 UTC (Revision 13). |
|
Maintainer decision on the upgrade tradeoff: accepted. I accept the one-time resend policy for all markerless pending DM approvals (requests saved before this change, without the new
This is a one-time cost at upgrade. Requests created after this change carry provenance and replay normally: verified 1:1 DMs replay as the ship, and group DM requests replay only with the club-scoped, non-owner identity. The live runs in the PR body show approval with the resend notice, a successful resend, and a verified DM replaying after restart. |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Group DM (club) events identify the conversation, not the sender, so the author field is whatever the sending ship wrote. Stop letting that claim reach owner approval/admin handlers, owner command authorization, or the owner sender identity. 1:1 DMs and group channels are unchanged.
A group DM (club) claim that queued a DM approval was replayed after approval as the plain claimed ship, so it could match per-ship command, owner, or elevated allowlists. Carry the club id on the pending approval, replay with the club-scoped non-owner identity, keep club claims from merging into verified 1:1 requests, label club approvals as unverified, and document that owner actions need a 1:1 DM.
Pending DM approvals saved before group DM provenance existed cannot be told apart from unverified group DM claims. Record verified 1:1 DM provenance on new requests and stop replaying stored messages without it; approval still allowlists the ship. Also give group DM senders the club-scoped identity as their display name so name-based elevated allowlist entries cannot match an unverified claim.
Approving a DM request saved before sender provenance existed allowlists the ship but deliberately does not replay its stored message. Say so in the approval confirmation so the owner asks the sender to resend, and cover old and new persisted approval records at settings load.
Merge recordSummary: Closes a Tlon privilege escalation where any group DM (club) member could forge the message Decision Reason for Merge: ClawSweeper's final review reported no findings and no before-merge blockers ("ready for maintainer look"), the maintainer's recorded acceptance (#165801 (comment)) covers the only behavioral tradeoff, and all required checks passed on the final head. Compatibility Checks Done: Full CI green on the final head, including the channel-runtime-boundary quality lane and the ci-gate summary. Locally: tlon test suites (304 tests), |
* fix(tlon): never treat group DM authors as the owner Group DM (club) events identify the conversation, not the sender, so the author field is whatever the sending ship wrote. Stop letting that claim reach owner approval/admin handlers, owner command authorization, or the owner sender identity. 1:1 DMs and group channels are unchanged. * fix(tlon): keep group DM identity through approval replay A group DM (club) claim that queued a DM approval was replayed after approval as the plain claimed ship, so it could match per-ship command, owner, or elevated allowlists. Carry the club id on the pending approval, replay with the club-scoped non-owner identity, keep club claims from merging into verified 1:1 requests, label club approvals as unverified, and document that owner actions need a 1:1 DM. * fix(tlon): close legacy approval replay and name matching for group DMs Pending DM approvals saved before group DM provenance existed cannot be told apart from unverified group DM claims. Record verified 1:1 DM provenance on new requests and stop replaying stored messages without it; approval still allowlists the ship. Also give group DM senders the club-scoped identity as their display name so name-based elevated allowlist entries cannot match an unverified claim. * fix(tlon): tell the owner when a pre-upgrade DM request must be resent Approving a DM request saved before sender provenance existed allowlists the ship but deliberately does not replay its stored message. Say so in the approval confirmation so the owner asks the sender to resend, and cover old and new persisted approval records at settings load. * fix(tlon): make the club approval replay explanation conditional * style(tlon): format the approval notice test (cherry picked from commit 0538c07)
* fix(tlon): never treat group DM authors as the owner Group DM (club) events identify the conversation, not the sender, so the author field is whatever the sending ship wrote. Stop letting that claim reach owner approval/admin handlers, owner command authorization, or the owner sender identity. 1:1 DMs and group channels are unchanged. * fix(tlon): keep group DM identity through approval replay A group DM (club) claim that queued a DM approval was replayed after approval as the plain claimed ship, so it could match per-ship command, owner, or elevated allowlists. Carry the club id on the pending approval, replay with the club-scoped non-owner identity, keep club claims from merging into verified 1:1 requests, label club approvals as unverified, and document that owner actions need a 1:1 DM. * fix(tlon): close legacy approval replay and name matching for group DMs Pending DM approvals saved before group DM provenance existed cannot be told apart from unverified group DM claims. Record verified 1:1 DM provenance on new requests and stop replaying stored messages without it; approval still allowlists the ship. Also give group DM senders the club-scoped identity as their display name so name-based elevated allowlist entries cannot match an unverified claim. * fix(tlon): tell the owner when a pre-upgrade DM request must be resent Approving a DM request saved before sender provenance existed allowlists the ship but deliberately does not replay its stored message. Say so in the approval confirmation so the owner asks the sender to resend, and cover old and new persisted approval records at settings load. * fix(tlon): make the club approval replay explanation conditional * style(tlon): format the approval notice test
* fix(tlon): never treat group DM authors as the owner Group DM (club) events identify the conversation, not the sender, so the author field is whatever the sending ship wrote. Stop letting that claim reach owner approval/admin handlers, owner command authorization, or the owner sender identity. 1:1 DMs and group channels are unchanged. * fix(tlon): keep group DM identity through approval replay A group DM (club) claim that queued a DM approval was replayed after approval as the plain claimed ship, so it could match per-ship command, owner, or elevated allowlists. Carry the club id on the pending approval, replay with the club-scoped non-owner identity, keep club claims from merging into verified 1:1 requests, label club approvals as unverified, and document that owner actions need a 1:1 DM. * fix(tlon): close legacy approval replay and name matching for group DMs Pending DM approvals saved before group DM provenance existed cannot be told apart from unverified group DM claims. Record verified 1:1 DM provenance on new requests and stop replaying stored messages without it; approval still allowlists the ship. Also give group DM senders the club-scoped identity as their display name so name-based elevated allowlist entries cannot match an unverified claim. * fix(tlon): tell the owner when a pre-upgrade DM request must be resent Approving a DM request saved before sender provenance existed allowlists the ship but deliberately does not replay its stored message. Say so in the approval confirmation so the owner asks the sender to resend, and cover old and new persisted approval records at settings load. * fix(tlon): make the club approval replay explanation conditional * style(tlon): format the approval notice test (cherry picked from commit 0538c07) Backport adaptation: release branch reads effectiveOwnerShip/effectiveDmAllowlist as monitor locals instead of settingsState fields.
* fix(tlon): never treat group DM authors as the owner Group DM (club) events identify the conversation, not the sender, so the author field is whatever the sending ship wrote. Stop letting that claim reach owner approval/admin handlers, owner command authorization, or the owner sender identity. 1:1 DMs and group channels are unchanged. * fix(tlon): keep group DM identity through approval replay A group DM (club) claim that queued a DM approval was replayed after approval as the plain claimed ship, so it could match per-ship command, owner, or elevated allowlists. Carry the club id on the pending approval, replay with the club-scoped non-owner identity, keep club claims from merging into verified 1:1 requests, label club approvals as unverified, and document that owner actions need a 1:1 DM. * fix(tlon): close legacy approval replay and name matching for group DMs Pending DM approvals saved before group DM provenance existed cannot be told apart from unverified group DM claims. Record verified 1:1 DM provenance on new requests and stop replaying stored messages without it; approval still allowlists the ship. Also give group DM senders the club-scoped identity as their display name so name-based elevated allowlist entries cannot match an unverified claim. * fix(tlon): tell the owner when a pre-upgrade DM request must be resent Approving a DM request saved before sender provenance existed allowlists the ship but deliberately does not replay its stored message. Say so in the approval confirmation so the owner asks the sender to resend, and cover old and new persisted approval records at settings load. * fix(tlon): make the club approval replay explanation conditional * style(tlon): format the approval notice test (cherry picked from commit 0538c07) Co-authored-by: RomneyDa <[email protected]>
Summary
In Tlon group DMs (clubs), the bot took the message's
authorfield as the sender, and any member of the group can write that field. A member who set it to the operator'sownerShipwas treated as the owner: they got the owner approval and admin replies and owner-only commands such as/restart, plus/configand/bashwhen those are enabled. This change makes group DM messages never count as the owner or as the claimed ship, including when an approved request is replayed later. Group channels behave exactly as before. 1:1 DMs also behave as before, with one exception: DM requests that were already pending approval when the bot is upgraded lose their saved message (see Known limitations). There are no related open PRs.What Problem This Solves
The sender comes from an unverified field. In
extensions/tlon/src/monitor/index.ts, the chat firehose handler setssenderShip = partnerShip || authorShip. For a 1:1 DM,whomis the partner ship. For a club,whomis the club ID, soextractDmPartnerShip(extensions/tlon/src/monitor/utils.ts) returns""and the sender becomesessay.author. Tlon'schatagent does not tie club message authors to the actual sending ship (group channels do).That value reaches the owner checks.
isOwner(senderShip)gateshandleApprovalResponseandhandleAdminCommand, selects the owner-only DM allowlist (allowFrom: [senderShip]), and setsSenderRole: "owner".It also reaches core authorization.
sender.idandFromcarrysenderShip, sosrc/auto-reply/command-auth.tsmatches it againstcommands.ownerAllowFromandcommands.allowFrom, andtools.elevated.allowFrommatches the sameSenderId.Approval replay restored the plain identity. A club claim of a ship that isn't on
dmAllowlistqueued a DM approval with the message attached. After approval,processApprovedMessagereplayed it as the plain claimed ship, so it could match per-ship owner, command, or elevated entries.Names and stored requests also carried the claim.
sender.namestayed the claimed ship, so aname:entry intools.elevated.allowFromcould match it. DM requests already saved before an upgrade carry no record of where they came from, so a stored group DM claim would still replay as the plain ship.Net effect: anyone in a group DM with the bot could act as the Gateway owner, or as any other ship.
Why this design
whomis not a ship. That is the same check that already decides DM routing, and anything that isn't a valid DM partner fails closed as a club.SenderRoleis alwaysuser.club:<club-id>:<claimed-author>, used for ingress, command authorization,sender.id,sender.name, andFrom. It can never matchcommands.ownerAllowFrom,commands.allowFrom,tools.elevated.allowFrom(includingname:entries), or a channel owner entry.dmAllowlist, but its message is not replayed. The approval confirmation tells the owner the message was not processed and asks them to have the sender send it again.dmAllowlistis still admitted and still gets a private reply, as an ordinary user. Session routing and reply targets are unchanged.Evidence
pending(admin command)approve <id>dmAllowlistsender.id= owner ship,SenderRole: owner, command-authorizedsender.id=club:<id>:<ship>,SenderRole: user,CommandAuthorized: falsedmAllowlist, then owner approvesclub:<id>:<ship>,SenderRole: user,CommandAuthorized: falsetools.elevated.allowFromhasname:<claimed ship>sender.namematchessender.name=club:<id>:<ship>; no matchwhommissing / object without ship / non-ship stringclub:...dmAllowlistwhom= owner ship)Each fix commit's new tests fail on the commit before it: 4 on the original base, 2 replay/storage tests on the first fix, 4 provenance/name tests on the second, and the resend-notice test on the third. On this head, all pass.
Live run (built gateway, head
45ea335). A gateway built from this branch ran isolated on loopback against a scratch Eyre stand-in that speaks the real login/scry/channel/SSE protocol (not committed). Config:ownerShip: ~nec,commands.ownerAllowFrom: [~nec, ~wes, ~lur],dmAllowlist: [~bus], plus one pre-upgrade pending DM approval for~busseeded into the settings store. Events were injected on the realchat/v3subscription; outcomes are the gateway's own pokes back to the ship and its log lines (redacted).Live probe results
/whoami(control)~nec:User id: ~nec,AllowFrom: ~nec~nec,/whoami~nec,pending(admin)~bus(allowlisted),/whoamiCommand attempt denied: ~bus is not owner; no identity reply~wes(inownerAllowFrom, not allowlisted)~wesallowlisted; replay loggedCommand attempt denied: ~wes is not ownerdespite~wesbeing inownerAllowFrom~busallowlisted; logNot replaying pre-upgrade DM request from ~bus; owner told "…was not processed. Ask ~bus to send it again."pending(control)Not covered live: ordinary agent replies (no model credentials in the scratch gateway, so turns completed with no reply payload),
name:elevated entries (covered by unit tests), and a real Urbit ship.Live run 2: elevated tool gate (built gateway, head
45ea335). Same isolated setup, plus a scratch OpenAI-compatible model stub that always asks the realexectool forelevated: truewith a command that writes a marker file. A marker file appearing is the side effect; no marker means exec refused before running anything. Config:tools.elevated.enabled: true,tools.elevated.allowFrom.tlon: [~nec, ~bus, name:~lur, ~wes, ~pod, ~mar],dmAllowlist: [~bus, ~lur],ownerShip: ~nec. The Urbit stand-in persists settings to disk, and the gateway was restarted between the queue and approve phases, so replays below come from approvals reloaded from the settings store (Loaded 4 pending approval(s) from settings).Elevated probe results
~nec1:1 (control, ID match)~bus1:1 (control, ID match)~lur1:1 (control,name:~lurmatch only)~bus(allowlisted, ID match)elevated is not available right now … Failing gates: allowFrom (tools.elevated.allowFrom…); no marker~lur(allowlisted,name:match only)~nec→ restart → owner approves~wes(ID in elevated list, not allowlisted) → restart → owner approvesallowFromgate; no marker~pod1:1 (ID in elevated list, not allowlisted) → restart → owner approves~marrequest → owner approves~marresends in 1:1The stub model's text replies are generic; the marker files and the
[tools] exec failed: elevated is not availablelog lines are the evidence.Known limitations
dmAllowlistship and get ordinary agent replies: no owner, command, or elevated authority. Those replies go by DM to the claimed ship, and the turn lands in that ship's DM session as auserturn (with the defaultdmScope: main, the shared session already in use). This PR keeps that existing behavior to avoid breaking group DMs. Fully closing it needs either dropping club messages or real club support, both product decisions. A durable fix would be Tlon binding club writ authors to the sending ship, as group channels already do.dmAllowlist, but the saved message is never processed; the owner is told to ask the sender to send it again. This also applies to genuine 1:1 requests that were pending at upgrade time. It is a one-time effect: every request created after the upgrade records its origin and replays normally. Keeping the old replay would let a forged group DM claim pending at upgrade time replay as the claimed ship.SDK / caller upgrade contract
PendingApprovalinextensions/tlon/src/settings.ts). Two optional fields are added (clubId,verifiedDirect); no existing field changes shape or meaning.extensions/tlon/src/settings.test.tscovers pre-upgrade, current, club, and malformed records through the real settings-load parser).Testing
extensions/tlon/src/monitor/index.club-sender.test.ts(15 tests): forged-owner admin, forged-owner approval, forged-owner identity/name/role/command auth, allowlisted club user, approved club claim replays with club identity, club owner claim not stored for replay, three malformed-whomcases (also asserting the owner ship never reaches ingress), pre-upgrade vs verified stored DM approvals, provenance recorded on new requests, owner 1:1 DM identity, owner 1:1 DM admin command. Plus oneapproval-runtime.test.tscase (provenance follows the stored message when a request is updated), onesettings.test.tscase (pre-upgrade, current, club, and malformed approval records through the real settings-load parser), and oneapproval.test.tscase (the club approval notice says the message is answered only when it was stored for replay, and otherwise tells the owner a fresh verified DM is needed).pnpm exec vitest run extensions/tlon: 40 files, 390 tests passed.pnpm tsgo:extensionsandpnpm tsgo:extensions:testpass;pnpm check:assertion-safety --base upstream/mainpasses; oxfmt and oxlint clean on the touched files.docs/channels/tlon.mdnow states that owner commands and approvals only work in a 1:1 DM, and that pre-upgrade DM requests are approvable but not replayed.