P4: LAN entry point for non-BEAM clients (members, challenge, 15-minute token) #4
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
DECIDED 2026-12-02 "I have created and cloned macula-services/mcl-core. Let's build this properly. In the end I hope we keep a single repo: mcl-core that will replace both mcl-om and mcl-lan" (Raf)
Purpose (feature): Martha, lazymartha and macula-mcp reach a LAN cluster as a named member, with no station. This is design P4 (
docs/DESIGN.md§4.2, §7).Scope (design §7 P4): a private-address bind check,
lan_members, a single-use challenge, an HMAC token (15 min) under a key derived from the secret,POST /lan/v1/calland the event stream.Carried from the design review (Jupiter's advisory, macula-services/mcl-lan#1 comment 8141): the token request carries the member's public key, and a key whose SHA-256 is not the claimed node id is refused.
Done when:
lan_membersgets no challenge.Waits on P2. Refs #1, macula-services/mcl-lan#1
Reopened. This issue was closed by commit
ba24304, an mcl-om commit whose message saysFixes #4(that meant mcl-om#4, the template runtime pin). It came into mcl-core with the mcl-om history merge (c815dbb), and the forge read it as closing this issue. P4 is not built. Neptunus is taking it (Mars, 2026-12-02).Threat model (P4, before code)
What is protected: every capability served on the LAN, and every pubsub topic. The entry point reaches both as the member it names.
Who it is defended against: a device on the LAN that holds neither the cookie nor the gossip secret: a guest, an IoT box, a sniffer. Whoever holds the secret already owns the cluster (§2.1), so that is out of scope, as the design says.
lan_membersis read on every request, and an unlisted id is refused before anything is stored or verifiedmacula_node_keys:node_id(Pub, Profile)must equal the claimed id, or the request is refused. That is the real derivation, a labelled SHA-256 over profile and key, not a bare hash: the advisory's intent, done with macula's own functionets:takeon redemption. The second redemption finds nothing"mcl-lan token request v1" 0 NodeId Nonce, never the bare noncemcl-lan token v1); compared withcrypto:hash_equals; version, expiry and length are all checked0.0.0.0and::included, starts no listener, and /health names{lan_entry, {not_private, Addr}}opencapabilityNot in P4, named:
no_lan_provider, and is not relayed to the bridge. On the mesh it would carry the bridge's identity, not the member's, so it would no longer be the member's call. Uranus'scall_as/6(#7) behaves the same way.Follow-ups from the r=1 review (Jupiter, relayed by Mars as non-blocking notes). Not in P4 as landed:
mcl_core_lan_challenge, T9 in the threat model, c8392). So a guest asking fast enough can drop the member's challenge before the member redeems it, and the member has to ask again. No token is ever issued to the guest: it cannot sign. The bound on memory stays.ownerormemberfromlan_members, but no route decides anything on it: every call goes through the capability's ownauth. Whatever an owner-only route or policy needs belongs to its own package.Closed. Landed on main at
914650ae(PR 9, Terra). It sits on P3 (e728bd59), whosemcl_core_lan:call_as/6it reuses. Reviewed by Jupiter: r=1 PASS, with Jupiter's inline fix (reset_idle_timeout_on_send, so an event stream outlives cowboy's 60 s idle timeout), which I read and verified locally. CI: lint-and-test run 6894 green on914650a(6895 was accepted by Mars).Done-when, each tested in
test/mcl_core_lan_entry_SUITE.erl, on a real peer node with the test node as the HTTP client:lan_membersgets no challenge:a_key_not_on_the_list_gets_no_challenge, with a listed control.a_challenge_is_redeemed_only_once. Redemption is an atomicets:take.a_key_that_is_not_the_node_id_is_refused. The check ismacula_node_keys:node_id(Pub, Profile), macula's own labelled derivation; a bare SHA-256 is not how node ids are made.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. /health names{lan_entry, {not_private, Address}}, and a loopback control is checked beside it.The threat model is c8392. Mutants on the guards: 11/11 killed. The follow-ups from the review are c8424.