Repository navigation
Conversation
The SRT credentials helper embedded a permanent user token with full account access in the encoder URL. It now mints a token that carries scoped_call_cid (the backend lets it only join that call) and expires after 24 hours by default. Callers can set another lifetime, the result reports when the token expires, the helper rejects a stream id over the 512-byte SRT limit, and printing the credentials redacts the address. The ingest re-presents the token on every SFU rejoin (at least every 6h), so the lifetime must cover the whole stream. An SRT URL left in an always-on encoder now stops working after 24 hours unless a longer lifetime is requested.
oliverlaz
marked this pull request as ready for review
November 25, 2026 12:39
…on [SEC-2523] Per review on stream-node#417, the SDK no longer checks the SRT stream id length and no longer redacts the address when the credentials are printed.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 90664b0. Configure here.
mogita
approved these changes
Nov 27, 2026
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.

Submit a pull request
CLA
Description of the pull request
Ticket
https://linear.app/stream/issue/SEC-2523/sec-10-permanent-unscoped-user-jwts-embedded-in-srt-ingest-urls
Summary
The SRT credentials helper embedded a permanent, account-wide user token in the URL handed to OBS/encoders. The SRT stream id travels in the SRT handshake in cleartext, and a leaked encoder URL gave permanent access to that user's account.
The helper now mints a token that:
scoped_call_cid: "<type>:<id>": the backend (chat v241.21.0, CHA-6984) accepts it only for joining that call and reading app settings, and refuses it everywhere else, including the websocket.call_cidswas deliberately not used: it grants the holder a role in those calls instead of restricting the token.It also returns when the token expires, rejects a stream id over the 512-byte SRT limit with a clear error (encoders refuse longer ones), and redacts the address when the credentials are printed.
Why 24 hours, not shorter
The ingest uses this token as a normal user token for coordinator
JoinCall, and calls it again on every SFU rejoin/migration. SFU tokens last 6h and the SFU forces a rejoin when one expires, so the user token is re-presented at least every 6 hours during a stream. If it has expired by then, the stream drops. The lifetime must therefore cover the wait until the encoder starts plus the whole stream.Behaviour change
The API is backward compatible (only additions). An SRT URL generated once and left in an always-on encoder now stops working after 24 hours unless a longer lifetime is requested.
Backend dependency
scoped_call_cidis enforced from chat v241.21.0. Older backends ignore the unknown claim, so the token keeps working there, just without the call restriction.API
call.createSRTCredentials(userID, Duration validity); the existing one usesCall.DEFAULT_SRT_TOKEN_VALIDITY(24h).TokenBuilder.createScopedCallToken(userId, callCID, Instant expiresAt).SRTCredentialsgainsInstant expiresAtand atoString()that redacts the address.Testing
SRTCredentialsTestandTokenBuilderTestcases (scope claim, lifetime, invalid lifetime, 512-byte limit, redaction)../gradlew spotlessCheck buildpasses locally on JDK 17.Note
High Risk
Changes how SRT ingest authentication tokens are minted (scoped JWTs with expiration), which is security-critical and alters long-lived encoder URL behaviour.
Overview
SRT ingest URLs no longer embed permanent, full-account JWTs.
createSRTCredentialsnow builds addresses using a call-scoped, expiring token (default 24h viaDEFAULT_SRT_TOKEN_VALIDITY), with a new overloadcreateSRTCredentials(userID, Duration validity)(minimum 1 second).TokenBuilder.createScopedCallTokenmints JWTs withscoped_call_cid(type:id) and an explicitexpiresAt, restricting use to that call instead of a genericcreateToken(userID).SRTCredentialsgainsexpiresAtso callers know when the embedded token stops working. Behaviour change: always-on encoders using a one-time generated URL will need refresh or a longervalidityafter the default lifetime.Tests cover scoped claims, custom/default expiry, and invalid validity;
TokenBuilderTestcovers the new token API.Reviewed by Cursor Bugbot for commit f8ebce8. Bugbot is set up for automated code reviews on this repo. Configure here.