Repository navigation
humd: refuse a hello that does not declare a compatible protoVersion - #65
Merged
Merged
Conversation
WIRE.md already said bee and protoVersion were required in a hello, and that a mismatch was a warning. Neither was true: the field was parsed with unwrap_or(THRUM_VERSION), so an absent declaration was silently read as agreement with whatever humd currently speaks, and the value was never compared to anything. Any process that could open the socket could claim any protocol version, including none at all. Now a hello with no protoVersion is refused, and so is one whose major differs or that fails to parse. Minor and patch drift is admitted with a warning. A refused bee gets an echo naming the reason, is not registered, is not announced to the ensemble, and is disconnected via thrum_close -- so it cannot go on to send tones it was never admitted for. Verified by sim/tests/admission_gate.rs. With the gate removed, the no-version and wrong-major cases both leave the client connected. WIRE.md updated: it described the policy that was intended, not the one in the tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of the socket admission work. The spec already required
protoVersion; the tree did not enforce it.The hole
WIRE.mdsaidbeeandprotoVersionwere required in a hello, and that a mismatch was "a warning, not a hard error". Neither statement matched the code:An absent
protoVersionwas read as agreement with whatever humd currently speaks, andprotowas never compared to anything at all — not even to emit the documented warning. So the warning did not exist either.Consequence: any process that can open
$XDG_RUNTIME_DIR/hum/thrum.sockcan present any hello and be admitted on any terms, including declaring no protocol version. The socket is the whole third-party surface, and it had no admission contract.This is not hypothetical.
damanfi/bridgeconnects today and sends a hello with noprotoVersion. Under this PR it is disconnected with a stated reason instead of being silently assumed current.What this PR does
protoVerdictcompares a declared version toTHRUM_VERSION: exact, same-major, or incompatible.protoVersion→ refused. Different major → refused. Unparseable → refused.thrum.hello.proto-drift.thrum_close. It cannot go on to send tones it was never admitted for.WIRE.mdupdated to describe what the tree now does.All four first-party hives (
bp7,ollama-server,paid-oracle,gsm-modem) already sendprotoVersion, so none of them are affected.Proof
sim/tests/admission_gate.rs— three cases: no version refused, wrong major refused, minor drift admitted.Removing the gate and running the same file:
Restored:
3 passed. Full sim suite (18 binaries) andhumd --lib(42 tests) green; clippy clean onhumdandsim.Not in this PR
Deliberately, because each needs its own decision and blast radius:
chisis recorded and gossiped but never filters anythingHumdRegistryTracked in #66.
Kernel, not library: this closes admission for anyone writing a bee against the socket without hum knowing they exist.