cultmesh-py: peer writes need a write authority (default-deny) #33

Merged
libby merged 4 commits from libby/cultmesh-py-remote-write-authority into main 2026-11-07 19:19:28 +00:00
Member

Mirrors C# CultNetDatabaseServer.Authorize / ICultNetRemoteWriteAuthority.

Breaking (0.x): a served node refuses every peer document_put_raw/document_delete unless a write_authority grants it. Refusal is a typed write_not_authorized error carrying the record key (bytes pinned to error-vectors.json). An authority that raises or returns nothing refuses. CultMeshGrantAllWrites and daemon --allow-peer-writes are the explicit opt-in. serve_node and session.serve take write_authority.

The gate runs before any other judgment of the put, so a refused peer learns nothing about what is registered. Malformed puts reach the gate under the ids as sent.

Tests: 12 in test_remote_write_authority.py port the C# behaviours (forwarding has no Python counterpart: this server does not forward). Existing server-put tests now pass CultMeshGrantAllWrites().

Verification: cultnet-py 142 OK; cultmesh-py 132 OK on a clean run. cultmesh-py intermittently fails with EADDRINUSE (TCP/UDP port pair) on this host, identically on unmodified main (3/3 runs failed there), so not introduced here.

Brokkr's Blender add-on relies on peer writes; separate PR passes grant-all.

🤖 Generated with Claude Code

Mirrors C# `CultNetDatabaseServer.Authorize` / `ICultNetRemoteWriteAuthority`. **Breaking (0.x):** a served node refuses every peer `document_put_raw`/`document_delete` unless a `write_authority` grants it. Refusal is a typed `write_not_authorized` error carrying the record key (bytes pinned to `error-vectors.json`). An authority that raises or returns nothing refuses. `CultMeshGrantAllWrites` and daemon `--allow-peer-writes` are the explicit opt-in. `serve_node` and `session.serve` take `write_authority`. The gate runs before any other judgment of the put, so a refused peer learns nothing about what is registered. Malformed puts reach the gate under the ids as sent. Tests: 12 in `test_remote_write_authority.py` port the C# behaviours (forwarding has no Python counterpart: this server does not forward). Existing server-put tests now pass `CultMeshGrantAllWrites()`. Verification: cultnet-py 142 OK; cultmesh-py 132 OK on a clean run. cultmesh-py intermittently fails with `EADDRINUSE` (TCP/UDP port pair) on this host, identically on unmodified main (3/3 runs failed there), so not introduced here. Brokkr's Blender add-on relies on peer writes; separate PR passes grant-all. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Adds write_authority.py, node.raw_put_target/raw_delete_target, the gate in
_handle_raw_put/_handle_raw_delete with the peer passed in, and serve_node/serve params.
Missing: __init__ exports and imports in facade.py/session.py, daemon --allow-peer-writes,
tests, README and Breaking note. Untested.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultmesh-py: peer writes need a write authority (default-deny)
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 5m36s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 20s
2947e15088
Finishes the remote-write gate: exports, daemon --allow-peer-writes, the gate is
total (an ungranted peer learns nothing from malformed/unowned-put replies),
existing server tests grant explicitly, 12 tests port RemoteWriteAuthorityTests
(forwarding has no Python counterpart), refusal bytes pinned to error-vectors.json.
README documents the breaking change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultmesh-py: gate runs before an ungranted peer's payload is touched
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
61a1d872b3
raw_put_target resolves only a put of the wire shape (string key, bytes payload),
so an int payload is never converted (bytes(10**9)) before the authority speaks.
Shard fields of the wrong type reach the authority as None. Tests: huge payload
refused without allocating, RUDP peer path (endpoint and transport), shard types.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultmesh-py: document why schema resolution precedes the write gate
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 5m39s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 30s
f074c3d45f
Comment at the gate and a README residual; no behaviour change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
libby merged commit e2dc04e724 into main 2026-11-07 19:19:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/CultLib!33
No description provided.