Skip to content

fix(channels): declare verified sender identity for Nostr, Buzz, Twitch and ClickClack - #205184

Merged
obviyus merged 1 commit into
mainfrom
fix/oa2-channel-verified-2
Nov 25, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/oa2-channel-verified-2

Conversation

@obviyus

@obviyus obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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 fix(channels): declare verified sender identity where the transport proves it #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.

…ch and ClickClack

Each plugin's identity declaration moves into its own ingress-identity.ts, used by the transport,
and declares `verified`: Nostr and Buzz drop events whose signature does not verify against the
sender pubkey, Twitch sets the user-id tag on the authenticated chat connection, and ClickClack
reads the author from the server's copy of the message. Owner cells added.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: nostr Channel integration: nostr gateway Gateway runtime channel: twitch Channel integration: twitch channel: buzz extensions: clickclack size: M labels Nov 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. labels Nov 25, 2026
@obviyus

obviyus commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Pre-push on 67ef7fb402ee (local):

  • ocx test (one call, OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1): all of extensions/{nostr,buzz,twitch,clickclack} (87 files, a superset of the importers of the changed transports), test/channel-verified-owner.integration.test.ts, test/twitch-message-tool-delivery.test.ts, test/buzz-account-config-mutation.test.ts.
    • Owner cells 14/14. All Twitch and ClickClack files pass.
    • Nostr/Buzz reds: all have the same cause, and none touch the changed code. Hex strings arrive mangled at runtime on this host (Cannot convert 0x01234567O9QbSdUf… to a BigInt, can't serialize event; these break key derivation in test-fixtures.ts/buzz-bus* setup). The same reds show on the merge base ca58e63b688c (nostr/channel.test.ts 3, nostr/session-route.test.ts 1, buzz/mentions.test.ts 3, identical cases). fix(channels): declare verified sender identity where the transport proves it #205155 recorded the same buzz-bus* base reds. Hosted CI decides these files.
  • Red check: with the four declarations set back to asserted, the 5 new cells fail (expected undefined to be 'gateway-owner').
  • pnpm check:changed: typecheck extensions, extension tests and test root, lint, format, plugin boundaries, extension-test core imports and runtime import cycles all pass. Two reds are not from this diff: the dead-export scan lists only src/ participation exports this PR does not touch, and changelog attributions flags CHANGELOG/2026.11.10.md:8130.
  • oxfmt / oxlint on changed files: clean.

@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Head 67ef7fb402ee evidence:

  • One-admission E2E (isolated Gateway, real agent turn): Q queued input refused visibly ✅, R running turn finishes ✅, S Stop cancels ✅ (verdict.json pass: true; results.jsonl kept with the run).
  • Local ClawSweeper review: complete, "patch is correct", 0 findings.

@obviyus
obviyus merged commit cc4a167 into main Nov 25, 2026
111 checks passed
@obviyus
obviyus deleted the fix/oa2-channel-verified-2 branch November 25, 2026 07:41
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as cc4a167. Owners listed in commands.ownerAllowFrom on Nostr, Buzz, Twitch and ClickClack now get the same grant as in the Control UI. Each plugin's transport proves the sender, and its declaration now says verified. Proof: owner cells 14/14 (the 5 new ones fail with asserted), one-admission E2E Q/R/S pass, local review clean, CI green on the exact head.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
…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]>
tideclaw-bot added a commit that referenced this pull request Nov 30, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: buzz channel: nostr Channel integration: nostr channel: twitch Channel integration: twitch docs Improvements or additions to documentation extensions: clickclack gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. P2 Normal backlog priority with limited blast radius. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant