Skip to content

arisrv: a record of each client, its username and its connections, under a client id (ID1) - #1293

Merged
transfix merged 7 commits into
masterfrom
feat/arisrv-identity
Nov 19, 2026
Merged

transfix merged 7 commits into
masterfrom
feat/arisrv-identity

Conversation

@transfix

@transfix transfix commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

This PR now carries ID2 and ID3 too. #1295 (the guest password, and rcon with the admin's server.* calls) was squash-merged into this branch as 2593bb1 on Joe's "merge 1295". This PR's squash takes ID1-ID3 to master together. Master was merged in again as f0c179a, on 2026-11-18, after #1290 and about a hundred others. There were two additive conflicts: src/cvc/CMakeLists.txt's source line, and an include next to arisrv main.cpp's. Everything was retested on the merge:

  • the 14 suites, room_relay_integration (25) and the five identity, guest-password and rcon ctests;
  • the /Zs check of arisrvx's main.cpp.

This is the first part of the identity and admin work in docs/roadmap/ARISRV_IDENTITY.md, which this PR adds. It's stacked on #1283 (G4), because both touch arisrv's call_step. It will be rebased onto master when #1283 lands.

What it adds

A record of every client. The relay keeps a client_registry, a caller-owned object in arisrv's main(), with no singleton.

  • Each client gets a client id: c plus 31 hex digits of a salted SHA-256 of its device id. A client that sends no device id is hashed on its addresses instead.
  • Joe chose (D1) to keep the IP addresses out of the hash, so a laptop that moves to another network keeps its id and its name. The addresses go in the record's log.
  • Each record holds:
    • its username;
    • its room device tag, once the device has proved its key;
    • first and last seen;
    • whether it is active;
    • a log of its last 32 connections. Each entry has the pid, the transport, the public address, the local address, when it opened and closed, and whether it is active.
  • At most 4096 records are kept. When the cap is hit, the client that left longest ago is forgotten. Both caps are flags (--clients-max, --client-log-max).
  • Records are kept for this run only.

Kept private. The records are mirrored under arisrv.clients.*. That root is outside conf and every publish: namespace, so no client is ever sent it. The e2e test subscribes to arisrv and checks that nothing arrives.

Usernames belong to the server. participants.<pid>.profile.name is now relay-owned (room_write_gate), and the relay writes it from the record.

  • room_join on a relay asks for the name with server.set {username, unique: true} instead of writing it. In a mesh it still writes it itself.
  • A name is 1 to 32 bytes of UTF-8 with no control characters. It must be unique among active clients, ignoring case.
  • A new client is guest-xxxx. A returning client keeps its last name.
  • A client may rename at most 4 times a minute.

The relay's own calls. These are reserved server.* names, which call_step answers before a call can reach Python, in stock arisrv as in arisrvx:

  • (room-call "server.whoami") returns {client_id, username, verified, device, admin};
  • (room-call "server.set" (dict "username" "ana")) renames the caller;
  • any other server.* name is not_found.

Transport changes:

  • Hello.local_address (field 5) carries the client's own end of the connection. It comes from local_address_toward, which connects a UDP socket toward the relay, sends nothing, and reads the socket's local address. A browser sends "".
  • Each state_link_report now has the connection's number, the peer address the relay saw, and the reported local address.

Tests (Windows, Release, gRPC + WS)

  • client_registry_test, 13 cases:
    • the id and its fallback;
    • when a connection opens and closes;
    • a returning client;
    • both caps and eviction;
    • username cleaning, uniqueness and the rate limit;
    • a takeover of a pid;
    • the device tag;
    • what it writes into the tree, including trimmed connections and evicted records leaving it.
  • room_relay_integration_test:
    • AClientsRecordComesFromItsLink: real gRPC and WS links carry the local address, the peer address and a connection number into the registry.
    • RoomJoinAsksTheRelayForItsName.
  • arisrv_identity_grpc and arisrv_identity_ws: stock arisrv against ari test, covering whoami, set, the refusals, and that arisrv.* never reaches a client.
  • The gate tests now treat profile.name as the relay's.
  • These suites still pass: room_intrinsics, room_chat, room_aoi, room_aoi_relay, room_avatar, room_media, room_scene, state_identity, state_device_key, state_link_stats, state_transport_grpc, state_transport_ws and room_relay_integration. All of these were run on this branch, on Windows (Release), over gRPC and WebSocket.

