hoelee-check: v1 skeleton — net-guard, cache, ratelimit, router, pages, three checks
Zero-dependency Node service mounted at www.hoelee.com/check/. net-guard pins the resolved IP, re-validates every redirect hop, and refuses private ranges; the certificate is read off the same socket as the request. Pages: hub, certificate, email auth, redirects/preview, about, report. Argon review applied: optional-hardening wording, DKIM/SHA-1 root rules, neutral not-evaluated, cache-before-scan, single-connection TLS.
This commit is contained in:
commit
b2707f49f7
19 files changed
+4722
No files matched your search
@@ -0,0 +1,125 @@
|
||||
# SPEC — hoelee-check v1
|
||||
|
||||
**What this is.** Three public health checks for a domain — certificate, email authentication, and
|
||||
redirects/link-preview — served at `https://www.hoelee.com/check/`. Free, no account, no upload.
|
||||
Built so a Malaysian SME owner can see, in about a second, the three things that make a small
|
||||
business look careless online.
|
||||
|
||||
**Why here and not on `tools.hoelee.com`.** That site's entire promise is "nothing is uploaded —
|
||||
it runs in your tab", enforced by a build gate that fails on any third-party request. One `fetch()`
|
||||
would destroy it. Server-backed tools therefore live on the sales hostname, where the links they
|
||||
earn point at the business.
|
||||
|
||||
**Why `/check/` and not a subdomain.** Google treats a domain *or subdomain* as a site for Search
|
||||
Console, site names and preferred sources, so a subdirectory is not a "site" — but links still pass
|
||||
to the host, the report URLs still earn authority for the sales hostname, one Search Console property
|
||||
covers everything, there is no new certificate, and killing the experiment means deleting one nginx
|
||||
`location`. `/check/` was a plain 404 before this project.
|
||||
|
||||
---
|
||||
|
||||
## Topology
|
||||
|
||||
```
|
||||
browser → https://www.hoelee.com/check/…
|
||||
→ nginx-www-hoelee (unRaid)
|
||||
location ^~ /check/ { access_log off; proxy_pass http://hoelee-check:3000; }
|
||||
→ container hoelee-check (node:24-alpine, no published port)
|
||||
```
|
||||
|
||||
`access_log off` is a requirement, not a preference: an access log of `/check/report/<domain>` is
|
||||
exactly the query log the site promises not to keep.
|
||||
|
||||
## Runtime
|
||||
|
||||
Node 24, plain `node:http`, `node:dns`, `node:tls`, `node:sqlite` not used, **zero npm
|
||||
dependencies**, no build step. Deploys as an image with nothing to compile. The precedent on this
|
||||
host is the link shortener (`linkd`): node:24-alpine, hand-rolled router, no deps.
|
||||
|
||||
Dependency call (Argon review): dropping `mailauth` is correct — its weight is live SMTP session
|
||||
evaluation and DKIM signature verification, neither of which a record-shape checker performs.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Purpose | Robots |
|
||||
|---|---|---|
|
||||
| `/check/` | hub, one input, runs all three | index |
|
||||
| `/check/ssl/` | certificate landing page | index |
|
||||
| `/check/spf-dkim-dmarc/` | email auth landing page | index |
|
||||
| `/check/headers/` | redirects + link preview landing page | index |
|
||||
| `/check/about/` | what is queried, what is kept, how to verify | index |
|
||||
| `/check/report/<domain>` | the report | `noindex, nofollow` + `X-Robots-Tag` |
|
||||
| `/check/api/health` | `{ok, version, commit, checks}` | noindex |
|
||||
|
||||
Every form posts `?d=` back to its own page, which 302s to the canonical `/check/report/<domain>`.
|
||||
That keeps one indexable URL per landing page and one shareable URL per result.
|
||||
|
||||
## Honesty contract
|
||||
|
||||
> We query only the public hostname you type. No query log — a per-IP request counter that dies with
|
||||
> the process, and a short cache of the public DNS/HTTP answers so a link shared on WhatsApp is not
|
||||
> re-fetched every time somebody opens it. Every result is a URL you can forward.
|
||||
|
||||
Wording rules that must not drift (each one is enforced by a test or a review item):
|
||||
|
||||
- **DKIM**: "No key found among the 13 common selectors; a custom selector cannot be found from DNS
|
||||
alone." Never "DKIM is not configured".
|
||||
- **SPF**: report record shape only. A pass/fail needs a sender IP we do not have, and the page says so.
|
||||
- **TLS**: judge signature algorithms on the leaf and intermediates only. RFC 5280 exempts a trust
|
||||
anchor, so a SHA-1 *root* is not a failure.
|
||||
- **Headers**: a missing CSP, XCTO, XFO or Permissions-Policy is "optional hardening not present" at
|
||||
level `info`. Only a broken redirect chain, a malformed HSTS, or a 4xx/5xx final page is `fail`.
|
||||
- **`not-evaluated`**: neutral slate badge, never red; counted separately as "skipped by firewall" so
|
||||
the page cannot be screenshotted as a security verdict.
|
||||
|
||||
## States and caching
|
||||
|
||||
`state` is `ok | warn | fail | not-evaluated`, equal to the worst finding. TTL is 1 hour for a clean
|
||||
result and 5 minutes for anything else — a warning cached for an hour makes somebody who just fixed
|
||||
their DNS conclude the tool is broken.
|
||||
|
||||
## Network guard (the actual engineering)
|
||||
|
||||
Everything dials through `src/lib/net-guard.mjs`:
|
||||
|
||||
- hostname only — no IP literals, no userinfo, no scheme but http/https, ports 80/443 only;
|
||||
- resolve **once** through getaddrinfo, validate every A/AAAA answer, refuse the whole host if any
|
||||
answer is private (a mixed answer set is a rebinding attempt, not a mistake);
|
||||
- dial the pinned address while keeping the real hostname for SNI and `Host` — a re-resolve at
|
||||
connect time is the hole;
|
||||
- redirects followed by hand, max 5, every hop re-validated;
|
||||
- 2 MB body cap, 10 s wall clock, `HoeleeCheck/1.0` user agent that names the about page;
|
||||
- the certificate is read off the **same socket** as the HTTPS request, so the report never opens a
|
||||
second connection to the target;
|
||||
- 10 requests a minute and 100 a day per IP, `Retry-After` on 429.
|
||||
|
||||
## Cut from v1 (Argon review, accepted)
|
||||
|
||||
- `/check/badge/<domain>.svg` — hotlinked badges invite cache stampedes and rate-limit headaches, and
|
||||
SMEs do not embed them.
|
||||
- `/zh/check/` — translate after the copy stops moving, not before.
|
||||
- `/check/api/report` — call the runner inside SSR until an external consumer exists.
|
||||
|
||||
## Kept, non-negotiable
|
||||
|
||||
net-guard and its tests, single-connection HTTPS + certificate read, the WhatsApp preview card, the
|
||||
neutral `not-evaluated` rendering, and `/check/about/` with its falsification test.
|
||||
|
||||
## Acceptance
|
||||
|
||||
1. `npm test` green with the machine offline (fake DNS + fixture objects only).
|
||||
2. net-guard refuses `127.0.0.1`, `169.254.169.254`, `10.0.0.1`, `[::1]`, `0.0.0.0`, `2130706433`,
|
||||
`[::ffff:127.0.0.1]`, a host resolving private, a mixed public/private answer set, a redirect to a
|
||||
private address, and a redirect to port 8443.
|
||||
3. A real report for `hoelee.com` returns three checks in ~1–2 s with `checkedAt`.
|
||||
4. A 403/bot-wall target renders `not-evaluated` with zero header findings.
|
||||
5. Report page carries `noindex` + `X-Robots-Tag`, has no horizontal overflow at 390 px, and makes
|
||||
zero third-party requests.
|
||||
6. 11th request in a minute returns 429 with `Retry-After`.
|
||||
7. nginx location carries `access_log off`.
|
||||
|
||||
## Open questions for the owner
|
||||
|
||||
- Does `www.hoelee.com` need a link to `/check/` in its own navigation before launch? Without one the
|
||||
pages are crawlable but undiscoverable.
|
||||
- Who answers the email that arrives when somebody's certificate is 3 days from expiry?
|
||||
Reference in new issue
Block a user