From 2ccb6653e8841d4d6f3ab933f84746cce4e2fe2b Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 26 Sep 2026 02:03:50 +0200 Subject: feat(protocol): bind the MNP token to the node it is for (E10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The audience split stopped a member's node credential from opening the hub API. It did not stop the credential being *replayed to another node*: the MNP token carried the member's whole group set and named no node, so a token handed to node A's operator could be presented to node B the member also belongs to. That does not read content on B — the handshake still requires proving node B's group key, which the operator lacks — but it reaches B's pre-proof window and fetches the member's *encrypted* keypair bundle for B (offline-attackable, bounded, audited): a disclosure §2.4 says should not follow from hosting a member on A. The token now names the node it is minted for (a `node` claim = that node's Ed25519 key), and authorize_token refuses one that names a different key. The client already knows the target node's key (from /v1/groups/{id}/nodes) and asks for a token bound to it: POST /v1/nodes/mnp-token takes node_pk, and transport.connect threads it (group-page, the connection pool and rewrap pass n.pk_node; reconnect preserves it). A token that names no node is still accepted, because the hub only mints one for the authenticated requester, so an unbound token grants nothing across accounts — which also keeps non-binding callers working with no churn. Done before deploy, so it folds into the MNP 4.0 flag day rather than needing its own. Docs: §5.2, register E10, MESHBAY_NODE_PROTOCOL.md §6.3. test_handshake.py and test_mnp_token.py hold the binding (a token for node A is refused by node B, accepted by node A; an unbound token still works); red before, green after. common/node/hub suites green. Co-Authored-By: Claude Opus 4.8 --- packages/meshbay-node/src/meshbay_node/transport/quic_server.py | 1 + packages/meshbay-node/src/meshbay_node/transport/webrtc/handshake.py | 1 + 2 files changed, 2 insertions(+) (limited to 'packages/meshbay-node') diff --git a/packages/meshbay-node/src/meshbay_node/transport/quic_server.py b/packages/meshbay-node/src/meshbay_node/transport/quic_server.py index 96cd752..715448f 100644 --- a/packages/meshbay-node/src/meshbay_node/transport/quic_server.py +++ b/packages/meshbay-node/src/meshbay_node/transport/quic_server.py @@ -286,6 +286,7 @@ class _MNPServerProtocol(QuicConnectionProtocol): group_id=msg.get("group_id", ""), hosted_groups=self._ctx.get("groups"), denylist=self._ctx.get("denylist"), + node_pk_b64=pk_to_b64(self._ctx["sk_node"].public_key()), ) except HandshakeError as refusal: self._send(stream_id, {"type": "error", "detail": str(refusal), diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc/handshake.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc/handshake.py index 87394d1..eceb2b4 100644 --- a/packages/meshbay-node/src/meshbay_node/transport/webrtc/handshake.py +++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/handshake.py @@ -65,6 +65,7 @@ class HandshakeMixin: group_id=group_id, hosted_groups=self._ctx.get("groups"), denylist=self._ctx.get("denylist"), + node_pk_b64=self._node_pk_b64(), ) except HandshakeError as refusal: # HandshakeError messages are authored to be peer-safe, unlike arbitrary -- cgit v1.2.3