Not in this part

  • ID2: the guest password.
  • ID3: rcon and the admin calls. admin in server.whoami is always false until then.
  • ID4 (the arisrvx session): per-client guest limits, Python guests in python.wasm, host.clients, ctx.client and @host.geolocate. The geo fields of the log come with ID4c.

After review (37840b9)

The arisrvx session reviewed this. Changes:

  • Packaged clients keep their names. A client that predates server.set, such as a packaged ari or arigl, writes profile.name itself.
    • The gate still refuses that write. It now also hands the value to the relay (room_write_gate::set_name_requests), which grants it on the room loop as a rename with unique.
    • This matters because cypkg's and nicotina's CI and users run the packaged hosts.
  • No names without bound writes. With --bind-writes off there's no gate, so the relay writes no names, as before.
  • Fresh links for every server.* call. Each call first updates the registry from the links as they are now. A pid taken over since the last pass then belongs to its new holder.
  • IPv6 peers. The WebSocket transport now writes an IPv6 peer as [::1]:5678, as gRPC does. ::1:5678 couldn't have its port removed.
  • A new RoomWriteGate.AClientsOwnNameWriteIsARenameRequest test covers the gate. Retested: room_intrinsics, client_registry, state_transport_ws, the relay integration cases, and arisrv_identity_grpc/_ws.

The bridged-users fix (0390dc8)

After master was merged in, #1302's arisrvx_bridge_arigl_ws failed: on CI it timed out, and locally both variants failed. arigl joined as Alice and posted at once, and the bridge's echo carried her pid instead of her name.

The cause: server.set had succeeded, but the relay wrote names only for participants already present. The call arrived before the presence.joined that room-join wrote with it, so the name waited for the next net step, about 250 ms later.

The fix:

  • server.set now writes the caller's profile.name at once (client_registry::write_name), whether the caller is present yet or not.
  • An older client's own name write is granted every room step instead of every net step.

Reproduced and checked locally with arisrvx, pycvc and arigl built: arisrvx_bridge_arigl_grpc/_ws pass in 1.8 s each. So do the arigl room-call tests, all 60 arisrvx, arisrv, pycvc_ariadne and arix ctests (arisrvx_rcon_admin_role among them), and client_registry_test (21). The eight wasm reds are the cvcpkg bundle break that #1360 pins around.

…der a client id (ID1)

The relay now keeps a client_registry (docs/roadmap/ARISRV_IDENTITY.md, which this adds). Each
client gets an id, "c" and 31 hex digits of a salted hash of its device id, or of its addresses
when it sends none. Its record holds its username, its device tag, first and last seen, whether
it is active, and a log of its last 32 connections (pid, transport, public and local address,
opened, closed, active). The records are mirrored under arisrv.clients, outside conf and every
publish: namespace, so no client is sent them; they last for this run only.

profile.name is now the relay's. room_join on a relay asks for its name with server.set, and the
relay writes it, unique among the active clients. server.whoami and server.set are reserved names
that call_step answers itself, before a call can reach Python.

Hello gains local_address (the client's own end, from a UDP socket connected toward the relay),
and each link report its connection number, peer address and reported local address.
…eers in brackets

From the arisrvx session's review of ID1:

- A client that predates server.set (a packaged ari or arigl) writes its own profile.name. The gate
  still refuses that write, and now hands its value to the relay (room_write_gate::
  set_name_requests), which grants it as a rename on the room loop, made unique. Such a client keeps
  its name instead of showing guest-xxxx.
- Without bound writes there is no gate, so the relay leaves the names to the clients, as before.
- Every server.* call first takes the links as they are, so a pid taken over since the last pass is
  its new holder's.
- The WebSocket transport writes an IPv6 peer as "[::1]:5678", as gRPC does, so its port can be cut
  off. Before, "::1:5678" gave each connection of one client its own address.
@transfix
transfix force-pushed the feat/arisrv-identity branch from 37840b9 to 38a5793 Compare November 16, 2026 06:01
transfix added a commit that referenced this pull request Nov 16, 2026
…-in calls)

