Add hooks for consumer-supplied connection authentication and authorization - #921
Merged
mcottontensor merged 1 commit intoJun 25, 2026
Conversation
The signalling server ships no authentication by design; consumers are expected to bring their own. Add seams so they can do that without forking: - Expose the HTTP upgrade request on connections (IStreamer.request / IPlayer.request) so an identity attached during a verifyClient check survives to later authorization decisions. - Add IServerConfig.authorizeStreamerId, consulted in StreamerRegistry when a streamer identifies itself. It can accept the default id, override it (e.g. namespace per tenant), or reject and disconnect the streamer. This is the seam for preventing streamer-id squatting. Default behaviour is unchanged when neither is supplied. The existing *WsOptions.verifyClient pass-through (for authenticating the upgrade) and both new seams are documented in Docs/Security-Guidelines.md.
mcottontensor
marked this pull request as ready for review
June 24, 2026 04:51
Collaborator
Author
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
Collaborator
Author
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
mcottontensor
added a commit
that referenced
this pull request
Jun 26, 2026
…) (#930) The signalling server ships no authentication by design; consumers are expected to bring their own. Add seams so they can do that without forking: - Expose the HTTP upgrade request on connections (IStreamer.request / IPlayer.request) so an identity attached during a verifyClient check survives to later authorization decisions. - Add IServerConfig.authorizeStreamerId, consulted in StreamerRegistry when a streamer identifies itself. It can accept the default id, override it (e.g. namespace per tenant), or reject and disconnect the streamer. This is the seam for preventing streamer-id squatting. Default behaviour is unchanged when neither is supplied. The existing *WsOptions.verifyClient pass-through (for authenticating the upgrade) and both new seams are documented in Docs/Security-Guidelines.md. (cherry picked from commit 8385df9) # Conflicts: # Signalling/src/SignallingServer.ts
This was referenced Aug 12, 2026
mcottontensor
added a commit
that referenced
this pull request
Aug 12, 2026
The signalling server ships no authentication by design; consumers are expected to bring their own. Add seams so they can do that without forking: - Expose the HTTP upgrade request on connections (IStreamer.request / IPlayer.request) so an identity attached during a verifyClient check survives to later authorization decisions. - Add IServerConfig.authorizeStreamerId, consulted in StreamerRegistry when a streamer identifies itself. It can accept the default id, override it (e.g. namespace per tenant), or reject and disconnect the streamer. This is the seam for preventing streamer-id squatting. Default behaviour is unchanged when neither is supplied. The existing *WsOptions.verifyClient pass-through (for authenticating the upgrade) and both new seams are documented in Docs/Security-Guidelines.md. (cherry picked from commit 8385df9)
mcottontensor
added a commit
that referenced
this pull request
Aug 12, 2026
…) (#976) The signalling server ships no authentication by design; consumers are expected to bring their own. Add seams so they can do that without forking: - Expose the HTTP upgrade request on connections (IStreamer.request / IPlayer.request) so an identity attached during a verifyClient check survives to later authorization decisions. - Add IServerConfig.authorizeStreamerId, consulted in StreamerRegistry when a streamer identifies itself. It can accept the default id, override it (e.g. namespace per tenant), or reject and disconnect the streamer. This is the seam for preventing streamer-id squatting. Default behaviour is unchanged when neither is supplied. The existing *WsOptions.verifyClient pass-through (for authenticating the upgrade) and both new seams are documented in Docs/Security-Guidelines.md. (cherry picked from commit 8385df9)
This was referenced Aug 12, 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.
Relevant components:
Problem statement:
The signalling server intentionally ships no authentication — consumers are expected to bring their own, appropriate to their environment. Today that is harder than it should be: there is no documented place to authenticate a connection, no way to recover an authenticated identity on a connection after the upgrade, and no way to control the id a streamer registers as. The last point also means a connection can claim a streamer id before the legitimate streamer connects (id squatting), after which the legitimate streamer is silently renamed.
This PR adds policy-free extension points so a deployment can plug in its own auth without forking. It does not add any authentication scheme, credentials, or login flow.
Solution
Three seams, all opt-in and backwards compatible:
streamerWsOptions/playerWsOptions/sfuWsOptionsare already passed through to the underlyingwsserver, so a consumer can supply averifyClientcallback to accept/reject a connection before the server sends its config message (which carries peer/TURN options). This was undocumented; it is now described as the recommended authentication point.requeston connections (IStreamer.request/IPlayer.request). Anything averifyClient(or other front door) attaches to the request — e.g. a resolved identity — is recoverable later for authorization decisions.IServerConfig.authorizeStreamerId— an optional hook consulted inStreamerRegistrywhen a streamer identifies itself. It receives the requestingstreamer(with itsrequest), therequestedId, thesanitizedIdthe registry would otherwise commit, and whether the requested idcollided. It returns the id to commit (accept the default, or override to e.g. namespace per tenant), ornullto reject and disconnect the streamer. This is the seam for anti-squatting / id-ownership policy.When neither new option is supplied, behaviour is unchanged (requested id accepted, numeric suffix appended on collision).
Changes
Signalling/src/StreamerRegistry.ts: addIStreamerIdAuthRequestandStreamerIdAuthorizertypes; optional authorizer applied inonEndpointId(accept / override / reject, with a uniqueness guard on overrides).Signalling/src/SignallingServer.ts: addauthorizeStreamerIdtoIServerConfig, pass it to the registry, and thread the upgraderequestinto the three connection constructors.Signalling/src/{StreamerConnection,PlayerConnection,SFUConnection}.tsand theIStreamer/IPlayerinterfaces: expose optionalrequest.Docs/Security-Guidelines.md: new "Authenticating and authorizing connections" section with examples.minorbump forlib-pixelstreamingsignalling-ue5.7.Documentation
Added a "Authenticating and authorizing connections" section to
Docs/Security-Guidelines.mdcovering theverifyClientseam, recovering identity viaconnection.request, and theauthorizeStreamerIdhook, each with a short example. The guidance is explicit that the project ships no auth and these are seams for consumer policy.Test Plan and Compatibility
npm run build(CJS + ESM) andnpm run lintpass for the Signalling package; new types are present in the generateddist/typesdeclarations.SignallingServerplaying the consumer-policy role:verifyClientthat requires a token and stamps a tenant oninfo.req, plus anauthorizeStreamerIdthat namespaces the id. A streamer with a valid token connected and its id was committed astenantA:cam1(confirmed viaendpointIdConfirm), proving the request-borne identity reached the authorizer.cam1.This complements, but does not depend on, #920 (which enforces subscriber-scoped message routing). They touch different concerns and can be reviewed independently.