fix(telegram): fail closed on empty group allowFrom override#25954
Merged
obviyus merged 1 commit intoopenclaw:mainfrom Feb 25, 2026
Merged
Conversation
3c6aa12 to
bcbef74
Compare
Contributor
|
Landed via temp rebase onto main.
Thanks @bmendonca3! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fail closed when Telegram per-group/per-topic
allowFromoverride is explicitly configured but resolves to no entries. Previously this path could allow unauthorized group senders through base access checks.Change Type
Scope
src/telegram/group-access.tssrc/telegram/group-access.base-access.test.tssrc/telegram/bot.create-telegram-bot.test.tsSecurity Impact
This fixes an authorization boundary bypass in Telegram group handling. If a group/topic had an explicit
allowFromoverride configured as empty, base access could pass unexpectedly, allowing unauthorized users to trigger bot processing in that group context.Repro + Verification
Repro (vulnerable behavior):
channels.telegram.groupPolicy = "open"channels.telegram.groups["<groupId>"].allowFrom = []group-override-unauthorized.Targeted tests:
pnpm exec vitest --maxWorkers=1 src/telegram/group-access.base-access.test.ts src/telegram/bot.create-telegram-bot.test.tsEvidence
evaluateTelegramGroupBaseAccessdelegated toisSenderAllowedfor explicit overrides; Telegram sender matching helper treated empty allowlists as allowed in that call path.effectiveGroupAllow.hasEntries === false.Human Verification
{ "allowed": true }for explicit empty override input.{ "allowed": false, "reason": "group-override-unauthorized" }for the same input.Compatibility / Migration
No migration required. Existing configs that intentionally set an explicit empty group/topic override now deny by default, which matches allowlist semantics.
Failure Recovery
If a group unexpectedly stops receiving messages after upgrade, set explicit sender IDs in the group/topic
allowFromoverride (or remove the override if open behavior is intended).Risks and Mitigations
Risk: behavior change for configs relying on prior fail-open behavior with explicit empty overrides.
Mitigation: change is narrowly scoped to explicit override-empty condition and backed by focused tests.
Greptile Summary
Closes authorization bypass when Telegram group/topic
allowFromoverride is explicitly configured as empty. Previously,evaluateTelegramGroupBaseAccessdelegated toisSenderAllowed, which treated empty allowlists as allowed (viaisSenderIdAllowedwithallowWhenEmpty: true). The fix adds an explicit fail-closed check before delegation.src/telegram/group-access.ts:45-47to deny whenhasGroupAllowOverrideis true buteffectiveGroupAllow.hasEntriesis falsegroupPolicy: "open"with explicit emptyallowFromoverride blocks messagesConfidence Score: 5/5
isSenderAllowed. Both unit and integration tests verify the fix, and the change is narrowly scoped to the vulnerable path.Last reviewed commit: 3c6aa12