Repository navigation
py-libp2p v0.8.2
Patch release with two security fixes, dial hardening, and a Kademlia lookup improvement.
Security
- Multistream-select message reads are now bounded to 64 KiB. An oversized varint length prefix could exhaust memory before authentication during protocol negotiation. (GHSA-hmjq-g7pp-rw3x)
- QUIC now rejects peer certificates with an invalid proof-of-possession signature.
PublicKey.verify()returnsFalserather than raising, and the result was ignored, so a peer could claim any peer ID. (GHSA-hrfr-7729-443m)
Bugfixes
- The WebSocket transport now dials
/tls/sni/<name>/wsaddresses: the socket connects to the host before/tls, and<name>is the TLS server name and theHostheader of the WebSocket upgrade, on direct and SOCKS proxy dials. Such an address used to fail incan_dialwithAttributeError: 'Protocol' object has no attribute 'value', so a peer behind a TLS-terminating proxy that routes by name could not be reached by an address plus a name. (#1551) - A yamux stream the peer reset now reports
MuxedStreamResetto a boundedread(n), notMuxedStreamEOF. Which bytes are delivered is unchanged: a remote reset still takes precedence over data already buffered. A caller reading a body with no declared length (HTTP/1.1 withoutContent-Length, server-sent events) can now tell a cut-off message from a finished one. (#1559) KadDHT'sprotocol_prefixnow decides the protocol the DHT speaks and answers on. It was accepted but every outbound stream and the inbound handler used the hardcoded/ipfs/kad/1.0.0, so a DHT built for another network could never reach its own peers. AKadDHTbuilt without a prefix is unchanged. (#1562)- Dials now honour
ConnectionConfig.dial_timeout(default 10s). Before, only the AutoConnector used it, sohost.connectto an address that never answers waited for the OS connect timeout, which is minutes. (#1567) - Requires
certifi >= 2026.10.19, the first release that removes the compromised eMudhra/emSign CA certificates while keeping the unaffected emSign roots. Installing or upgrading py-libp2p replaces a vulnerable CA bundle. Users must also upgrade the installer:pip >= 26.2.2anduv >= 0.13.4, because pip loads its own bundled certifi in addition to the system store. (#1571) /dns6/localhostand other*.localhostnames are no longer treated as needing public IPv6, so they can be dialed on hosts with no global IPv6 address. (#1585)- Prevented eviction of the local host identity from the peerstore when exceeding
max_peers, registered host listen addresses into the peerstore on startup, prevented socket and file descriptor leaks on cancelled dials across QUIC and TCP, added per-address quadratic dial backoff and dial concurrency limiting, and let Happy Eyeballs dial all top candidate addresses without discarding peers with identical transport types. (#1592) - The WebTransport stream-type workaround is skipped on aioquic 1.8, which records WebTransport streams itself and removed the private
_get_or_create_streamit relied on. (#1597) - Added exit paths for hung
examples/echo,examples/identify,examples/request_response/request_response_demoandexamples/pingby cancelling the scope at the end of the client branch. (#1586) - The nim-libp2p Identify response shim now applies only while the interop ping harness runs, so collecting helper unit tests no longer clears Identify fields for unrelated DHT tests under pytest-xdist. (#1588)
- Closed Gossipsub example hosts during cancellation so the normal and churn demos release their TCP sockets on exit. (#1139)
- Fixed nim-libp2p interop CI by migrating the Nim echo server to the v2
RngAPI and pinning nim-libp2p so the echo binary builds again. (#1573)
Features
- Randomised per-round candidate selection in the Kademlia DHT lookup. Each round now draws its ALPHA queries at random from the closest-peer window instead of always taking the strictly closest ALPHA, so a peer that mines an ID next to the target key is no longer guaranteed a slot in the first round and cannot shape the lookup path from the first hop. The BETA closest peers are still contacted before the lookup returns. (#1384)
Improved Documentation
- Added runnable Gossipsub version demos (v1.0 to v2.0) and a multi-version comparison example under
examples/pubsub/gossipsub/. (#1130) - Refreshed WebRTC-Direct v1/v2 dial guidance now that libp2p/specs#715 has merged: the dialer default stays at v1 for wider-network compatibility, and v2 remains opt-in. (#1601)
Miscellaneous Changes
Install
pip install --upgrade libp2p==0.8.2Full changelog: v0.8.1...v0.8.2