Files
livekit/pkg
fdf40b94a3 feat: add token revocation list (#4344)
* feat: add token revocation

* token revocation: match LiveKit Cloud API, make it optional

- add token_revocation config section (enabled: false by default, ttl)
- RemoveParticipant: cutoff defaults to now, revoke_token_ts must be within
  60s and is stored with the validation leeway, revoke absent participants,
  keep not found unless revoke_token_ts is given
- UpdateParticipant revokes older tokens on permission updates and the
  participant gets a refreshed token
- share the RoomService logic with Cloud through RevokeTokenClient
- revocations merge to the later cutoff and expiry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* token revocation: clean up expired revocations lazily

Drop the cleanup goroutine of LocalStore. Revocations are kept in a queue
ordered by expiry, and expired ones are removed from its front when
revoking or checking, at most once per minute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* token revocation: request context for redis, own lock for LocalStore

- RedisStore revocation calls use the request context
- LocalStore revocations use their own lock instead of the store lock
- remove TestRTCValidateRoomlessTokenAfterRevocation, which passes without revocation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* token revocation: length checks before auth, test all auth chains

Check lengths before the admin permission check, as LiveKit Cloud does, and
test that the API, agent endpoint and WebTransport chains reject revoked tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* token revocation: do not return store errors to clients

Log the error of a failed revocation lookup and respond with a fixed message,
as the store error may contain internal addresses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: cnderrauber <zengjie9004@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:55:28 +08:00
..
2025-11-28 21:51:53 +05:30