Blender add-on: server hardening (opt-in session token, intent purge, bind guard) #1
Loading…
Reference in a new issue
No description provided.
Delete branch "libby/blender-server-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hardens the Blender add-on's CultMesh server (
surfaces/blender/brokkr_bridge).What it does
Always on
brokkr.blender.command_intent.v0record in the node (.brokkr/blender-editor.ccmp) and everyblender/commands/*.jsonunder the debug root.cultlib_py_srcpathcultmesh_pywas loaded from.Serve Host(0.0.0.0, LAN address, any hostname butlocalhost) is refused unless Allow Non-Loopback Bind is ticked by hand in the add-on preferences. While such a server runs the panel shows a warning.Opt-in, default OFF: Require Session Token
secrets.token_urlsafe(32)token, shows it in the panel, and the server rejects every document put and delete without it in a top-levelsessionTokenenvelope field. Checked on every write, not only at connect. Reads stay open. Stop/quit/disable revokes it. Held in memory only, never saved.cultnet.error.v0(that code list is closed; no new code added).Why the token is opt-in
Per Meta (operator, owner of the machine): per-write access control on internal infrastructure is not worth the friction by default. The cheap controls that remove real exposure (stale-intent purge, loopback-only unless deliberately widened, visible bind/path) stay mandatory; the token is there to switch on when wanted.
Design notes
server_guard.pyis stdlib-only (no bpy). The token check is a subclass ofcultmesh_py.CultMeshLocalServeroverriding_handle_connection_message, the one method every TCP and RUDP message passes through. That is a private method of CultLib; if it is renamed,test_token_on_refuses_unauthenticated_put_on_the_real_serverfails.cultlib_py_srcchanges between starts. The path is displayed at every start instead.Tests
CULTLIB_PACKAGES=<CultLib>/packages python -m unittest discover -s surfaces/blender/tests -v: 17 tests, all pass here with CultLibmainand msgpack (token randomness/exact match/revoke, per-put check, reads open, bind rules, purge of node + debug files only, stop revokes+purges, real server: default has no token and purges stale files, token on refuses a bare put, non-loopback refused). WithoutCULTLIB_PACKAGESthe 3 real-server tests skip.Not tested
Blender itself (not installed or run): the panel drawing, the preference properties, the Start operator's error reporting. RUDP path of the real server is covered only through the shared method, not over a socket.
Not merged.
🤖 Generated with Claude Code