arisrv answers server.* room-calls itself, before a call reaches Python
(the identity work's ID1, #1293). An @export with such a name could
never run, so export() now raises ValueError for one.

Test: two new checks in test_pycvc_ariadne_server.
…s server.* calls (ID2, ID3) (#1295)

ID2: --guest-password-file / CVC_ARISRV_GUEST_PASSWORD takes any text a person can type. A
client presents guest_password_bearer(password), a SHA-256 hash in the room token's slot, so the
transports' check before admission does the work. A relay takes a room token or a guest password,
not both. Clients take it from CVC_ARIADNE_GUEST_PASSWORD, a relay block's password:, or a page's
#password=.

ID3: --rcon-password-file / CVC_ARISRV_RCON_PASSWORD. server.rcon makes the caller's connection
an admin until it closes or loses its pid. Wrong passwords lock out after three (rcon_guard).
Without TLS, rcon is taken only from the loopback unless --rcon-plaintext. An admin's calls are
server.clients, client, kick (state_transport::disconnect_connection), ban/unban, rename and
limits (client_limits, in ServerDocument::set_client_limits's shape). In arisrvx an elevated
connection's ctx.principal has the role admin, and ctest arisrvx_rcon_admin_role covers it.

ARISRV_IDENTITY.md records D1-D4, with D2 settled: a client's limits may go above the document's
caps, up to the ceiling.
# Conflicts:
#	src/arisrv/main.cpp
#	src/cvc/CMakeLists.txt
transfix added a commit that referenced this pull request Nov 19, 2026
…-in calls)

arisrv answers server.* room-calls itself, before a call reaches Python
(the identity work's ID1, #1293). An @export with such a name could
never run, so export() now raises ValueError for one.

Test: two new checks in test_pycvc_ariadne_server.
@transfix
transfix enabled auto-merge (squash) November 19, 2026 00:59
… joining carries it

arisrvx_bridge_arigl_* (#1302's bridged users) failed on this branch: arigl joined as Alice and
posted at once, and the bridge's echo said "echo Alice_xlq7eb: hello hub", the pid, not "echo
Alice: hello hub".

server.set had succeeded, but the relay wrote a name only for a participant already present. The
call came before the presence.joined that room-join wrote with it, so the name waited for the next
net step, about 250 ms later. Before this branch, the client wrote its own name in the same batch
as its presence.

Now:
- server.set writes the caller's profile.name at once (client_registry::write_name), present or
  not. The roster shows nobody until their presence.joined, so an early name shows nothing.
- An older client's own name write, refused by the gate, is granted every room step, before the
  calls, instead of every net step.
transfix added a commit that referenced this pull request Nov 19, 2026
cy-pca/cvcpkg#624 republished boost, datachannel-wasm, freetype, libjpeg-turbo, libpng, lua,
mujoco, mujoco3, qhull, tiff and vtk for wasm and wasm-mt, built with -fwasm-exceptions.
libcvc still builds with JS exceptions until JX2, and the two don't link. #1293's physics
replay failed because libboost_thread.a needs __cpp_exception.

.github/scripts/pin-wasm-pre-jx1.sh runs after a wasm job installs its deps. For each pinned
package the prefix holds, it re-installs the last bundle built the old way, with
cvcpkg install --no-deps, then checks the lockfile. Seven jobs call it: physics replay, ports,
wasm-guests, permissive geometry, ari terminal backend, arigl-web and ariglx-web. JX2 deletes
the script and its calls.
@transfix
transfix merged commit 03402f5 into master Nov 19, 2026
29 checks passed
@transfix
transfix deleted the feat/arisrv-identity branch November 19, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant