github nats-io/nats.go v1.56.0
Release v1.56.0

one hour ago

Changelog

This release fixes security issues in how the client decides to use TLS and which servers it takes from the cluster. Some of these fixes change how the client connects: read BREAKING CHANGES below before upgrading.

BREAKING CHANGES

  • Core NATS:
    • TLS settings now require TLS. Options.TLSConfig, RootCAsCB or TLSCertCB set directly now act like Secure(). Against a server without TLS, the connection fails. Against a server where TLS is optional (allow_non_tls, InProcessServer()), the client now uses TLS, so the certificate must verify. To connect without TLS, drop the TLS settings (#2245)

    • ErrSecureConnWanted is wrapped. Compare with errors.Is(err, nats.ErrSecureConnWanted). == no longer matches (#2245)

    • With TLS after INFO, discovered servers come only from the INFO received inside TLS. The plaintext INFO before the handshake no longer adds servers, and neither does a failed attempt. A TLS client configured with a single server URL therefore:

      • has nothing to fail over to against nats-server before 2.12, until the server sends a later INFO.
      • fails Connect() when that server fails it after its INFO, for example at max_connections (reported as a TLS handshake error, not the server's reason), or with a certificate that doesn't match a server configured by IP.

      Configure more than one server URL to keep fail-over. For a server configured by IP, set TLSConfig.ServerName to a name in its certificate (#2245)

    • SetServerPool() with a tls:// URL turns TLS on for the connection, as it does at Connect(). Plaintext servers in that pool can no longer be reached. Over WebSocket, servers listed on a wss:// connection are dialed with wss:// (#2245)

FIXED

  • Core NATS:
    • User info in a connect_urls entry (x@host:port) used as the credentials for that server. Discovered servers now always get the credentials the client used for the server that reported them (#2245)
    • Report TLS verification failures during reconnect. Thanks @cr7258 for the contribution (#2229)
    • Draining subscriptions resubscribed on reconnect (#2232)
    • Keep TLS server name for IPs discovered via an IP entry. Thanks @igor-kupczynski for the contribution (#2217)
    • Require a separator before inline header status. Thanks @ViktorBystrov72 for the contribution (#2237)
    • WebSocket frame handling (#2225)
    • Treat malformed WS close frames as protocol errors (#2226)
  • JetStream:
    • Release the JetStream reconnect watcher after publisher cleanup. Thanks @Grivn for the contribution (#2216)
    • Reduce JetStream fetch buffering allocations. Thanks @manenim for the contribution (#2205)
    • Preserve options when following object links. Thanks @Grivn for the contribution (#2220)
  • Legacy JetStream:
    • Legacy JetStream reconnect watcher cleanup (#2218)
    • Preserve options when following object links. Thanks @Grivn for the contribution (#2220)

IMPROVED

  • Core NATS:
    • Reuse header encoding buffers in PublishMsg. Thanks @Grivn for the contribution (#2219)
  • JetStream:
    • Remove duplicated word in MemoryMaxStreamBytes comment. Thanks @ninglinLiu for the contribution (#2242)
  • Remove stale go.mod version notes from docs. Thanks @nik-6174 for the contribution (#2233)
  • Bump ntf-client to v0.0.5 to fix nightly tester failures (#2243)

Complete Changes

v1.55.0...v1.56.0

Don't miss a new nats.go release

NewReleases is sending notifications on new releases.