github centrifugal/centrifugo v6.10.5

one hour ago

Centrifugo is an open-source scalable real-time messaging server. It instantly delivers messages to application online users connected over supported transports (WebSocket, HTTP-streaming, Server-Sent Events (SSE), GRPC, WebTransport). Centrifugo is built around channel subscriptions – so it's a user-facing PUB/SUB server.

Centrifugo is language-agnostic and can be used to build chat apps, live comments, multiplayer games, real-time data visualizations, collaborative tools, AI streaming responses, etc. in combination with any backend. It is well suited for modern architectures and allows decoupling the business logic from the real-time transport layer.

Official client SDKs are available for JavaScript (browser, Node.js, React Native), Dart/Flutter, Swift, Java, Python, Go, Rust, and .NET. In addition, Centrifugo supports a unidirectional approach for simple use cases with no SDK dependency.

For details, go to the Centrifugo documentation site. For runnable demos see centrifugal/examples.

What's changed

Improvements

  • Official skill for Centrifugo – helps to reduce errors and the cost of agent development with Centrifugo.
  • Per-connection client command rate limit. The new client.rate_limit option limits the rate of commands each connection may send. Every command counts, except connect. action sets what a command over the limit gets: reject (default) answers it with error 111, disconnect closes the connection with code 3013. Use disconnect for protection – a rejected command still costs reading and answering it, so rejecting does not stop a flooding client – together with a limit on how fast clients can open connections (per IP in front of Centrifugo is recommended). unsubscribe and untrack are never rejected, with disconnect they close the connection like other commands. Rate limiting is off by default. Configuration written for it works unchanged in Centrifugo PRO, which extends it. (#1315, #1355).

Fixes

  • client.allowed_origins is now enforced on HTTP-based connection endpoints. Before, on HTTP-streaming, SSE, unidirectional HTTP-streaming and SSE, the emulation endpoint and the init endpoint, it only decided whether to add CORS headers, and the request itself was always served. A browser sends CORS-simple requests (for example, a text/plain POST) without a preflight, so a page of a disallowed origin could make Centrifugo connect a user with their cookies and run commands such as publish or RPC. The page could not read the responses, but the commands ran. WebSocket, unidirectional WebSocket and WebTransport already rejected disallowed origins. Reported by @draarivpatel-ui (GHSA-3r6c-vgv7-h9mr, #1359). Now, on all connection endpoints (see client.allowed_origins):
    • a request with a disallowed Origin, also Origin: null (sent after a cross-origin redirect or from a sandboxed page), gets 403;
    • browser navigations and resource loads (links, <img>, <iframe>) started from another site get 403, as they carry the user's cookies without Origin. Not with allowed_origins set to ["*"];
    • a request the browser marks with Sec-Fetch-Site: same-origin is always allowed, so a page served from Centrifugo's own origin works with empty allowed_origins;
    • requests without Origin (non-browser clients) work as before;
    • the warning on start for allowed_origins: ["*"] now explains the risk with cookie-based authentication.
    • Behavior change: with empty allowed_origins, a page of another origin now gets 403 on HTTP-based transports, as it already did on WebSocket. If browsers connect over HTTP-streaming or SSE from another origin, list it in allowed_origins before upgrading.
  • JWKS: with jwks_public_endpoint set to a URL whose path ends with a slash (for example https://auth.example.com/jwks/), every key fetch failed with JWKS URL path contains traversal sequences, so no token could be verified. Paths with .. are still rejected. Thanks @shaurya703 (#1357).

Miscellaneous

  • This release is built with Go 1.27.4.
  • Dependency updates.
  • See also the corresponding Centrifugo PRO release.

Don't miss a new centrifugo release

NewReleases is sending notifications on new releases.