A realm call relayed by the bridge: mcl_core:call_realm/3 #10

Closed
opened 2026-12-02 13:12:10 +00:00 by venus · 0 comments
Member

Purpose (capability): a service on a LAN member can call a realm procedure, such as the realm's crew_standing, through its cluster's bridge, the way it already calls a capability.

The gap

The bridge relays two things today: call_capability/5 (an org-scoped DHT lookup) and publish/3 (src/bridge/mcl_core_bridge.erl:56-65). A realm procedure is dialled directly with macula:call(Pool, Realm, Procedure, ...) on mesh_handles/0. On a member that answers {error, mesh_unavailable}, because a member has no pool. mcl-kanban's crew_standing reconciler does exactly this (crew_standing_reconciler.ex:105-108). DESIGN §5 points it at "call_capability with a realm target", which does not exist.

What

  • mcl_core:call_realm(Procedure, Payload, TimeoutMs) -> {ok, Reply} | {error, Reason}: the direct dial macula:call(Pool, Realm, Procedure, Payload, TimeoutMs), run on the node that holds the mesh pool.
    • standalone (LAN off) or bridge: runs here. No pool: {error, mesh_unavailable}, as mesh_handles/0 gives.
    • member: relayed over erpc to the bridge node, the same way outbound call_capability/5 is relayed: the call's own timeout plus the relay margin, and {error, {bridge_unreachable, R}} when the hop fails. With no bridge in the cluster, it answers as a node with no pool.
  • Additive: nothing that exists changes. Released as 1.1.0 (the tag goes through the Supervisor and Raf).

Out of scope: relaying mesh events onto the LAN. The member's 60 s reconcile stays its path for crew facts.

Threat model

  • Who can make the bridge call a realm procedure: a node in the cluster's Erlang distribution, that is, a holder of the cluster cookie. That node can already erpc any function on the bridge, so the new call opens nothing to it that it did not have. An outside attacker never reaches it: there is no new listener and no new LAN HTTP route.
  • What the realm sees: the bridge's node identity, never the member's. A realm procedure that decides per calling node treats every member as the bridge. This is the same for relayed call_capability today. It is stated in the docs; it is not a new trust.
  • Payload and reply: passed through unchanged. Nothing is signed or verified on the relay: macula signs and verifies the mesh hop, and a reply that needs verifying (kanban's realm signature) is verified by the caller as today.
  • Resource use: one erpc per call, bounded by the caller's timeout plus the relay margin. No new queue, no retry.

Done when

  • mcl_core:call_realm/3 on a standalone or bridge node makes the direct dial with this node's pool and realm, and answers {error, mesh_unavailable} with no pool.
  • On a member the call runs on the bridge node. A peer-node suite case proves it runs on the bridge, with the bridge's own call as the control.
  • A member with no bridge answers {error, mesh_unavailable} (peer case).
  • Mutants on the new path (no relay; relay to the wrong node; handles ignored) each fail a test.
  • The whole local gate is green: ct (including the peer suites), eunit, lint, xref, dialyzer, ex_doc. CHANGELOG has a 1.1.0 entry, and the bridge guide and DESIGN §5 name the call.

Refs macula-services/mcl-kanban#16

Purpose (capability): a service on a LAN member can call a realm procedure, such as the realm's `crew_standing`, through its cluster's bridge, the way it already calls a capability. ## The gap The bridge relays two things today: `call_capability/5` (an org-scoped DHT lookup) and `publish/3` (`src/bridge/mcl_core_bridge.erl:56-65`). A realm procedure is dialled directly with `macula:call(Pool, Realm, Procedure, ...)` on `mesh_handles/0`. On a member that answers `{error, mesh_unavailable}`, because a member has no pool. mcl-kanban's crew_standing reconciler does exactly this (`crew_standing_reconciler.ex:105-108`). DESIGN §5 points it at "call_capability with a realm target", which does not exist. ## What - `mcl_core:call_realm(Procedure, Payload, TimeoutMs) -> {ok, Reply} | {error, Reason}`: the direct dial `macula:call(Pool, Realm, Procedure, Payload, TimeoutMs)`, run on the node that holds the mesh pool. - standalone (LAN off) or bridge: runs here. No pool: `{error, mesh_unavailable}`, as `mesh_handles/0` gives. - member: relayed over erpc to the bridge node, the same way outbound `call_capability/5` is relayed: the call's own timeout plus the relay margin, and `{error, {bridge_unreachable, R}}` when the hop fails. With no bridge in the cluster, it answers as a node with no pool. - Additive: nothing that exists changes. Released as 1.1.0 (the tag goes through the Supervisor and Raf). Out of scope: relaying mesh events onto the LAN. The member's 60 s reconcile stays its path for crew facts. ## Threat model - **Who can make the bridge call a realm procedure:** a node in the cluster's Erlang distribution, that is, a holder of the cluster cookie. That node can already erpc any function on the bridge, so the new call opens nothing to it that it did not have. An outside attacker never reaches it: there is no new listener and no new LAN HTTP route. - **What the realm sees:** the bridge's node identity, never the member's. A realm procedure that decides per calling node treats every member as the bridge. This is the same for relayed `call_capability` today. It is stated in the docs; it is not a new trust. - **Payload and reply:** passed through unchanged. Nothing is signed or verified on the relay: macula signs and verifies the mesh hop, and a reply that needs verifying (kanban's realm signature) is verified by the caller as today. - **Resource use:** one erpc per call, bounded by the caller's timeout plus the relay margin. No new queue, no retry. ## Done when - [ ] `mcl_core:call_realm/3` on a standalone or bridge node makes the direct dial with this node's pool and realm, and answers `{error, mesh_unavailable}` with no pool. - [ ] On a member the call runs on the bridge node. A peer-node suite case proves it runs on the bridge, with the bridge's own call as the control. - [ ] A member with no bridge answers `{error, mesh_unavailable}` (peer case). - [ ] Mutants on the new path (no relay; relay to the wrong node; handles ignored) each fail a test. - [ ] The whole local gate is green: ct (including the peer suites), eunit, lint, xref, dialyzer, ex_doc. CHANGELOG has a 1.1.0 entry, and the bridge guide and DESIGN §5 name the call. Refs macula-services/mcl-kanban#16
venus closed this issue 2026-12-02 15:02:37 +00:00
Sign in to join this conversation.
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
macula-services/mcl-core#10
No description provided.