Skip to content

fix(channels): deny unauthorized Discord and Telegram binding access - #118704

Merged
steipete merged 2 commits into
mainfrom
codex/qa0803-discord-telegram-interactive-binding-auth
Aug 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/qa0803-discord-telegram-interactive-binding-auth

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Prevent unauthorized Discord and Telegram interactive callbacks from creating, reading, or detaching privileged conversation bindings.
  • Preserve ordinary plugin callback execution, all existing public plugin SDK contracts, and authenticated guild/forum/DM behavior.

Root cause and transport ownership

Both transports deliberately dispatch registered plugin callbacks even when isAuthorizedSender=false; existing channel integrations rely on this behavior. However, both transport owners also passed the privileged plugin registration root to the shipped generic conversation-binding helper. An unapproved Discord guild member or Telegram group user could therefore request an automatically approved binding, inspect it, and detach it despite being unauthorized.

Each existing transport owner now withholds only privileged binding authority unless its own authenticated sender, account, and conversation identity are present. The public callback, response behavior, shared external plugin SDK helper, channel routing, and Telegram topic identity remain unchanged. This exactly matches the already-landed Slack owner repair in #118662.

Actual registered-handler proof

Before repair, real registered Discord and Telegram handlers reached the actual shared binding owner and produced {"authorized":false,"handlerInvoked":true,"requestStatus":"bound","readReturnedBinding":true,"detachRemoved":true}.

After repair, both unauthorized transports still invoke their ordinary plugin handler but return request error/read null/detach false with zero privileged adapter reads or writes. Authorized Discord guild and Telegram forum/DM controls continue to bind/read/detach with their real canonical identities.

  • Existing actual registered ingress → dispatcher → generic helper → real binding owner → in-memory adapter: 5/5 passing, covering both false/true guild/group cases plus authorized DM.
  • Formatting, targeted lint, effective 1,000-line test limit, and git diff --check: clean.
  • Fresh independent structured Sol/high security review: no findings, confidence 0.94.
  • Production delta +14 lines, split equally across the two authoritative transport owners; no public SDK/config/schema changes.

Maintainer proof decision and exact-head coverage disclosure

The immediately preceding commit 4d359710d677953d2f9cafe679abadfb730567ed executed five actual registered Discord/Telegram interaction regressions: four authorized/unauthorized conversation-binding owner paths and one separate Telegram direct-message authorization case. Reviewed head d97e86833207c15cef3c2cd8f88f732c293edcf5 is its direct child and changes only the Discord test fixture (+1/-4) to remove a retired configuration key. The Telegram production-dispatch Git blob remains exactly 00b8162c517e8cfa397307c074511a31dc3c9e83; its test blob remains exactly 297c6e61efa2c5b5382ee2a350e674aecb62e4e4. The Discord production-dispatch blob also remains unchanged, and both Discord authorization-owner cases passed again on the reviewed head.

Exact-head hosted CI and Telegram help/tools/context/status smoke are green. Important coverage caveat: the compact hosted Node planner excludes extension projects, so those CI jobs do not execute Telegram callback/binding owner regressions. Attempts to rerun the Telegram suite in the isolated linked worktree failed during setup/collection before any case executed (121 pending; two suite setup/cleanup errors); no live Telegram channel was contacted. The installed-worktree alias points to a missing linked-worktree dependency; its attempted in-memory resolver adjustment did not make collection succeed. This is not represented as an exact-head Telegram pass.

Explicit maintainer decision: accept the actual parent-commit Telegram owner proof because the reviewed child contains byte-identical Telegram production and test objects, combined with exact-head Discord owner proof, green general Telegram smoke, full hosted guards/types/security checks, and the candid isolated-environment/live-channel limitations above.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram size: M maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 11:24 AM ET / 15:24 UTC.

ClawSweeper review

What this changes

The PR prevents unauthorized Discord and Telegram interactive callbacks from receiving privileged conversation-binding helpers while continuing to invoke registered plugin callbacks and preserving authorized binding behavior.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this PR open: it repairs a real authorization boundary that current main still leaves exposed, and the transport-owner approach matches the merged Slack repair. The patch has no concrete correctness finding, but Telegram policy and the prior review still require real Telegram behavior proof; the protected maintainer label makes that proof-sufficiency choice human-owned.

Priority: P1
Reviewed head: d97e86833207c15cef3c2cd8f88f732c293edcf5
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is a focused, source-supported security repair, but mock-only transport evidence leaves the real-behavior merge gate unmet.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR provides substantial registered-handler and in-memory binding-owner evidence, but no redacted live Telegram transport probe; that remains required before merge under the scoped Telegram review standard. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR provides substantial registered-handler and in-memory binding-owner evidence, but no redacted live Telegram transport probe; that remains required before merge under the scoped Telegram review standard. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main vulnerable authority path: Current main invokes the shared binding helper with the full plugin registration in Discord dispatch, including its plugin root, before passing the resulting helper methods to every matched callback handler.
Shared binding owner can mutate approved bindings: The shared owner refreshes an existing binding for the same plugin root and auto-binds when persistent approval exists; exposing a plugin root is therefore privileged authority rather than inert metadata.
PR gates authority at both channel owners: The proposed Discord and Telegram dispatchers retain registration.handler invocation but replace pluginRoot with undefined unless authorization and canonical sender/account/conversation identifiers are present, causing the existing helper to return its fail-closed result shapes.
Findings None None.
Security None None.

How this fits together

Discord and Telegram receive interactive callbacks, determine sender authorization, and dispatch registered plugin handlers. The shared binding helper can read, create, refresh, or detach persistent conversation bindings when it receives plugin ownership metadata, so each channel transport must withhold that authority from untrusted callbacks.

flowchart LR
  A[Discord or Telegram callback] --> B[Channel ingress]
  B --> C[Sender authorization]
  C --> D[Registered plugin handler]
  C -->|authorized| E[Binding helper with owner authority]
  C -->|unauthorized| F[Fail-closed binding helper]
  E --> G[Persistent conversation binding]
  F --> D
  D --> H[Channel response]
Loading

Decision needed

Question Recommendation
Should the parent-commit Telegram registered-handler proof plus byte-identical Telegram source/test blobs be accepted in place of the scoped policy's requested real Telegram authorization probe? Require a live Telegram probe: Request a redacted bot-to-bot or equivalent live Telegram callback probe before merge, showing denied binding operations and preserved plugin-handler invocation.

Why: The implementation is a narrow security repair, but current evidence does not show the changed Telegram authorization behavior in a real transport setup, and the protected maintainer label requires an explicit human merge decision.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR provides substantial registered-handler and in-memory binding-owner evidence, but no redacted live Telegram transport probe; that remains required before merge under the scoped Telegram review standard. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The patch changes a security boundary correctly in source, but the supplied evidence is still registered-handler/in-memory proof rather than a redacted live Telegram authorization probe required by the scoped Telegram policy.
  • Resolve merge risk (P1) - The PR is behind current main; after proof is accepted, the exact merge result should be refreshed against the current base before landing.
Agent review details

Security

None.

PR surface

Source +14, Tests +155. Total +169 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 16 2 +14
Tests 2 234 79 +155
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 250 81 +169

Review metrics

Metric Value Why it matters
Production versus test delta production +14; tests +49 net (+234/-79) The small production increase is confined to the two transport owners and carries the authorization fact needed to remove privileged binding authority from untrusted callbacks.

Mantis proof suggestion

A Telegram live proof lane can directly show that an unauthorized callback retains normal handler dispatch while privileged binding operations fail closed. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram live proof: verify that an unauthorized group callback cannot create, read, or detach a conversation binding while the plugin handler still runs.

Merge-risk options

Maintainer options:

  1. Add transport-level proof before merge (recommended)
    Provide a redacted live Telegram authorization probe, then refresh the exact merge result against current main before landing.
  2. Accept the parent-proof exception
    A maintainer may explicitly accept the byte-identical parent-commit Telegram proof as the merge gate for this narrowly scoped repair.

Technical review

Best possible solution:

Land the channel-owner gate after a redacted live Telegram callback probe demonstrates both outcomes: an unauthorized user cannot read, bind, refresh, or detach state, while the ordinary registered handler still executes; then refresh the merge result against current main.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main gives every matched Discord and Telegram callback a helper backed by pluginRoot, and the shared owner auto-refreshes existing bindings or auto-approves them under persistent approval. The proposed regression cases should execute that real dispatcher-to-helper path and assert denied helper results plus zero adapter reads and writes for unauthorized callbacks.

Is this the best way to solve the issue?

Yes: the transport owners already own the authorization fact, and withholding only pluginRoot reuses the shared helper's established fail-closed behavior without changing callback dispatch or the public plugin SDK. The merged Slack repair uses the same owner-boundary pattern.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7fabb5564831.

Labels

Label changes:

  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes user-triggered Telegram callback authorization and can be demonstrated with a short redacted Telegram interaction recording or transcript.

Label justifications:

  • P1: Unauthorized interactive callbacks can otherwise access persistent conversation-binding operations on two shipped channel transports.
  • merge-risk: 🚨 security-boundary: Merging changes the authorization condition governing access to persistent binding reads and writes.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR provides substantial registered-handler and in-memory binding-owner evidence, but no redacted live Telegram transport probe; that remains required before merge under the scoped Telegram review standard. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes user-triggered Telegram callback authorization and can be demonstrated with a short redacted Telegram interaction recording or transcript.

Evidence

What I checked:

  • Current-main vulnerable authority path: Current main invokes the shared binding helper with the full plugin registration in Discord dispatch, including its plugin root, before passing the resulting helper methods to every matched callback handler. (extensions/discord/src/interactive-dispatch.ts:93, fe6fa891ea4e)
  • Shared binding owner can mutate approved bindings: The shared owner refreshes an existing binding for the same plugin root and auto-binds when persistent approval exists; exposing a plugin root is therefore privileged authority rather than inert metadata. (src/plugins/conversation-binding.ts:829, fe6fa891ea4e)
  • PR gates authority at both channel owners: The proposed Discord and Telegram dispatchers retain registration.handler invocation but replace pluginRoot with undefined unless authorization and canonical sender/account/conversation identifiers are present, causing the existing helper to return its fail-closed result shapes. (extensions/telegram/src/interactive-dispatch.ts:119, d97e86833207)
  • Channel callers supply the authorization fact: Discord passes its computed isAuthorizedSender value into the dispatch context, and Telegram awaits its callback authorization routine before dispatch; the proposed owner gates use those transport-owned facts rather than reimplementing policy. (extensions/telegram/src/bot-handlers.callback-interactions.runtime.ts:275, fe6fa891ea4e)
  • Feature provenance and sibling precedent: Commit fe6fa89 introduced the current Discord, Telegram, helper, and binding-owner path; the merged Slack repair 5541eef applies the same fail-closed owner-metadata pattern. This PR head is not an ancestor of current main, so current main does not yet contain this repair. (extensions/slack/src/interactive-dispatch.ts:136, 5541eef4f20d)
  • Telegram proof requirement: The scoped Telegram guide requires real Telegram proof for PRs touching callbacks or authorization and prefers a bot-to-bot QA lane or equivalent live probe over synthetic-only validation. (extensions/telegram/AGENTS.md:128, 7fabb5564831)

Likely related people:

  • steipete: Peter Steinberger introduced the current interactive dispatchers, shared helper, and binding owner in fe6fa89, and authored the merged Slack sibling repair that establishes the same transport-owned authority boundary. (role: original current-path author and recent area contributor; confidence: high; commits: fe6fa891ea4e, 5541eef4f20d; files: extensions/discord/src/interactive-dispatch.ts, extensions/telegram/src/interactive-dispatch.ts, src/plugins/interactive-binding-helpers.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted live Telegram callback probe showing denied binding operations and preserved handler invocation.
  • Refresh the exact merge result against current main after the proof decision.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-03T14:27:24.012Z sha d97e868 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label Aug 3, 2026
@steipete
steipete merged commit ed8881c into main Aug 3, 2026
130 of 134 checks passed
@steipete
steipete deleted the codex/qa0803-discord-telegram-interactive-binding-auth branch August 3, 2026 15:37
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main:
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (78 commits)
  fix(parallels): recover Windows poll transport failures (#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (#118704)
  fix(test): bound shared git inventory lookup (#111171)
  fix(onboard): keep referenced provider secrets out of plaintext (#118702)
  docs: show canonical agent roster configuration (#118722)
  fix(channels): generate catalog from package manifests (#118097)
  fix(zalouser): distinguish probe timeout from auth failure (#111336)
  improve(ui): cut E2E shard runtime by reusing the bundle (#118697)
  fix(cli): publish completion caches atomically (#118715)
  fix(whatsapp): honor disabled self-chat without widening group access (#118711)
  fix(voice-call): terminate carrier calls after realtime startup failures (#118699)
  fix(slack): isolate GovSlack media trust and delivery (#118695)
  fix(browser): wrap page-controlled action results (#118691)
  fix(security): sanitize JSON-escaped forged content boundaries (#118698)
  test(qa): prove real yielded-child completion and channel delivery (#118707)
  fix(doctor): honor explicit plugin-only migration authority (#118700)
  fix(security): detect child_process calls through aliases and computed members (#116304)
  test(gateway): avoid async facade mock race (#118708)
  fix(gateway): preserve final speech during transcription shutdown (#118693)
  fix(gateway): resume durable outbound delivery retries (#118694)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
…penclaw#118704)

* fix(channels): deny unauthorized Discord and Telegram binding access

* test(discord): remove retired access-group config key
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main:
  fix(parallels): recover Windows poll transport failures (openclaw#118479)
  fix(channels): deny unauthorized Discord and Telegram binding access (openclaw#118704)
  fix(test): bound shared git inventory lookup (openclaw#111171)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: telegram Channel integration: telegram maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant