Problem
Two authentication gaps undermine the channel auth model:
-
The HTTP publish endpoint verifies nothing. Pusher's REST API requires a signed request (auth_key, auth_timestamp, auth_version, body_md5, auth_signature — HMAC SHA256 of the request over the app secret). handleEventPublishing accepts any POST from anyone who can reach the port and broadcasts to any channel, including private- and presence- channels. Private channel subscription auth is pointless while this is open.
-
The app key in the WebSocket connection path is never validated. pusher-js connects to /app/{key}, but handleWebSocketUpgrade upgrades any path with any key.
What's needed
Related: #5 covers the payload/route compatibility of the same endpoint.
Problem
Two authentication gaps undermine the channel auth model:
The HTTP publish endpoint verifies nothing. Pusher's REST API requires a signed request (
auth_key,auth_timestamp,auth_version,body_md5,auth_signature— HMAC SHA256 of the request over the app secret).handleEventPublishingaccepts any POST from anyone who can reach the port and broadcasts to any channel, includingprivate-andpresence-channels. Private channel subscription auth is pointless while this is open.The app key in the WebSocket connection path is never validated. pusher-js connects to
/app/{key}, buthandleWebSocketUpgradeupgrades any path with any key.What's needed
/apps/{app_id}/events(see Pusher HTTP API auth spec) and reject with 401 on mismatchapp_idin the path and the{key}segment on WebSocket upgrade againstPUSHER_APP_ID/PUSHER_APP_KEY, rejecting unknown keys with the protocol error (4001)Related: #5 covers the payload/route compatibility of the same endpoint.