Repository navigation
feat(host): add cmd/host binary, make host plugin targets, and /healthz on ZAP (#4) - #7
Merged
Merged
Conversation
Member
|
Thank you @chaos666888, these line up exactly with the issues we filed, and four clean PRs with green CI is a great first contribution. We're reviewing them now and will follow up here with any changes. |
Member
|
Thanks @chaos666888, this is a real fix for the gaps in #4:
|
… master key handling Addresses review feedback on hanzoai#7: - Default cmd/host HTTP listener to loopback (127.0.0.1:3690) when -addr/-listen/CLOUD_LISTEN/CLOUD_ADDR/PORT are unset, and only auto-enable staged functions on loopback listeners. - Validate existing ZAP socket paths with os.Lstat before os.Remove in Serve() so regular files, directories, and symlinks are never deleted. - Use O_CREATE|O_EXCL (mode 0600) for <stateDir>/master.key, log minted/loaded status without leaking key material, and fail closed on write errors instead of keeping a process-only key. - Add unit tests covering key mode 0600, existing key reuse, concurrent exclusive create, failed write cleanup, non-socket preservation, and loopback default.
Contributor
Author
|
Thanks for the detailed review @zeekay — addressed all four points in 7b3fae5:
Ready for another look! |
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.
Closes #4
/claim #4
Summary
hanzo network startinhanzoai/clilooks for~/work/hanzo/cloud/bin/host(telling the user to runcd ~/work/hanzo/cloud && make host plugin), spawnsbin/host -addr <addr>(plus-zap <state_dir>/host.zap.sockon Unix), and pollsGET /healthzover the ZAP unix socket (host.zap.sock) until it receives HTTP 200.Previously:
Makefilehad nohostorplugintargets and nocmd/hostentrypoint existed (bin/hostwas never built).config.godid not register-zap, and whenhanzo-cli 8.5.158launchedbin/hostwithout-zap,ZAPListenAddrdefaulted to TCP127.0.0.1:9653instead of the unix socket<state_dir>/host.zap.sock./healthzand/readyzwere only mounted on the separatehealthMux()(127.0.0.1:9090), not onapp(*zip.App), soGET /healthzover the ZAP socket or HTTP-addrfell through to the console catch-all / 404.Changes
cmd/host/main.go: Added the local network daemon entrypoint sharingcloud.Serve(apps.Wire(), nil)with user-writable local defaults under<state_dir>(${XDG_DATA_HOME}/hanzo/host,~/Library/Application Support/hanzo/hoston macOS,~/.local/share/hanzo/hoston Linux), defaultingCLOUD_ZAP_LISTENto<state_dir>/host.zap.sockon Unix and auto-minting<state_dir>/master.keywhenCLOUD_KMS_MASTER_KEY_REFis unset.Makefile: Addedhost(go build -o bin/host ./cmd/host) andplugintargets somake host pluginbuildsbin/hostcleanly.config.go: Registered the-zapflag (flag.StringVar(&cfg.ZAPListenAddr, "zap", ...)).serve.go&webui_test.go: AddedmountHealth(app)soGET /healthzandGET /readyzreturn200 {"status":"ok"}directly onapp(over both ZAP and HTTP), ensured parent directory creation and stale socket cleanup for.sockZAP paths beforeapp.Listen, and added/healthz+/readyztest cases toTestTmpConsole.Payout Wallet (Solana USDC):
EdbgyAcVC5MNaFGph2UgvnBUP7WxxNyXZUzsHHifQyAE