feat(plugins): plugin-to-gateway WebSocket auth mechanism #94
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
PR #85 added
validateSocketSessiontoChatGateway.handleConnection— all WebSocket connections now require a valid session cookie.PR #93 (
@mosaic/telegram-plugin) connects to the/chatgateway WebSocket without auth headers. Once PR #85 merges, the plugin will be disconnected immediately.Needed
A mechanism for internal channel plugins to authenticate against the gateway WebSocket. Options:
X-Plugin-Tokenheader (env-configured shared secret), bypasses Better Auth session check for plugin connectionsRecommendation
Option 1 (service API key) — add
PLUGIN_API_KEYenv var, check inhandleConnectionbefore callingvalidateSocketSession.Affected
apps/gateway/src/chat/chat.gateway.tsplugins/telegram/src/index.tsplugins/discord/src/index.ts(if applicable)