agentleFS
okayusokayus/okayus-skills/skills/cloudflare-workers-host-synthetic-check/SKILL.md

cloudflare-workers-host-synthetic-check

Skill0 starsChanged 7 days agoMITView on GitHub

Catch "the app answers 200 but nobody can log in" within a day, with a credential-free daily check run from the developer's machine by a systemd user timer. Asserts `/health` and — the part that matters — that the WebAuthn `rpId` returned by each app's login-begin endpoint still matches the host it is served from. Use after any account-, domain- or subdomain-level change (a workers.dev subdomain rename silently killed every passkey on two apps for 82 and 85 days while `/health` stayed 200), when several small passkey apps share one Cloudflare account, or when the only monitoring is "someone will tell me". Covers the rpId suffix rule, the `Origin` header that a CSRF check demands on the probe, why the alert should fire during the day, and what this check cannot see (a cross-app POST failing quietly inside a Cron Trigger — that needs the sender to report non-2xx).

  • Sends data out

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    One probe a day stays far below an auth rate limit: Do not turn this into a minute-level uptime monitor: the login-begin route is exactly …

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Daily synthetic check from the host

The shape in one sentence: a systemd user timer runs a 100-line Node script once a day that GETs each app's /health and POSTs its passkey login-begin endpoint, and raises a desktop notification when the rpId in the response is not the host the app is served from.

Why /health is not enough

A WebAuthn credential is bound to the relying party ID. When the page's host stops matching the configured RP_ID, the browser refuses both navigator.credentials.get() and .create() with SecurityError: The relying party ID is not a registrable domain suffix of, nor equal to the current domain. The server never sees a failing request, so logs, /health and uptime checks stay green.

Measured cost (2026-06-12 → 2026-09): renaming the account's workers.dev subdomain left one app's RP_ID on the old name. A family could not log in for up to 82 days; a second app was broken for about 85 days and was only found by accident during unrelated work. Both would have been reported the next morning by the check below.

Deliverables

  • ~/.config/app-check/{app-check.mjs,apps.json} installed (0700 directory)
  • node ~/.config/app-check/app-check.mjs prints ok for every app
  • The failure path has been seen once (point an entry at a local fake that returns another rpId)
  • app-check.timer enabled and one run under systemd is green

Install

SKILL=~/.claude/skills/cloudflare-workers-host-synthetic-check
install -d -m 700 ~/.config/app-check
install -m 644 $SKILL/scripts/app-check.mjs ~/.config/app-check/
$EDITOR ~/.config/app-check/apps.json
node ~/.config/app-check/app-check.mjs

install -m 644 $SKILL/systemd/app-check.{service,timer} ~/.config/systemd/user/
systemctl --user daemon-reload && systemctl --user enable --now app-check.timer
systemctl --user start app-check.service && journalctl --user -u app-check.service -n 10 -o cat

apps.json:

{
  "apps": [
    { "app": "myapp", "origin": "https://myapp.example.workers.dev", "health": "/health", "passkeyBegin": "/api/auth/login/begin" },
    { "app": "oauth-app", "origin": "https://other.example.workers.dev", "health": "/health" }
  ]
}

passkeyBegin is whichever unauthenticated route returns PublicKeyCredentialRequestOptions (/login/begin, /login/options, …). The script looks for rpId anywhere in the JSON, so both { rpId } and { options: { rpId } } work. Leave it out for apps without passkeys.

Traps

  1. The rpId rule is "equal or registrable suffix", not "equal". app.example.com served with rpId: "example.com" is valid; the script accepts host === rpId || host.endsWith("." + rpId). It does not consult the public-suffix list, so rpId: "workers.dev" would pass here while a browser rejects it. Nobody configures that by accident; the failure this exists for is a stale full hostname.
  2. Send Origin. Apps that require Origin === ORIGIN on non-GET /api/* answer 403 to a bare curl -X POST. The script sends origin: <origin>.
  3. One probe a day stays far below an auth rate limit. Do not turn this into a minute-level uptime monitor: the login-begin route is exactly the one that is rate limited per IP, and a challenge-issuing endpoint is not a health endpoint.
  4. Schedule it for the day. The alert is notify-send; a 04:00 notification on a sleeping machine is read by nobody. Persistent=true covers days the machine was off. For alerts when nobody is logged in, set APP_CHECK_DISCORD_WEBHOOK in the unit (Environment=) and loginctl enable-linger $USER.
  5. Add the app on the day it gets its first passkey, not later. The check is only as complete as apps.json.

What this does not see

  • A cross-app call failing inside a Cron Trigger. If app A POSTs to app B every night and B changed its contract, A gets 400 and, when written fail-quiet, only console.logs it. Nothing outside A can observe that. The fix belongs in the sender: report non-2xx somewhere a human looks (cloudflare-cron-to-discord), and pin the contract with a generated schema (cloudflare-workers-pat-bearer-auth ≥ 0.2.0).
  • Whether a passkey ceremony completes. That needs a browser with a virtual authenticator (cloudflare-workers-e2e-playwright) and belongs in e2e, not here.

When you change something account-wide

Before renaming a subdomain, moving to a custom domain, or changing an OAuth callback host: grep -rn "<old-host>" ~/src/*/ across every repo, not just the one you are in. RP_ID, ORIGIN, OAuth callbacks, firewall allowlists and notification links all carry the host name, and a passkey app cannot change RP_ID without re-registering every user.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.