Authentication, signing, and integrity
SiteHealth is the complete care system for your WordPress site, and the engine under all of it runs as a client of the Link Flow Hub. The plugin pulls fix code from the Hub, routes AI requests through the Hub, and verifies every payload it receives. The security model is documented first because operators evaluating SiteHealth need to understand it from day one. A public REST API for remote-site- management features lands here as that surface ships.
AUTH MODEL
API key for identity, OAuth for delegation, HMAC for integrity
SiteHealth uses three layered auth controls between the plugin and the Link Flow Hub, each doing a specific job. Together they answer "who's calling, what are they allowed to do, and is this payload untampered."
- API key for caller identity. Per-license API keys, stored in the sitehealth_api_key WordPress option. The plugin includes the key on its first call to the Hub's license validate endpoint, which is how the Hub identifies which license is making the call and which tier applies.
- OAuth 2.0 client-credentials for delegated access. The plugin exchanges its API key for a short-lived bearer token at the Hub's OAuth token endpoint. Subsequent calls for the fix-code bundle and AI proxy use that bearer token in the Authorization header. Short lived tokens mean a compromised token has a small blast radius.
- HMAC-SHA256 for payload integrity. Every Hub-to-site fix-code bundle is signed with HMAC-SHA256 using a per-license signing secret. The plugin verifies the signature on the raw response body before parsing or executing anything. License-state webhooks from the Hub are signed the same way.
Each layer has a clear purpose. Operators understand why all three exist rather than wondering whether one of them is redundant.
BUNDLE INTEGRITY
Signed, timestamped, and per-fix hash-verified
Fix code is delivered as a signed bundle. The plugin enforces three independent integrity checks before any fix code runs.
- X-Bundle-Signature header. Every bundle response carries an X-Bundle-Signature: sha256={hex_hmac} header. The plugin computes the expected HMAC over the raw response body using the per-license signing secret and rejects the bundle on any mismatch. Missing header or missing local signing secret also rejects.
- issued_at timestamp with a 1-hour staleness window. Bundles older than 3600 seconds are rejected as possible replays. Bundles with a timestamp more than 300 seconds in the future are rejected as possible tampering. That 5-minute future tolerance is the only clock-skew allowance.
- Per-fix code_hash. Each fix carries its own SHA-256 code_hash. The plugin re-verifies the hash against the actual code immediately before executing the fix. Mismatched or missing hash blocks execution. The check is intentionally placed right before eval to prevent any time-of-check / time-of-use gap.
Beyond these checks, an emergency kill switch (sitehealth_disable_remote_fixes) blocks all remote fix execution when set, regardless of signature validity.
CACHING
72-hour cache, 24-hour refresh, single daily Hub validation
The plugin caches license state and the fix-code bundle on the site to keep Hub load predictable.
- License data and tier definitions cache for 72 hours. Past the 24-hour refresh threshold the cached value is still returned, and a background WP-Cron event refreshes the cache so the next read is fresh.
- The fix-code bundle caches for 72 hours with the same 24-hour refresh threshold. The plugin sends the cached bundle version on refresh requests so the Hub can short-circuit with a "no refresh needed" response when the site is current.
- A single daily WP-Cron event is the only scheduled Hub-validation path. Per-admin-init and per-fix validation paths were removed deliberately to keep fleet-wide load predictable.
Webhooks from the Hub (see below) clear these caches immediately when the Hub state changes, so the cache cadence does not delay license deactivations or tier upgrades.
WEBHOOKS IN
Signed events the Hub sends to the site
The Hub pushes state-change events to the plugin over a single signed webhook route. The plugin exposes one inbound REST route for this purpose: POST /wp-json/sitehealth/v1/license/invalidate. Every request must carry a valid X-Hub-Signature: sha256={hex_hmac} header computed over the raw request body using the per-license signing secret, or the plugin returns 403.
- api_key_deleted. The Hub deleted the license. Plugin clears the cached license data and the stored API key so the next page load reflects the unlicensed state.
- tier_changed. The Hub changed the license tier. Plugin clears the cached license data and the fix-code bundle so the next read pulls the correct fix set for the new tier.
- bundle_refresh. The Hub published a new fix-code bundle. Plugin clears only the bundle cache so the next read pulls the new bundle.
- force_update. The Hub triggered a plugin auto-update. Plugin fetches the update payload, runs the WordPress update pipeline, and reactivates itself if the upgrader left it inactive.
The endpoint is callable without WordPress authentication because HMAC validates the caller. Any request without a matching signature returns 403 and the body is not processed.
OUTBOUND
What the plugin calls on the Hub
The plugin acts as a client of the Link Flow Hub. The outbound surface is intentionally narrow.
- License validation. Plugin POSTs the API key and site domain to the Hub's license-validate endpoint to confirm the license and receive the tier, feature set, and signing secret.
- OAuth token. Plugin exchanges the API key for a bearer token via the Hub's OAuth token endpoint using the client-credentials grant.
- Fix-code bundle. Plugin GETs the bundle from the Hub's fixes endpoint with the bearer token in the Authorization header. The response carries the X-Bundle-Signature header for HMAC verification.
- AI generation. Plugin routes AI requests through the Hub's typed AI endpoints. Five typed endpoints are wired today: generate title, generate description, generate alt text, generate anchor, and validate link. A legacy chat endpoint is retained for callers that need a direct prompt pass-through.
The OpenAI API keys live only on the Hub. They never reach the plugin and they never reach the site database. Site operators do not need to manage AI provider credentials.
WHAT YOU WON’T SEE
Fix-handler code and AI prompts stay internal
When the public REST surface for remote-site-management features ships, request and response examples will land in the docs. HTTP status codes and error structure will land in the docs. Per-endpoint authentication and rate-limit behavior will land in the docs.
What never lands in the docs: the fix-handler source code that runs the actual treatment logic, and the AI prompt text that generates fix outputs. Same public-safety constraint as the ailment reference: the moment fix-handler code is public, anyone can produce a paid clone of SiteHealth without funding the ongoing detection and prompt re-tuning work the subscription pays for.
COMING WHEN READY
Public REST surface, webhooks out, SDKs
Three sections are reserved in the API docs for capabilities that ship as remote-site-management features land.
- Public REST surface. The customer-facing endpoints for programmatic scan triggering, status query, and fleet queries. Request and response shapes, status codes, and per-endpoint authentication land here when the surface ships.
- Outbound webhooks. Events SiteHealth emits to operator-owned endpoints, signed the same way the inbound webhook is signed. Lets agencies pipe SiteHealth events into their own dashboards.
- SDKs and client libraries. Idiomatic wrappers that handle the authentication and signature verification automatically.
Each section locks once implementation lands. Until then they are reserved with a clear "coming when ready" note.