Repository navigation
fix(api): do not synthesize default grants in TokenVerifier when missing - #877
Open
NabiBukhsh-AI wants to merge 1 commit into
Open
NabiBukhsh-AI wants to merge 1 commit into
NabiBukhsh-AI wants to merge 1 commit into
Conversation
When verifying a token that does not contain grant claims (such as video, sip, inference, or observability), TokenVerifier previously defaulted to instantiating empty grant objects. In particular, VideoGrants(**{}) synthesizes default room permissions (can_publish=True, can_subscribe=True, can_publish_data=True), incorrectly treating tokens minted without video grants as having full room publish/subscribe permissions.
Use _parse_grants consistently across video, sip, inference, and observability grants so that missing grants in claims remain None, matching agent, agent_endpoint, and agent_thread behavior.
NabiBukhsh-AI
requested review from
changt,
cloudwebrtc,
lukasIO and
xianshijing-lk
as code owners
October 20, 2026 15:28
This branch has not been deployed
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
When verifying an access token that does not contain grant claims (e.g.,
video,sip,inference, orobservability),TokenVerifier.verify()previously unpacked empty dictionaries into the grant classes:Because
VideoGrantsdefines defaults ofcan_publish=True,can_subscribe=True, andcan_publish_data=True, any token minted without video grants (such as an agent, webhook, SIP, or backend token) was incorrectly decoded byTokenVerifieras having active video permissions, rather thanNone.Changes
_parse_grants(claims, key, cls)forvideo,sip,inference, andobservabilitygrants so they evaluate toNoneif the corresponding claim key was omitted orNonein the token.agent,agent_endpoint, andagent_threadgrants.tests/api/test_access_token.pyto verify that omitted grants evaluate toNoneand explicitly provided grants are parsed correctly.