HF-13: signed site-to-cloud link (heartbeat, referral outbox, cloud status) #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/HF-13-site-link"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
HF-13 Phase R "Site-to-cloud link" (docs/plans/2026-11-04-level2-hospital-it.html).
What
sitecron posts site id, deployed commit, unfinished deliveries and referral-queue depth toSITE_LINK_URLevery minute. Requests carryx-hf-link-timestamp,x-hf-link-nonce,x-hf-link-signature= HMAC-SHA256(SITE_LINK_SECRET,timestamp.nonce.body). The cloud rejects bad signatures, skew over 5 min, and replayed nonces (stored, pruned after 10 min).POST /v1/site-link/referrals(operator token) enqueues intosite_link_referrals; the cron drains it with the dispatcher's lease + fencing discipline. The cloud stores each idempotency key once (site_link_inbound_referralsprimary key), so a lost ACK + retry is harmless; a different payload under the same key is a 409 and the row is blocked.GET /site-link/v1/statusJSON andGET /site-linkpage: online if the last verified heartbeat is under 3 minutes old, last heartbeat, reported queue depth, referrals received. Synthetic only; no secrets or internal errors.siteLinkSend(site, local) andsiteLinkReceive(cloud, local). Every endpoint returns 404 unlessSITE_LINK_SECRET(≥32 bytes) is configured. Config, not hostname.0007_site_link.sql(bootstrap list, embed-migrations, check-sql updated). labnucinstall.shgeneratesSITE_LINK_SECRETinto site-secrets.env if missing;deploy.shmerges it andHF_COMMITinto the celld vars.Tests
npm run check: 61 pass. New integration tests: signature/skew/replay rejection, exactly-once delivery across a WAN cut and a lost ACK (plus expired-lease reclaim and key conflict), status online→offline with no secret leakage, and per-profile/secret gating.🤖 Generated with Claude Code