Repository navigation
humd: stop routing prompts on unverified capability claims - #67
Conversation
find-the-worker routed a prompt to whichever peer advertised the model. The claim is self-declared, so any connected peer could announce a model it does not have and receive the prompt. Two defects, addressed separately: A peer could announce under a Hid it does not own. handle_gossip published the payload and relayed it without checking that the announced humd_id was the sender. Reject that at the gossip entry point, where every announce funnels through. A peer can still over-advertise for its own Hid, and no check on the announce can distinguish that from an honest claim. Refusing the prompt would break discovery entirely, so remote routing is now opt-in via HUM_TRUST_REMOTE_WORKERS. Default off: a claim alone no longer moves prompt content. sim/tests/remote_routing_trust.rs covers both directions — a claiming peer gets nothing by default, and opting in still reaches the worker. Both fail if the corresponding gate is removed.
The provenance gate compared the payload's humd_id against the peer the tone arrived on. Multi-hop gossip breaks that: A advertises, B relays, C sees arrived_from=B while the payload claims A, so a legitimate advertise was refused after one relay. Compare against the tone's own from field, which is preserved across hops. An added test covers A-B-C directly.
|
Two fixes after review, both CI-caught rather than local-caught.
The provenance gate broke multi-hop gossip. It compared the payload's Now compares against the tone's own Rule 0 on the function body: All 8 checks green. |
Closes the routing hole I flagged an hour after landing #64.
What was wrong
A prompt with no local worker was routed to whichever peer advertised the model. That claim is self-declared, so any connected peer could announce a model it does not have and be handed the prompt.
Read from the code, not inferred:
publish_with_dusknever feeds the local subscriber, sohive_discover_allonly ever sees announces relayed from peershandle_gossippublished and relayed any announce without checking the announcedhumd_idagainst the peer that sent ithive_discover_allkeys the table byhumd_idtaken from the payloadpick_remote_workerfiltered on exactly two things: that claimed Hid is inens.peers(), and that the manifest claimsbee: ["worker"]+ the modelSo a peer could name any Hid and any model, and be selected.
Two defects, fixed separately
Claiming someone else's Hid —
handle_gossipnow rejects an announce whosehumd_idis not the sender's, at the single point every announce funnels through. This also stops relaying it, so the mesh agrees.Over-advertising for your own Hid — no check on an announce can catch this, because the claim is indistinguishable from an honest one. Refusing outright would break discovery entirely, so remote routing is now opt-in via
HUM_TRUST_REMOTE_WORKERS, default off. A claim alone no longer moves prompt content.That default is a product decision, not a technical limit — the honest fix is proof-of-possession or stake, and neither exists yet. Worth an issue; say the word and I'll write it.
Proof
sim/tests/remote_routing_trust.rs:a_prompt_is_not_forwarded_on_an_unverified_capability_claim— the claiming peer receives nothingopting_in_restores_discovery_routing— opt-in still reaches the workerBoth directions fail if the gate is removed (
if false→ 1 passed, 1 failed). New provenance tests inensemble/src/lib.rsfail the same way whenannounce_claims_senderis neutered.Full suites:
ensemble --lib107,humd --lib38,sim18/18 binaries, clippy clean on all three.Note: sim humds set
trust_remote_workers: trueso #64's discovery tests still exercise routing.spawn_humd_not_trusting_remote_workersis the production default.