Repository navigation
py-libp2p v0.8.3
Patch release with three security fixes, a new host event bus with broader metrics, and memory-retention fixes across transports.
Security
- Yamux now enforces per-stream receive-window limits. Incoming DATA frames that exceed the window are treated as a protocol error and terminate the session, so a remote peer can no longer grow stream buffers without bound. (GHSA-xx4q-fj82-qjp5)
- Circuit Relay v2 RESERVE admission is keyed on the authenticated peer.
msg.peervalues that do not match the connection's peer are rejected, so a connected peer cannot consume reservation slots under unrelated peer IDs. (GHSA-76w5-58f3-9p2g) - Inbound pubsub subscription state is bounded per peer.
max_subscriptions_per_peer/max_subscriptions_per_rpcand inbound RPC size limits are enforced, per-peer subscription counts are tracked, and emptypeer_topicsentries are dropped on unsubscribe and disconnect. (GHSA-3p7x-v3jj-qxj7)
Bugfixes
- Fixed the SECIO key exchange on Windows, which used secp256k1 instead of P-256 and so could not agree on a shared secret with other platforms or implementations. (#1100)
- Leaving
host.run()without callinghost.close()now closes the host's connections, listeners and transports. Previously the teardown inSwarm.run()ran in an already-cancelled scope and stopped at its firstawait. (#1584) - Fixed the ping command to give correct complete instructions to run the ping demo, including the WebSocket case. (#1591)
- Fixed the circuit relay example so a source can reach a destination through the relay: the circuit address now names the relay, the destination keeps its relay services running and makes its reservation as soon as it connects, and a malformed log call no longer raises
TypeError. (#1606) tls-client-demoin its default echo mode now gets a reply fromtls-demo: the server answers/echo/1.0.0, and the client's echo mode uses it instead of the interactive chat protocol. (#1613)- Raise
QUICStreamClosedErroragain when writing to a QUIC stream whose sending side has ended, instead of letting aioquic'sStreamStateErrorthrough and resetting the stream. (#1619) - The WebRTC-Direct listener no longer monkey-patches aioice into a fake local ICE-Lite agent. It uses a full controlled muxed
Connection; the dialer still synthesises ana=ice-liteanswer so it remains controlling (aiortc/aioice#114). (#1626) AutoConnector.stop()now cancels the running connect cycle, including in-flight dials and on-demand discovery, and returns only once it has unwound, so no auto-connect dial can register a connection afterstop()returns. (#1630)- Released retained connection, stream, and task state across QUIC, stream multiplexers, WebSocket, pubsub, Bitswap, and Kad-DHT. Bounded peerstore and swarm bookkeeping, reclaimed inbound connection slots after disconnect, and improved auto-connector recovery after peer churn. Persistent peerstores now prune older uncached peers on writes when the datastore exceeds
max_stored_peers(defaults tomax_records). Kad-DHT preserves existing local provider publications at capacity. (#1632)
Features
- Added Python 3.14 to the tox test matrix and supported Python classifiers. (#1100)
- Require aioquic 1.9.1 or later, so QUIC and WebTransport connections use the post-quantum X25519MLKEM768 key exchange whenever the peer supports it, and stop relying on aioquic internals. (#1619)
- Added a synchronous host event bus for typed observability events and expanded Prometheus coverage across libp2p subsystems. Network lifecycle notifees continue to drive connection, stream, and listener callbacks; existing metrics-channel consumers can receive bus events through a best-effort bridge. (#1631)
Internal Changes
- Run the example programs themselves in the
demostest environment, so a broken example script now fails CI. (#523) - Replaced coincurve and fastecdsa with cryptography for secp256k1 and P-256 keys, since coincurve 21.0.0 cannot be installed on Python 3.14 and later. Signatures are unchanged, and installing py-libp2p no longer needs GMP, CMake or pkg-config. (#1100)
- Moved the iterative Kademlia lookup loop out of
PeerRouting.find_closest_peers_networkinto a reusableLookupengine inlibp2p.kad_dht.lookup, with no change in behaviour. (#1384) - Added js-libp2p WebRTC-Direct interop tests (
@libp2p/webrtc7.0.2) for both the v1 and v2 flows. (#1437) - Added a test that a QUIC handshake between two py-libp2p peers offers and selects the post-quantum X25519MLKEM768 key exchange. (#1581)
- Updated the test suite for
multiaddr0.3 and silenced twopyreflyfalse positives onpy-multihash4.0.0. (#1620)
Install
pip install --upgrade libp2p==0.8.3Full changelog: v0.8.2...v0.8.3