Repository navigation
fix(channels): declare verified sender identity where the transport proves it - #205155
Conversation
…roves it Signal, WhatsApp, Matrix, Microsoft Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal and Synology Chat authenticate the sender id on the transport, so a configured owner there gets the owner grant. Channels that cannot prove the sender keep owner-only tools; their github_publish refusal now says the channel cannot confirm who you are and where to go instead. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
|
Pre-push evidence (head
|
The owner cells import plugin internals only through each plugin's test-api.ts, the boundary core tests may use. Drops an await on the synchronous context builder. Co-authored-by: obviyus <[email protected]>
|
Round 2 (head
|
|
Landed as 5dcff59. Owners in |
…ch and ClickClack (#205184) ## Problem Follow-up to #205155 (OA2 D23). Since #204904, a sender listed in `commands.ownerAllowFrom` on a channel that declares its sender id `verified` is the Gateway owner, with the same grant as the owner's Control UI turn (operator tools, `github_publish`, PR actions). Nostr, Buzz, Twitch and ClickClack prove the sender, but still used the default `asserted`. An owner on those channels kept owner-only tools but got no operator grant, so `github_publish` told them "This channel cannot confirm who you are … use Control UI, Discord or Telegram". #205155 left them out only because their declarations sat inside transport loops, where an owner cell could not run them without a test-only export. ## Fix Each plugin's identity declaration moves, unchanged, into its own `src/ingress-identity.ts`, which the transport imports, and declares `authentication: "verified"`. No core change. | Channel | Why the sender id is proven (checked in the transport) | |---|---| | Nostr | `nostr-bus.ts` runs `verifyEvent` (canonical hash + Schnorr signature against `event.pubkey`) on every DM before sender policy and decryption; invalid signatures are dropped as permanent errors. The sender id is `event.pubkey`. | | Buzz | The relay client is `nostr-tools` `Relay`, which runs `verifyEvent` on every `EVENT` before `onevent` (`relay.js` in 2.25.4, the pinned version); failing events go to `oninvalidevent`. The connection is NIP-42 authenticated and messages are admitted only from room members. The sender id is `event.pubkey`. | | Twitch | `twitch-client.ts` reads `msg.userInfo.userId`, the `user-id` tag Twitch's server sets on each message delivered over the OAuth-authenticated chat connection; clients cannot set server tags. Both the allowlist and the role identity use it as the primary id; role aliases stay `asserted` (roles are not a person). | | ClickClack | `gateway.ts` treats the pushed event as a routing hint and re-fetches the message from the server API with the bot token; `author_id` comes from the server's own copy. | Files: `extensions/{nostr,buzz,twitch,clickclack}/src/ingress-identity.ts` (new, holds the moved declaration and its normalizers); the transports import it; each plugin gets a one-line `test-api.ts` (same pattern as #205155). Docs: `gateway/config-channels/commands.md` adds the four channels to the list that proves the sender. ## Decisions (recorded, not asked) - **Production lines are not net negative** (+16: four `authentication` lines, their reasons, and the new modules' imports/exports). The declarations themselves move unchanged; the behavior is the requested one, and there is nothing in these paths to cut. - **Relay trust for Nostr/Buzz is cryptographic**, not transport-level: a relay cannot forge a signature for another pubkey. Accepted edge, no code: a Twitch or ClickClack server the operator points the plugin at is trusted to report the sender, the same as Telegram's API root in #205155. ## User impact - An owner on Nostr, Buzz, Twitch or ClickClack gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as the other verified channels). - Other senders: no change. Allowlists, pairing and role policy are untouched. ## Evidence - **Owner cells** in `test/channel-verified-owner.integration.test.ts`: Nostr, Buzz, Twitch (allowlist policy), Twitch (role policy), ClickClack. Each runs the plugin's real declaration through the real host ingress and context builder with the real plugin registered, and asserts the owner profile with `operator.admin`. Head: 14/14. **With the four declarations set back to `asserted`: the 5 new cells fail** (`expected undefined to be 'gateway-owner'`), the 9 existing cells pass. - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…roves it (openclaw#205155) ## Problem An owner listed in `commands.ownerAllowFrom` got a different answer depending on the channel they wrote from (OA2 D23). - Since openclaw#204904, a configured owner on a channel that declares its sender id `verified` is the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions. - Only Discord, Telegram, Google Chat, Mattermost, X and native Slack declared `verified`. The other bundled channels used the default `asserted`, even where the platform authenticates the sender. - So an owner on Signal, WhatsApp, Matrix, Teams and others kept owner-only tools but got no operator grant: `github_publish` refused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were. ## Fix Each channel plugin declares what its transport proves. No core decision changes. **Now `verified`** (the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery): | Channel | Why the sender id is proven | |---|---| | WhatsApp | Baileys reads DM `remoteJid` / group `participant` from WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typed `phone`, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed. | | Signal | signal-cli reports `sourceNumber`/`sourceUuid` from the decrypted, sender-certified envelope; the daemon is the operator's own linked device. | | Matrix | `event.sender` comes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names. | | Microsoft Teams | The Teams SDK validates the Bot Framework JWT before dispatch (401 on bad signature or audience); the connector supplies `from.aadObjectId`/`from.id`. | | LINE | `X-Line-Signature` HMAC over the raw body is checked before the user id is read. | | Nextcloud Talk | The bot webhook HMAC (bot secret) is checked before the actor id is read. | | Zalo | Bot API updates arrive on the secret-token webhook or token-authenticated polling. | | Zalo Personal | `uidFrom` arrives on the authenticated Zalo session, not from message content. | | Synology Chat | The NAS sends `user_id` on the token-checked outgoing webhook. | **Stays `asserted`:** | Channel | Why | |---|---| | iMessage | The same `imsg` watch also delivers SMS (spoofable caller id), and rows carry no validated service field. | | SMS | Twilio signs the webhook, not the originating number. | | IRC | Server prefixes prove no account. | | Tlon | Club authors are explicitly unverified; group authors come from content. | | Slack relay | The relay authenticates the router, not each Slack event. Native Socket Mode / HTTP Events (the default) were already `verified` per event (openclaw#159694); unchanged here. | | A2A | The token authenticates a peer agent, not a person. | | Feishu | Its primary identifier is a plugin kind, not a stable id, so `verified` would not change the grant. | | QA channel | Synthetic test transport. | **Not in this PR (cut less), follow-up:** Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (`user-id` tag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into an `ingress-identity.ts` module. That move is a separate PR. **Refusal text.** Where a channel cannot prove the sender, the `github_publish` refusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (`github-publication-inspect.ts`, `github-publication-inspect-reader.ts`). **Docs:** `gateway/config-channels/commands.md` lists the channels that prove the sender. ## Decisions (recorded, not asked) - **Transport security is the operator's configuration**, as for Telegram's API root: a Signal daemon, a Matrix homeserver on a private network (plaintext is opt-in), or a Zalo API override reached over plaintext is the operator's choice. Accepted edge, named here, no code. The delta is small: an asserted owner already had owner-only tools (exec), which a forged transport would reach anyway. - **One refusal text for every no-identity case.** The inspect refusal cannot tell an asserted-channel owner from an unlinked sender or a source-less scheduled run; the second sentence covers the non-owner case. - **Declarations moved next to their normalizers** so the test can run the real declaration: LINE → `bot-access.ts`, Nextcloud Talk → `policy.ts`, Zalo → `group-access.ts`, Zalo Personal → `ingress.ts` (with its allowlist normalizer). The Zalo/Zalo Personal moves also keep `monitor.ts` under the line cap. - Production lines are not net negative: each channel adds its declaration and a one-line reason (requested behavior). ## User impact - An owner on WhatsApp, Signal, Matrix, Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal or Synology Chat gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as Discord/Telegram since openclaw#204904). - An owner on iMessage, SMS or IRC is told the channel cannot confirm who they are and where to go instead. ## Evidence - **Owner cell per channel** (`test/channel-verified-owner.integration.test.ts`, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile with `operator.admin`. Head 9/9. **Base (declarations `asserted`): all fail** (no operator authority). - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…ch and ClickClack (openclaw#205184) ## Problem Follow-up to openclaw#205155 (OA2 D23). Since openclaw#204904, a sender listed in `commands.ownerAllowFrom` on a channel that declares its sender id `verified` is the Gateway owner, with the same grant as the owner's Control UI turn (operator tools, `github_publish`, PR actions). Nostr, Buzz, Twitch and ClickClack prove the sender, but still used the default `asserted`. An owner on those channels kept owner-only tools but got no operator grant, so `github_publish` told them "This channel cannot confirm who you are … use Control UI, Discord or Telegram". openclaw#205155 left them out only because their declarations sat inside transport loops, where an owner cell could not run them without a test-only export. ## Fix Each plugin's identity declaration moves, unchanged, into its own `src/ingress-identity.ts`, which the transport imports, and declares `authentication: "verified"`. No core change. | Channel | Why the sender id is proven (checked in the transport) | |---|---| | Nostr | `nostr-bus.ts` runs `verifyEvent` (canonical hash + Schnorr signature against `event.pubkey`) on every DM before sender policy and decryption; invalid signatures are dropped as permanent errors. The sender id is `event.pubkey`. | | Buzz | The relay client is `nostr-tools` `Relay`, which runs `verifyEvent` on every `EVENT` before `onevent` (`relay.js` in 2.25.4, the pinned version); failing events go to `oninvalidevent`. The connection is NIP-42 authenticated and messages are admitted only from room members. The sender id is `event.pubkey`. | | Twitch | `twitch-client.ts` reads `msg.userInfo.userId`, the `user-id` tag Twitch's server sets on each message delivered over the OAuth-authenticated chat connection; clients cannot set server tags. Both the allowlist and the role identity use it as the primary id; role aliases stay `asserted` (roles are not a person). | | ClickClack | `gateway.ts` treats the pushed event as a routing hint and re-fetches the message from the server API with the bot token; `author_id` comes from the server's own copy. | Files: `extensions/{nostr,buzz,twitch,clickclack}/src/ingress-identity.ts` (new, holds the moved declaration and its normalizers); the transports import it; each plugin gets a one-line `test-api.ts` (same pattern as openclaw#205155). Docs: `gateway/config-channels/commands.md` adds the four channels to the list that proves the sender. ## Decisions (recorded, not asked) - **Production lines are not net negative** (+16: four `authentication` lines, their reasons, and the new modules' imports/exports). The declarations themselves move unchanged; the behavior is the requested one, and there is nothing in these paths to cut. - **Relay trust for Nostr/Buzz is cryptographic**, not transport-level: a relay cannot forge a signature for another pubkey. Accepted edge, no code: a Twitch or ClickClack server the operator points the plugin at is trusted to report the sender, the same as Telegram's API root in openclaw#205155. ## User impact - An owner on Nostr, Buzz, Twitch or ClickClack gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as the other verified channels). - Other senders: no change. Allowlists, pairing and role policy are untouched. ## Evidence - **Owner cells** in `test/channel-verified-owner.integration.test.ts`: Nostr, Buzz, Twitch (allowlist policy), Twitch (role policy), ClickClack. Each runs the plugin's real declaration through the real host ingress and context builder with the real plugin registered, and asserts the owner profile with `operator.admin`. Head: 14/14. **With the four declarations set back to `asserted`: the 5 new cells fail** (`expected undefined to be 'gateway-owner'`), the 9 existing cells pass. - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
Release adaptation: Select the existing turn authority as the requester source; retain stable invocation, workflow, and data fences. Companions: #205082 and #205173 affect automations, #205155 and #205184 affect channel trust, and #205232 affects reply dispatch; none is a prerequisite to selecting the already-admitted requester. (cherry picked from commit ddc8340) Co-authored-by: RomneyDa <[email protected]>
Problem
An owner listed in
commands.ownerAllowFromgot a different answer depending on the channel they wrote from (OA2 D23).verifiedis the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions.verified. The other bundled channels used the defaultasserted, even where the platform authenticates the sender.github_publishrefused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were.Fix
Each channel plugin declares what its transport proves. No core decision changes.
Now
verified(the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery):remoteJid/ groupparticipantfrom WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typedphone, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed.sourceNumber/sourceUuidfrom the decrypted, sender-certified envelope; the daemon is the operator's own linked device.event.sendercomes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names.from.aadObjectId/from.id.X-Line-SignatureHMAC over the raw body is checked before the user id is read.uidFromarrives on the authenticated Zalo session, not from message content.user_idon the token-checked outgoing webhook.Stays
asserted:imsgwatch also delivers SMS (spoofable caller id), and rows carry no validated service field.verifiedper event (#159694); unchanged here.verifiedwould not change the grant.Not in this PR (cut less), follow-up: Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (
user-idtag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into aningress-identity.tsmodule. That move is a separate PR.Refusal text. Where a channel cannot prove the sender, the
github_publishrefusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (github-publication-inspect.ts,github-publication-inspect-reader.ts).Docs:
gateway/config-channels/commands.mdlists the channels that prove the sender.Decisions (recorded, not asked)
bot-access.ts, Nextcloud Talk →policy.ts, Zalo →group-access.ts, Zalo Personal →ingress.ts(with its allowlist normalizer). The Zalo/Zalo Personal moves also keepmonitor.tsunder the line cap.User impact
github_publish, PR actions), with no Control UI step.Evidence
test/channel-verified-owner.integration.test.ts, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile withoperator.admin. Head 9/9. Base (declarationsasserted): all fail (no operator authority).