The LAN entry point: members call and follow topics over HTTP with a token (#4) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "neptunus/4-lan-entry-point"
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?
Refs #4
P4, the LAN entry point (docs/DESIGN.md §4.2). Clients that are not BEAM nodes (Martha, lazymartha, macula-mcp) call the cluster's capabilities and follow its topics as a named member, with no station. It is off unless the
lanmap namesentry => #{address, port}. The wire is in guides/lan_transport.md, "The entry point".Stacked on P3 (#7, PR 8), which supplies
mcl_core_lan:call_as/6. The base isuranus/7-bridge, so the diff shows P4 alone. It is retargeted to main once PR 8 lands. File overlap with P3: none in src beyond the one export P4 uses. P4 touchesmcl_core_lan_sup.erlandmcl_core_health.erl, which P3 does not.Threat model, written before the code: #4 comment 8392 (T1-T11).
Done-when, each tested in
test/mcl_core_lan_entry_SUITE.erl, a real peer node with this test node as the HTTP client:lan_membersgets no challenge:a_key_not_on_the_list_gets_no_challenge, with its control.a_challenge_is_redeemed_only_once.a_key_that_is_not_the_node_id_is_refused. The refusal spends nothing, and a bad signature is refused too. The node id ismacula_node_keys:node_id(Pub, Profile), a labelled hash of profile and key, not a bare SHA-256; this is how the advisory is met.a_removed_member_is_refused_at_its_next_call. Its event stream ends at the next event too:a_removed_members_stream_ends_at_its_next_event.a_public_address_starts_no_listener, with a loopback control.Also tested:
opencapability."caller"the client sends is dropped.nodes_onlygivescaller_refused, and a capability nobody serves gives 404no_lan_provider.mcl_core_lan_entry_tests): the HKDF RFC 5869 case 3 vector; every altered token byte refused; expiry, version and role checks; the member-list parsing and its others-may-write refusal; the per-node challenge cap; the private ranges; the JSON form of replies.Mutants on the guards, 11/11 killed:
Local gate (OTP 28, rebar 3.28.0): check-sealing_test, lint, xref, eunit 567/567 and dialyzer are ok, and the docs snippet check gives 0 failures. ct: every suite passes, including this one at 8/8, except
mcl_service_template_SUITE. That suite refuses in init_per_suite on this box:~/.config/rebar3/templateslinks to an old mcl-om clone. That is the box's setup, not this change; CI runs that suite.Not in this PR (as built, docs/DESIGN.md §9):
🤖 Generated with Claude Code
Clients that are not BEAM nodes (Martha, lazymartha, macula-mcp) reach a LAN cluster's capabilities and topics as a named member, with no station (docs/DESIGN.md §4.2, P4). Off unless the `lan' map names `entry => #{address, port}'. - The address must be private or loopback; any other starts no listener and /health names `{lan_entry, {not_private, Address}}'. - `lan_members' in data_dir lists who may take a token; read on every request, fails closed, and names nobody when others may write it. - POST /lan/v1/challenge, /token: a single-use 60 s challenge, a token request carrying the key whose node id (macula_node_keys:node_id/2) is the one claimed, signed over a labelled message. The token is HMAC-SHA256 under HKDF(gossip secret, "mcl-lan token v1"), 15 minutes, verified on any node. - POST /lan/v1/call: mcl_core_lan:call_as/6 as the token's node id; a client-sent "caller" is dropped. GET /lan/v1/events: server-sent events until the token expires or the member leaves the list. Threat model: mcl-core#4 comment 8392. Stacked on P3 (78ee6b0) for call_as/6.Landed by fast-forward: main is
914650aed7(frome728bd59). This repository does not allow the manually-merged style, so the PR is closed by hand.Pull request closed