Repository navigation
fix(mcp): require a per-daemon token for STOP and REPORT_HYPERD_ERROR - #387
Open
StefanSteiner wants to merge 1 commit into
Open
StefanSteiner wants to merge 1 commit into
StefanSteiner wants to merge 1 commit into
Conversation
Each daemon start generates a random control token and publishes it in the owner-only daemon.json. STOP and REPORT_HYPERD_ERROR must carry it; otherwise the daemon answers ERR unauthorized and changes nothing. PING, HEARTBEAT and STATUS stay open, and the token never appears in STATUS, doctor output or logs. daemon.json and STATUS gain protocol_version (1). A takeover refused by a token-checking daemon fails at once with PermissionDenied. Phase S.1 of the hyperdb-daemon extraction design.
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.
Summary
Phase S, task S.1 of the
hyperdb-daemonextraction design (#385): the daemon's state-changing health commands now require a per-daemon control token, and the daemon record carries a protocol version.control_tokenin the owner-onlydaemon.json. Clients sendSTOP <token>andREPORT_HYPERD_ERROR <token>; a missing or wrong token getsERR unauthorizedand changes nothing, so a rejected report cannot trip the restart limiter.PING,HEARTBEATandSTATUSare unchanged.ControlTokenis a newtype with a redactedDebugand a constant-timematches. It never appears inSTATUS,doctoroutput or logs. A client uses the token only if the record's endpoint matches the daemon it is talking to.daemon.jsonandSTATUSgainprotocol_version(1; absent means0).PINGis unchanged in this phase.STOP, version takeover fails at once withPermissionDeniedinstead of waiting out the stop timeout, and never spawns a second daemon.hyperdb-mcp daemon stopdistinguishes "no token found" from "token rejected".Compatibility
Upgrade every
hyperdb-mcpclient together. A newer client talking to an older daemon (no token in the record) sends the bare command as before. An older client talking to a newer daemon getsERR unauthorizedonSTOPandREPORT_HYPERD_ERROR: it cannot stop or take over the daemon, and loses the fast restart path (the daemon's 5 s liveness poll still applies). Details inhyperdb-mcp/CHANGELOG.md.Test plan
cargo fmt --check;cargo clippy --workspace --all-targets --all-features -- -D warningsx86_64-pc-windows-msvc,-p hyperdb-mcp --all-targets --all-features -D warnings): exit 0cargo test -p hyperdb-mcp(absoluteHYPERD_PATH, pinned hyperd 0.0.26479): 37 suites, 805 passed, 0 failed, 20 ignoredcargo testbefore the review fix round: 2045 passed, 0 failedSTOP/REPORT_HYPERD_ERRORleave state unchanged, endpoint-mismatch token ignored, takeover fails fast on a refusedSTOP