-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
dmPolicy allowFrom not enforced for Telegram text messages — unauthorized users reach agents #91209
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
dmPolicy: "allowlist"+allowFromdoes not prevent text messages from unauthorized Telegram users from reaching bound agents. The DM access check inbot-handlers.runtime.tsis gated behindhasInboundMedia, allowing plain text messages to bypass ingress filtering entirely.Version
v2026.6.1(latest stable) — installed via npm, running on Node.js v24.15.0, Bun binary runtime.Configuration
Reproduction
dmPolicy: "allowlist"withallowFrom: ["<owner_id>"]400: chat not foundbecause bot hasn't started DM with the unauthorized usersend_attempt_startedstate and blocks reconnect drain withrefusing blind replay without adapter reconciliationRoot Cause
Two call sites for
enforceTelegramDmAccess:1.
extensions/telegram/src/bot-handlers.runtime.ts:2847— BUGGY GATEDM access is ONLY checked for messages with media or reply-to-media. Plain text messages skip this check entirely and proceed directly to
processInboundMessage→ agent dispatch.2.
extensions/telegram/src/bot-message-context.ts:361— CONTEXT BUILDER GATEThis is unconditional and SHOULD block unauthorized senders before
dispatchTelegramMessage. However, it does not prevent the agent from processing the message and spending tokens — it only prevents the dispatch. In practice, unauthorized users still reach agent processing.Impact (measured over 13 days on a production instance)
8243344628): 845 entriesSecondary effects
refusing blind replay without adapter reconciliationEmbeddedAttemptSessionTakeoverErrorRelated
hasInboundMediagate inbot-handlers.runtime.tswas not removed)Expected Behavior
Messages from users NOT in
allowFromshould be silently dropped at the channel ingress level — before any agent dispatch, token consumption, or reply generation. TheenforceTelegramDmAccesscall inbot-handlers.runtime.ts:2847should NOT be gated behindhasInboundMedia.Suggested Fix
Remove the
hasInboundMediagate inbot-handlers.runtime.ts:The context builder gate in
bot-message-context.tsserves as a second line of defense for any paths that might bypass the handler-level check.