summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_roster_pairing.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-15 02:34:19 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-15 02:34:19 +0200
commit84b032c65e17267d41e04605e79eea82a6f5a59f (patch)
treeeb7708a72944bb15540e103b4319242199af6fbb /packages/meshbay-node/tests/test_roster_pairing.py
parent5338894f7fec9e1a60affb0e2ff3b9797bcbc968 (diff)
downloadmeshbay-84b032c65e17267d41e04605e79eea82a6f5a59f.tar.gz
feat(groups): editable description, and one source of operator authority
A description could only be set the moment a group was created, so every group made before anyone thought of one stayed blank for good. The owner can now edit it from the group's page, and PATCH /v1/groups/{id} takes it. That endpoint takes the description and nothing else, deliberately. The name, the visibility and the join policy are the terms members joined on; a private group that can quietly become public is not the group they agreed to be in. Changing those needs a decision about who gets told, not a field on a form — there is a test saying so. Separately, the legacy operator key is gone. `admin_pk_ed25519` in node.toml named the operator before the roster existed and was kept so that an existing deployment would keep working; nothing uses it, and a second source of node authority is not something to carry around out of politeness. Authority is the roster, read fresh on every check. It is removed rather than ignored: a config that still names the key gets a warning at startup pointing at the file. Dropping it in silence would refuse invites and file deletion with a signature error that looks like a bug somewhere else — which is exactly how finding M3 presented. Two tests were verifying admin operations by naming a key in the context, which was the legacy path. They now pair an operator into a roster, the way an operator does. The authority test anchored on the deleted function and passed vacuously once it disappeared; it states the invariant against the verifier and the daemon instead. Also defined .btn-secondary, used in four places and styled in none. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_roster_pairing.py')
-rw-r--r--packages/meshbay-node/tests/test_roster_pairing.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/packages/meshbay-node/tests/test_roster_pairing.py b/packages/meshbay-node/tests/test_roster_pairing.py
index 665c060..a2f7cd1 100644
--- a/packages/meshbay-node/tests/test_roster_pairing.py
+++ b/packages/meshbay-node/tests/test_roster_pairing.py
@@ -737,8 +737,22 @@ def test_admin_authority_is_never_fetched_from_the_hub():
The fix M3 invites: ask the hub which key belongs to the operator. That would
hand a malicious hub the node — the same substitution as H3, one level deeper.
"""
- source = (Path(__file__).parent.parent
- / "src" / "meshbay_node" / "daemon.py").read_text()
- admin_region = source[source.find("_legacy_admin_pk"):]
- assert "pubkeys" not in admin_region.split("def ")[1], (
- "node authority must never be resolved through a hub lookup")
+ src = Path(__file__).parent.parent / "src" / "meshbay_node"
+
+ verifier = (src / "transport" / "webrtc_server.py").read_text()
+ body = verifier[verifier.index("async def _verify_admin_sig"):]
+ body = body[:body.index("\n def ", 1)]
+ assert "operator_pks" in body, "the roster is where authority comes from"
+ # Past the docstring: it names what was removed on purpose, so a reader knows
+ # not to put it back. What must not reappear is code.
+ code = body[body.index('"""', body.index('"""') + 3):]
+ for forbidden in ("hub", "pubkeys", "admin_pk_ed25519"):
+ assert forbidden not in code, (
+ f"_verify_admin_sig mentions {forbidden!r} — authority must come from "
+ "the local roster and nothing else")
+
+ daemon = (src / "daemon.py").read_text()
+ assert "has_operator()" in daemon, "the daemon reads authority from the roster"
+ assert "admin_pk_ed25519" not in daemon, (
+ "the node.toml operator key is gone; it must not come back as a second "
+ "source of authority")