fix(gateway): pairing store cannot bypass platform allowlist#23805
Open
ygd58 wants to merge 1 commit into
Open
fix(gateway): pairing store cannot bypass platform allowlist#23805ygd58 wants to merge 1 commit into
ygd58 wants to merge 1 commit into
Conversation
When TELEGRAM_ALLOWED_USERS is configured, a user who tapped 'Always' on an approval button could permanently bypass the allowlist via the pairing store — _is_user_authorized() checked pairing store BEFORE the allowlist, so a paired-but-not-allowed user was always authorized. Fix: if a platform allowlist is configured, verify the paired user is still in the allowlist before honoring the pairing store entry. If the user is no longer listed, revoke the pairing and deny access. This explains the auth state inversion observed in issue NousResearch#23778: the attacker was paired via 'Always' approval during the bypass window, which continued to authorize them even after ALLOWED_USERS was fixed — while the owner (not yet paired) was correctly rejected. Fixes NousResearch#23778 (partial - pairing store allowlist bypass)
Closed
1 task
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.
Problem
A user who tapped Always on an approval button could permanently bypass TELEGRAM_ALLOWED_USERS via the pairing store.
_is_user_authorized()checked pairing store BEFORE the allowlist, so a paired-but-not-allowed user was always authorized.This caused the auth state inversion in #23778: attacker was paired via Always during the bypass window, continued to be authorized even after ALLOWED_USERS was fixed, while the owner (not yet paired) was correctly rejected.
Fix
If a platform allowlist is configured, verify the paired user is still in the allowlist before honoring the pairing entry. If no longer listed, revoke the pairing and deny access.
Fixes #23778 (partial - pairing store bypass)