The platform

THINQ Site — Security Posture

The platform-wide statement, written to be checked: every claim names the code that makes it true.

For: IT, security, and compliance reviewers evaluating THINQ Site against WordPress or another CMS. Last verified against the codebase: 2026-08-17 (dependency count refreshed 2026-09-03; revision history and restore added 2026-09-13; dependency count, OAuth registration and review claims, and upload limits re-checked against the code 2026-10-22).

This document is written to be checked, not believed. Every control below states where it lives in the code and, where we have tested it, what the test did and what came back. Section 6 lists the things we do not do — read that first if you are short on time, because it tells you how much weight to put on the rest.


1. Why the architecture is the security argument

THINQ Site is a compiled application, not a plugin host.

  • Content is JSON files on disk, validated against a schema every time a page renders. There is no database.
  • Features are TypeScript modules compiled into the build. There is no runtime plugin system, no marketplace, and no mechanism for third-party code to execute on the server.
  • Pages are pre-rendered. A visitor request usually returns a static file.
  • 22 runtime packages. package.json lists 23 dependencies; one (@types/qrcode) is TypeScript type definitions and ships no code. Those 22 pull in about 180 more of their own, roughly 200 packages in the production install, all pinned by one lockfile and updated together. A typical WordPress install carries a PHP core plus dozens of plugins, each with its own dependency tree and its own release cadence.

Most of what follows is a consequence of those four facts rather than a feature we added. That distinction matters to a reviewer: a control can be misconfigured, but an absent capability cannot be exploited.


2. Vulnerability classes that are structurally absent

Class Why it does not apply
SQL injection No database and no SQL. Content is files.
Database compromise / dumping There is no database to reach.
Plugin or theme remote code execution No runtime plugin system. Code ships in the build; adding any requires a commit and a deploy.
PHP execution / upload-to-shell No PHP anywhere in the stack. Uploads are never executable.
Vulnerable-plugin supply chain 22 runtime packages chosen by us (about 200 with their own dependencies), pinned by one lockfile and updated as one unit.
Cross-tenant access Single-tenant: one deployment serves one site, with its own container and its own storage volume. There is no shared instance to pivot within.
Silent content corruption Every content file is schema-validated at render. Malformed content fails loudly instead of rendering something wrong.

The industry's most common WordPress breach path — a vulnerable plugin executing attacker code on the server — has no analogue here, because the capability it abuses does not exist.


3. Implemented controls

Authentication and sessions

  • Two-step verification (TOTP) — available per account, for every role. Standard RFC 6238 authenticator codes (1Password, Google Authenticator, Authy). Password and code are separate requests: the password step issues only a signed, five-minute challenge and no session cookie, so a stolen password alone grants nothing. Codes are single-use within their window (replay is rejected), the verification step is rate limited to 5 attempts per 15 minutes per IP — without which six digits would be brute-forceable — and ten single-use recovery codes cover a lost device. Enrollment is self-service and self-scoped: an administrator cannot enroll, inspect, or disable another user's second factor, and the TOTP secret is never returned by any API.
  • Enforced two-step (per deployment; on for new sites): with MYPRESS_REQUIRE_MFA set, an owner or admin without two-step verification is sent to enrol before reaching any admin page, and every /api/admin/* endpoint except enrolment and sign-out answers 403 mfa_enrollment_required — checked in the proxy against the account on disk, not the cookie, so a password alone drives neither the screens nor the API. The same rule covers the backup download (whose bearer-token path skips the proxy) and approving an AI connector, which would otherwise turn a password into a long-lived token. One function decides it for every gate (src/lib/mfa-enrollment.ts). Off in core by default; every site provisioned with scripts/provision.mjs since 2026-10-24 has it on from the start (the first admin sign-in goes straight to setup, so nobody is locked out). Sites launched before then keep it off until it is turned on, once the owner has enrolled. Separately, an account created or reset by an admin carries mustEnrollMfa and must enrol at first sign-in, at any role and regardless of that switch — an account with no second factor has no self-service recovery path, which is the gap that stranded a real user.
  • Passwords hashed with scrypt (N=16384, r=8, p=1, 64-byte key, 16-byte random salt per user). No password is ever stored or logged in plaintext.
  • Password policy (src/lib/password-policy.ts), applied to every password a user sets — create, admin reset, forced first change, recovery, break-glass: minimum 12 characters, refused if it is one of the most commonly used passwords (checked after stripping the usual decoration: capitals, a trailing year or digits, !, and letter→symbol swaps, so P@ssw0rd2026 is refused as password), refused if it is a straight keyboard or alphabet run or has almost no distinct characters, and refused if it contains the account's own name, username or email. One definition drives the browser, the APIs and the CLI; the CLI's copy — it must run inside the container with no build step — is held to the app's by a test that fails if the two ever disagree. Deliberately no forced character classes and no expiry, per NIST SP 800-63B: both push people toward predictable passwords.
  • A password chosen by somebody else is never a standing credential. When an admin creates a user or resets another account's password — or the break-glass CLI runs — that account is marked mustChangePassword. At the next sign-in the password step (and the second factor, when enrolled) must still pass, and then the account receives a short-lived challenge instead of a session cookie; only setting a new password issues the session, and the old one cannot be reused. Changing your own password never sets this. The admin form generates a 20-character password and shows it once, in the clear, with a copy button, and (since 2026-09-17) emails it to the account holder with their username and a sign-in link. That is a deliberate trade-off: the previous behaviour sent nothing, so an invited person had no way to learn their password and — having never signed in — no second factor to recover with. The mailed password is single-use in practice: mustChangePassword means no session is issued until it is replaced. A one-time setup link would keep the secret out of the mailbox and is the better long-term shape.
  • Account recovery without email. A forgotten password is recovered by proving the account's second factor — a live authenticator code or one single-use recovery code — and then setting a new password. The recovery step is rate limited like the login second step, consumes a recovery code single-use, and issues no session (you sign in fresh). There is deliberately no email-based reset, so recovery introduces no inbox-takeover path. An account with no two-step verification is reset — to a password that must then be replaced at first sign-in — by another owner/admin of equal or higher role, or by the server-side break-glass CLI (node scripts/reset-password.mjs <login>, shipped in the container image and run from the host's shell on the live instance), which requires access to the deployment and its data volume — the strongest authorization factor, and consistent with "sensitive changes need a deploy, not just an admin cookie."
  • Session cookie is httpOnly (unreadable by JavaScript), SameSite=Lax, and carries an HMAC-signed token verified on every request at the edge.
  • Login lockout: 8 failed attempts from an IP in 15 minutes locks that IP out for 15 minutes (HTTP 429).
  • Production boot guard: the application refuses to start on a default session secret or a default admin password. A misconfigured deploy fails closed rather than running insecurely.

Authorization

  • Three roles in a strict hierarchy — owner > admin > editor. Editors reach Dashboard, Pages, Media, Posts, the block catalog, and Events — including event check-in and the attendee manifest, since door staff run live events from editor accounts — plus their own account and two-step enrolment pages; admins additionally manage users, forms, settings, and appearance; owners hold the account. Every role can always reach its own security settings — a role allowlist that excluded them put an invited editor in a redirect loop between the page requiring enrolment and the rule forbidding it, with no way to finish setup (fixed 2026-09-17). The edge allowlist and the sidebar's role grants are kept in lockstep by a unit test (admin-session-grants.test.ts): a section that renders for an editor while the edge silently bounces it stranded event door staff at a live event on 2026-09-17, and that drift is now a build failure.
  • Owner protection: an admin cannot modify, demote, deactivate, delete, or reset the password of an owner, cannot create or assign a role above their own, and the last owner cannot be removed. This is what stops a rogue co-admin from locking the account holder out. Every site is guaranteed exactly one owner (the seeded/earliest admin migrates to owner automatically).
  • Role checks are enforced in the API, not just hidden in the UI, and are rank-aware in one place — hiding a button stops a user, not an attacker.
  • Account audit log: every create, change, and delete of a user account is written to an append-only log (actor, target, action, detail, timestamp), viewable in the admin. Actions between co-administrators are attributable and cannot be quietly rewritten.
  • Deactivating an account invalidates it immediately, even with a valid session cookie.
  • The session's role follows the account, not the cookie. Every server-side authorization check re-reads the role from the user record, so demoting an admin to editor takes effect on their next request — including the AI-connector consent screen — rather than when their session expires. (Before 2026-09-13 the role was taken from the cookie, so a demoted admin kept admin powers for the rest of the session; found by the connector end-to-end test.) The proxy (Node runtime) still uses the cookie's role for coarse page redirects, but it cannot grant anything: every admin-only handler re-checks the live role.
  • Redirects, the 404 log and Change URL are admin+. GET/PUT /api/admin/redirects, GET/DELETE /api/admin/redirects/not-found and POST /api/admin/{pages,posts}/<slug>/rename each check for an admin in the handler, and the proxy refuses them to an editor session before routing (isAdminOnlyPath; covered by admin-session-grants.test.ts). Editing a page stays open to editors; changing its address does not, because it rewrites the site's redirect list. A rename moves the item's revision history with it, is captured as a revision first, and is recorded in content/audit/content-actions.jsonl.
  • Site traffic is admin+. /admin/analytics and GET /api/admin/analytics check for an admin in the handler, and the proxy refuses them to an editor session before routing (isAdminOnlyPath; covered by admin-session-grants.test.ts). The public beacon POST /api/track is not an admin path; see "First-party analytics" below.

AI connector (MCP)

The site can expose an MCP endpoint (/api/mcp) so the operator's own AI client can read and edit content conversationally (sold as THINQ Connect). Nothing is reachable until an admin or owner approves a specific assistant on the site's own consent screen.

  • OAuth 2.1 pairing. An assistant pairs through a standard authorization-code flow with mandatory PKCE (S256 only). The site is its own authorization server: no external identity provider, no third party in the trust path. Design and threat model in oauth-connector-design.md; the external review brief is oauth-review-brief.md.
  • The flaws OAuth implementations usually have, closed explicitly. Redirect URIs match by exact string (no prefix or normalisation); an unrecognised redirect URI is never redirected to, so the error path cannot become an exfiltration channel; authorization codes are single-use, 60-second, and bound to client + redirect URI + PKCE challenge, and a replay revokes the tokens already issued from that code; refresh tokens rotate with reuse detection that kills the whole chain.
  • Nothing sensitive is stored in the clear. Client secrets are salted and hashed; access and refresh tokens are stored only as digests. Credentials live at {contentRoot}/oauth/, outside content/ — so they are never committed by the git-backed content writer, never included in a backup download, and never resurrected by a restore.
  • Tokens are bound to the site that issued them (RFC 8707 resource). Because every client site runs this same codebase, a token lifted from one site is refused by another.
  • Consent is explicit and hard to forge. Approving requires a signed-in admin or owner plus an HMAC consent token bound to that session and the exact request parameters, so a token minted to approve one client cannot approve another. A GET to the authorization endpoint never issues anything.
  • Authorization tracks the account, not the token. Role is re-read from the user record on every call, and a deleted or deactivated account's connector stops working immediately — at the resource server and at the token endpoint, so a refresh cannot outlive the account that approved it.
  • Self-registration grants no access. An assistant may register itself (this is how mainstream AI clients pair), but a registered client holds nothing: it cannot read or change anything until an administrator approves it by name on a consent screen. Public clients — apps that cannot keep a secret — are accepted only because proof-key (PKCE) is mandatory, and the two client types cannot impersonate one another in either direction.
  • Cleartext refused. If a site is configured with an http:// origin (outside loopback), the OAuth endpoints refuse and the discovery documents 404 rather than inviting a client to send credentials over the wire.
  • Rate-limit buckets are not client-forgeable. The client address is taken from the proxy-written end of X-Forwarded-For, not the caller-supplied leftmost entry, so a caller cannot mint a fresh bucket per request or park itself in someone else's. Behind Cloudflare that proxy-written address is a Cloudflare edge (it changes per request and is shared by unrelated visitors), so when — and only when — it falls inside Cloudflare's published ranges, the visitor is the address Cloudflare reports (CF-Connecting-IP, else the entry Cloudflare appended). A caller who bypasses Cloudflare and hits the origin directly is the peer itself, so a forged CF-Connecting-IP is ignored. One rule for every caller — rate limits, form spam checks (Turnstile, Akismet, quarantine), the 404 log and analytics — in src/lib/client-ip.ts (covered by client-ip.test.ts). MYPRESS_TRUST_CLOUDFLARE=0 turns the Cloudflare step off. (Before 2026-10-20 the forms code kept its own copy that trusted CF-Connecting-IP and the leftmost entry unconditionally, so a direct-to-origin caller could pick its own form rate-limit bucket; and on Cloudflare-fronted sites every other limit was keyed to edge addresses.)
  • Adversarially reviewed, twice. Two external review passes (2026-08-19), working from oauth-review-brief.md, are recorded with their findings and the resolution of each in oauth-adversarial-review.md (nine findings, all fixed) and oauth-adversarial-review-2.md (two low findings and a list of coverage gaps, re-checked after the first). Both are historical records; current status is the second. Neither was a commissioned audit or penetration test by a security firm (§6).
  • Single-instance assumption. Grant mutations are serialised by an in-process lock, not a file lock — correct for the one-instance deployments we ship, and stated here rather than implied to be stronger.
  • Per-connection revocation. Individual grants can be cut off from the admin without disturbing others or signing anyone out.
  • Deliberately narrower than the admin API, and tiered by role. Every role that can hold a connection can read pages, posts, site identity, the block vocabulary and the media list. Editors and above can create and edit pages and posts and add media. Only admins and owners can change site settings, and only the name, tagline and footer text. The tool list is built from the account's current role on every request, so a tool the role does not allow is absent, not merely refused. Not exposed at all: users and roles, backup/restore/reset, integrations and tracking/custom code, any delete, and form submissions — visitor PII, and attacker-controlled text that would otherwise flow straight into an AI client's context, giving an untrusted party a prompt-injection path into an agent with write access.
  • Every write re-validates at the boundary against the same composed schema the admin write route uses, so a malformed or hostile tool call is rejected rather than written and discovered later. Blocks that execute markup stay admin-only on this path too.
  • An assistant cannot overwrite an edit it has not seen. Updating a page or post requires the updatedAt from the assistant's last read; if anyone changed it since, the write is refused and nothing changes. New pages and posts default to draft. There is no delete tool — unpublishing is the reversible path.
  • Runaway agents are contained. Each connection may make at most 30 changes a minute, on top of the per-IP limit (120 requests a minute) on the endpoint itself.
  • Every change is attributable. Each write, refusal, rate-limit hit, approval and disconnection is appended to a connector audit log (who approved the connection, which assistant, which item, what changed — never the content itself, never a token), shown to admins under Site → Integrations.
  • Foreign web pages cannot drive the endpoint. A request carrying a browser Origin that is neither the site itself nor a known assistant web app is refused before authentication, as the MCP transport specification requires (DNS-rebinding and leaked-token defence). Server-to-server assistant traffic sends no Origin and is judged on its token alone.
  • Every connector change can be undone. Before an assistant's write replaces a page or post, the previous version is saved to revision history (below), attributed to that connection. The assistant can list a page's or post's history and restore an earlier version itself (list_page_revisions / restore_page_revision, and the post equivalents), so "undo what you just did" works in the conversation. A restore goes through the same guard as any write: the per-connection rate limit, expected_updated_at, an audit entry, and the admin-only block rule (an editor's connection cannot restore a version containing an embed block).
  • Media intake cannot be turned into a request forger. An assistant may add an image or PDF by URL; the server fetches https on port 443 only, refuses redirects, and checks the address it actually connects to (inside the socket's own DNS lookup, so DNS rebinding is covered) against private, loopback, link-local and cloud-metadata ranges. Files are capped at 10 MB, limited to raster images and PDF (no SVG), and must match their type by content, not name.

Recovery: page and post revision history

  • Every overwrite and delete of a page or post keeps the version it replaced. Capture happens inside the one content write path (contentWriter), not in individual routes, so the admin UI, the admin API, the AI connector, scheduled jobs and push scripts are all covered, including any route added later. Each revision records when, who (account id, name, role) and through what (admin, api, script, or connector:<assistant name>). The last 20 per item are kept.
  • Fail-closed. If the previous version cannot be saved, the write is refused and nothing changes, so there is never a change without an undo.
  • One-click restore, itself undoable. Restoring writes the chosen version back (title, description, blocks or body, SEO, status and publish date exactly as they were), after saving the version it replaces. A deleted page or post can be restored from "Recently deleted".
  • Restore is held to the same rules as a write. It re-validates against the site's current block schema, requires an admin for any version containing admin-only (executed-markup) blocks, passes the admin API's same-origin check, and is recorded in an audit log (content/audit/content-actions.jsonl for the admin, the connector log for assistants).
  • Never public, never seed content. History lives at {contentRoot}/content/.history/, which no public route reads: page and post readers refuse any name containing a path separator or starting with a dot, and revision ids are checked against a strict pattern before a path is built. Revision files are written atomically, are excluded from git and the Docker build context, and travel with the content root in backups.
  • Scope, stated plainly. Pages and posts only. Site settings, menus, theme, forms and media are not versioned by this (they are covered by the whole-site backup).

Transport and browser policy

Sent on every response: Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin, Permissions-Policy. The X-Powered-By header is suppressed.

CSP specifics a reviewer will want:

  • script-src — an allowlist of approved origins. A script from anywhere else is blocked by the browser. The baked-in origins are Google Tag Manager and Google Analytics (GA4), the endpoints GA4 and Google Ads tags report to (GA4's regional and Google-signals collectors, www.googleadservices.com, googleads.g.doubleclick.net, td.doubleclick.net, stats.g.doubleclick.net, pagead2.googlesyndication.com, www.google.com), Cloudflare Turnstile (challenges.cloudflare.com), and Cloudflare Web Analytics (static.cloudflareinsights.com, cookieless traffic measurement). Trade-off, accepted 2026-10-09: the Google hosts widen connect-src to Google's measurement and ads endpoints on every site, including sites that run no ads. Tag Manager, already allowed, loads exactly these tags, and with them blocked an advertiser's conversions fail without an error. Containment still holds against arbitrary destinations. A deploy can add more via MYPRESS_SCRIPT_HOSTS (env, not content — a compromised admin cannot add a script origin), and only https://host values are accepted.
  • connect-src — locked to this site plus the same approved vendors. Script that does run cannot transmit data to an arbitrary destination.
  • object-src 'none', base-uri 'self', form-action 'self', frame-ancestors 'self'.
  • upgrade-insecure-requests — rewrites any http:// subresource to https://, so an http image or embed pasted into content by an editor cannot become mixed content. Scope: sent on every deployed site. It is omitted in exactly one case — when MYPRESS_SITE_URL is itself an http:// origin, which only happens on a developer's local preview (http://localhost:PORT), where the directive would otherwise upgrade the site's own stylesheet to a TLS port that is not listening. The check is fail-secure: unset or malformed values, and every https:// value, keep the directive. There is no runtime flag to disable it, so a deployed site cannot drop it by misconfiguration. The value is resolved when the build produces its header table, not per request, so an operator cannot remove the directive from a running deployment by changing an environment variable and restarting — the site would have to be rebuilt with an http:// canonical URL. A reviewer can confirm with the curl -sI check in §8, which must show it on any real hostname. The allowlist is fixed at build time (the headers are computed in next.config.ts), so the Dockerfile declares MYPRESS_SCRIPT_HOSTS as a build ARG — before 2026-09-10 it did not, and a host variable was silently ignored.

Content and uploads

  • Rich text is sanitized with DOMPurify — an allowlist parser, not a regex denylist — on every render path, server and client.

  • Media library uploads are restricted by extension to images, video, fonts, and PDF, with sanitized filenames. Raster images are re-encoded (resized, EXIF stripped) by src/lib/image-pipeline.ts; SVG is sanitized (below). The upload route checks for 25 MB, but the request first passes through the proxy (src/proxy.ts), and Next keeps only the first 10 MB of a body it proxies, so in practice an upload over about 10 MB fails.

  • SVG uploads are permitted, sanitized and neutralized. Editors and admins can add SVG to the media library (the AI connector and public forms cannot). Two layers:

    • Sanitized on upload (src/lib/svg-sanitize.ts, DOMPurify's SVG profile): <script>, <foreignObject>, every on* handler, javascript: links and the <animate>/<set> forms of them are removed, <use> may only point inside the same file, and a file with no <svg> root is refused. The output is re-serialized as XML and tested to render pixel-identically for a design-tool logo (svg-sanitize.test.ts).
    • Sandboxed when served. Every response that is an uploaded file (/media/, resized variants under /img/, and form-submission files) carries X-Content-Type-Options: nosniff and a restrictive sandbox CSP (default-src 'none'; sandbox), so script inside an SVG cannot execute when the file is opened directly. <img> embedding is unaffected. These headers are set per path in core's Next.js config (src/lib/next-config.ts, src/lib/media-headers.test.ts), because the site-wide CSP set there replaces any CSP a route sets for itself. A site adds its own redirects or headers through withCoreConfig, which places the site's headers before core's so they cannot replace one core sets, and src/lib/next-config.test.ts fails the cascade for any site whose effective config lacks one of core's headers (since 2026-10-24; before then four sites carried their own copy of the config, which is how the fix below reached them two days late).

    This is the usual follow-up question about SVG, and these two layers are why we allow the format at all. Corrected 2026-10-22: before then, this section said uploaded media was sandboxed, and it was not. The routes set the sandbox CSP, but the site-wide header replaced it, so every /media/ and /img/ response carried the page CSP. That policy does not sandbox a document, so an SVG opened directly could run inline script. Measured on a production build; fixed by the per-path headers above. SVGs uploaded before 2026-10-22 were also stored unsanitized, and now rely on the CSP alone.

  • Files sent through a public form are private, re-encoded and type-checked (src/features/forms/uploads.ts, uploads-shared.ts; tests in uploads.test.ts). A form's file field accepts raster images and PDF only, at most 10 MB, and its settings can narrow that but never widen it: SVG is refused even if a form lists it, and a larger size setting is clamped. The bytes must be the type the name claims (magic numbers), so HTML renamed .png or .pdf is refused. Images are re-encoded to WebP, so what is kept is pixels the server wrote: anything appended to the file, and its EXIF/GPS metadata, does not survive. PDFs are kept as sent. Files are stored beside the submissions in content/form-uploads/ on the volume, never in public media, and are served only to an admin (GET /api/admin/forms/<id>/uploads/<name>) with nosniff, the sandbox CSP and no-store; a PDF is a download. Deleting a submission deletes its files. Before 2026-10-22 form uploads were written to the public media directory and checked by extension only, and a form could allow any media type, SVG included; files uploaded before then are still at their /media/ addresses until moved.

Vulnerability disclosure

  • /.well-known/security.txt (RFC 9116) publishes a Contact: for responsible disclosure, pulled from site.footer.contact.email in Settings. Opt-in and fail-closed: a site that hasn't set a contact email gets a 404 on the route rather than a fabricated address nobody reads.

Public forms cannot be used as a mail relay

  • The risk. A form notification whose recipient (To, CC or BCC) is a field merge tag is an auto-reply: it goes to whatever address the visitor typed. A bot puts a stranger's address in the email field and its own text in the others, and the site mails that text, from the client's domain. This happened on a WordPress site we migrated: 1,010 entries from 499 IPs in one day, each a crypto-scam line in the name field.
  • A daily ceiling on auto-replies per form (MYPRESS_FORMS_VISITOR_EMAIL_DAILY_CAP, default 50, all visitors together) bounds a flood spread across many IPs, which per-IP rate limits do not. It is counted on the content volume, so a restart or deploy does not reset it. Emails to the site's own team are never capped, and submissions the spam checks reject or quarantine send nothing at all.
  • A reviewed auto-reply repeats back only what the owner allows. Each auto-reply has two settings. Its subject, message and From name quote values the visitor cannot type freely (choices checked against the field's options, checkboxes, numbers, hidden values) plus only the typed fields the owner ticks (echoFields), each cleaned: one line, links and web or email addresses removed, at most 60 characters. A copy of the visitor's answers is sent only if the owner turns it on (includeAnswers), with links and addresses removed from what was typed — other than the recipient's own address.
  • Stated plainly: an auto-reply not yet reviewed still sends what it always did, under the daily cap. Making every existing auto-reply strict the moment this shipped would have blanked the wording of emails live sites send today, on every site at once. So each site's auto-replies are reviewed and set in that site's own content, and once none is left unreviewed, an auto-reply with no settings will be strict by default (UNCONFIGURED_AUTO_REPLIES in src/features/forms/notify.ts). The admin marks an unreviewed auto-reply as such.
  • Residual risk, stated: with a typed field ticked, a short line of text with no link can still reach the address given, under the daily cap.
  • Verify: give a test form an auto-reply to {field:email} whose message includes {field:name}, tick nothing, and submit with your own address and a name containing a link — the email you receive contains neither. Tick the name and submit again: the name appears, the link does not. Submit more than the cap in a day: the extra auto-replies are logged as suppressed and not sent.

IndexNow (search engine notification)

  • What leaves the server: the site's own public URLs — the ones already in its public sitemap — sent to api.indexnow.org when they change. No content, no form data, nothing about visitors. Nothing is sent from a demo site (search visibility off), a staging address on a hosting platform's domain, or a non-production server.
  • The key is public by design (/indexnow-key.txt): it proves the submitter controls the domain and authorises nothing else. It is an HMAC of the session secret, so publishing it reveals nothing about the secret.
  • Submission state is runtime data on the volume (content/indexnow/): never committed, never baked into an image.

Redirect hit counts and the 404 log (runtime stats)

  • What is stored. content/stats/redirect-hits.json: per redirect rule, its from path, a count and the last time it was followed. content/stats/not-found.json: per missing path, a count, first/last seen, and the host of the most recent referrer (google.com). Never the query string (it can carry emails, tokens and campaign ids), never the referrer's path or query, never IP address or user agent — these files are not a visitor log. Bounded: paths over 300 characters are not logged, at most 500 missing paths are kept (lowest count, then oldest, goes first), and scanner probes (*.php, /wp-admin…, /wp-login…, /xmlrpc…, /cgi-bin…, any dot-segment such as /.env or /.git) are skipped. Runtime data on the volume, flushed every ~30 s, never committed or baked into an image (.gitignore, .dockerignore).
  • How a 404 is reported. The 404 page posts { path, refererHost } from the visitor's browser to POST /api/not-found — the full referrer URL never leaves the browser. That endpoint is public by necessity and is held to: same-origin only (Sec-Fetch-Site / Origin; a cross-site post is ignored), a per-address rate limit (the address is a bucket key in memory, never stored), a 2 KB body, every bound above, and a check that the path really is missing (not a redirect, a 410, a published page or post). It always answers 204 with no body. Worst case, a caller who passes all of that adds bounded junk paths to an admin list, which is no more than requesting those URLs does.
  • Counting never touches the request path. The proxy's only addition is an in-memory increment when it serves a redirect; disk writes happen later, off the request, and a failure there is logged, never thrown.

First-party analytics (visit counting)

  • What is stored: daily totals only, in content/analytics/YYYY-MM-DD.json on the volume — views, approximate unique visitors, views per path, visit starts per source channel and utm_campaign, views per device bucket. Never stored: IP addresses, user agents, cookies, visitor hashes, query strings, exact screen sizes, or any per-visit record. Unique visitors are counted in memory as distinct sha256(dailySalt + ip + ua); the salt is random per day, never written to disk, and dropped with that day's hash set once the day is over, so a stored file cannot be linked back to a person or across days. Kept 400 days, then deleted.
  • What the browser sends: one POST /api/track per page view (pathname, referrer host, a 3-way width bucket, utm_* on the landing view). No cookie is set or read by the tracker and nothing goes to a third party, so CSP is unchanged: the beacon is covered by the existing connect-src 'self'.
  • The endpoint is public and bounded: 2 KB body cap (enforced on the stream), Zod-validated, same-origin only (Origin or Sec-Fetch-Site), rate-limited per IP (60/min, then a 5-minute lockout), answers 204 whatever the verdict so probing learns nothing, and caps distinct paths per day (2,000; the rest fold into (other)) so junk URLs cannot grow the files.
  • Never counted: bots and scripts (user-agent rules), prefetch/prerender, any request carrying the admin session cookie, /admin, /api, /preview, /oauth, /.well-known and asset routes, the site's own private paths (site.analytics.excludePaths, Settings → Analytics), and browsers sending Global Privacy Control or Do Not Track. Token-like path segments are stored as :token as a backstop for a private page a site forgot to list. Built: src/lib/analytics/, src/components/PageViewTracker.tsx; tests in src/lib/analytics/*.test.ts. Verify: POST /api/track with DNT: 1 or a bot user agent returns 204 and the day file does not change.

Request integrity

  • CSRF: state-changing admin requests must prove same-origin via Origin or Sec-Fetch-Site. Requests that cannot are rejected with 403.
  • Payments (event ticketing): checkout uses Stripe hosted Checkout — the browser is redirected to Stripe's payment page, no card field ever renders on this site, and no cardholder data touches this server (it stays out of PCI SAQ scope beyond SAQ A). Prices are read from server-side config, never from the client. The public checkout endpoint (POST /api/events/[slug]/checkout) is rate-limited per IP. The Stripe webhook (POST /api/webhooks/stripe) is the one deliberately unauthenticated cross-origin POST: it is trusted only via the Stripe-Signature HMAC verified over the raw body in constant time with a 5-minute replay window, refuses everything when STRIPE_WEBHOOK_SECRET is unset (fail-closed), and its order writes are idempotent (replays are no-ops). Verify: send any unsigned POST to /api/webhooks/stripe — it must return 400/503, never 200. Door sales at live events keep the same posture: a card walk-up gets a QR of a hosted-Checkout URL and pays on their own device — staff never see or enter card data. Cash and comp orders (recorded without payment processing) require an admin session, not just any staff session, so the money trail always carries a trusted name.

4. Adversarial test results

Run 2026-08-15 against a live instance with real admin and editor sessions. These are outcomes we observed, not design intentions.

Attempt Result
Editor writes a block containing executable code 403 — rejected by the API
Editor writes site-wide custom code 403
Editor creates an admin account (privilege escalation) 403
Unauthenticated request writes page content 401
Unauthenticated request writes site settings 401
State-changing request with no Origin header 403
State-changing request with a cross-site Origin 403
Page loads a script from a non-approved origin Blocked by CSP (browser-confirmed)
Injected script reads the session cookie Empty — httpOnly holds
Injected script transmits data to an external host Blocked by CSP (browser-confirmed)
Password alone on an MFA account No session issued — a challenge only
Admin API, backup or connector approval by an un-enrolled admin while two-step is required 403 mfa_enrollment_required (enrolment and sign-out still allowed)
Correct password on an account whose password an admin set No session issued — a change challenge only
Reusing the admin-set password as the new one 400
Forged/expired password-change challenge 401
Half-completed login reaches the admin API 401
Wrong second-factor code 401
Same TOTP code replayed inside its window 401
Forged/expired MFA challenge 401
Recovery code reused 401 — single-use enforced
TOTP secret exposed by the users API Not present — replaced by a boolean
Admin performs the same actions legitimately 200 — the product still works

Our TOTP implementation is additionally checked against the RFC 6238 published test vectors (all six pass), so the codes are verifiably standards-correct rather than merely self-consistent.

The three most useful lines are the CSP and cookie results. We executed a real credential-theft payload on a page: the script ran, could not read the session cookie, and could not send anything anywhere. That is defense in depth doing its job rather than a single control being asked to be perfect.


AI connector end-to-end (2026-09-13). scripts/connector-e2e.mjs drives a real assistant's path with the official MCP TypeScript client SDK — discovery, dynamic registration, PKCE authorization, token, initialize, tools/list, a write, its revert, and the audit entry — then the refusals: mismatched redirect URIs, missing/plain/wrong PKCE, foreign-origin calls, revoked and expired tokens, a demoted account's tools and session, private-address media URLs, and both rate limits. It runs against a local production build (65 checks) and, minus the account-creating and store-editing cases, against the deployed demo over HTTPS.

Revision history and restore (2026-09-13). scripts/revisions-e2e.mjs runs against a local production build and checks that admin, API, script and connector writes each record a revision with the right source; pruning holds at 20 on disk and in the API; a restore brings a version back exactly and can itself be undone; a deleted page and post come back; an editor restoring a version with an embed block is refused over both the admin API and the connector; stale connector restores are refused; .history is unreachable from every public route and absent from the sitemap, llms.txt and the feed; and traversal in revision ids and slugs, and a forged revision file, are refused. scripts/connector-e2e.mjs covers the four history tools as a real MCP client uses them.

5. Where we deliberately allow code — and how it is bounded

Clients need HubSpot forms, chat widgets, and tracking pixels. Any CMS that cannot embed a vendor snippet is unusable in practice, so THINQ Site provides two places where markup and script are executed rather than sanitized: a page-level embed block, and site-wide custom code (head / body).

We would rather explain the boundary than pretend the capability is not there.

  1. Admin-only, enforced server-side. Editors cannot create or edit executable content — verified above, at the API, not in the UI.
  2. A new script origin requires a deployment. Approved origins come from deployment configuration, not from site content. A client can paste a vendor snippet themselves; only whoever controls the deploy can authorize a new script origin. A compromised admin account cannot point the site at an attacker's script host.
  3. Exfiltration is contained. connect-src restricts where any script can transmit, so code that runs still has nowhere to send what it collects.
  4. It is client-side only. This executes in the visitor's browser. It cannot reach the server, the filesystem, other customers, or any database — the boundary that makes a WordPress plugin vulnerability so damaging does not exist here.

The honest framing: an administrator can cause JavaScript to run on their own site. That is true of every CMS on the market, and it is a feature, not a bypass. What differs is the blast radius — here it stops at the browser.


6. Limitations — what we do not do

A security document without this section should be discounted entirely. These are current as of the date above.

  • The AI connector is a network-reachable write surface. Enabling it (§3) widens the attack surface by design: anyone holding a valid credential can rewrite site content. OAuth grants can be revoked individually from the admin, and take effect immediately.
  • Our OAuth server has had adversarial review, not a professional audit. Two external review passes are recorded (§3), and an adversarial test suite (scripts/oauth-attack.mjs, scripts/oauth-attack-lifecycle.mjs, scripts/oauth-verify.sh) plus the connector end-to-end check (§4) exercise the claims. No security firm has reviewed it; oauth-review-brief.md exists to hand one.
  • Dynamic client registration is open; there is no token introspection or revocation endpoint. Any caller can register a client at POST /api/oauth/register (RFC 7591), because mainstream assistants pair that way and offer nowhere to paste a client ID. A registered client holds nothing until an admin or owner approves it by name on the consent screen (§3); registration is rate limited, capped, and registrations that never connect are pruned. Clients can also be created by hand in the admin. Access is revoked from the admin (§6, AI connector limitations), not by an RFC 7009 endpoint.
  • Ticket orders are plaintext JSON on the persistent disk. They hold buyer name/email (never card data — Stripe keeps that). There is no at-rest encryption beyond the host volume's, and durability depends on the mounted disk; a deployment without one loses runtime records on redeploy. Refunds are issued in the Stripe dashboard, not here.
  • MFA is not required everywhere. Two-step verification is available to every account and can be required per deployment (MYPRESS_REQUIRE_MFA, §3). It is on for sites provisioned since 2026-10-24 and off on older sites unless turned on; a deployment without it leaves accounts able to sign in with a password alone. Automation that signs in to such a site enrols like a person (scripts/admin-mfa.mjs) and keeps the authenticator secret beside the password on the operator's machine, so for that account the two factors share one disk.
  • Self-service recovery needs a second factor. The no-email recovery flow (§3) works only for an account that enrolled two-step verification and still has a code; an account with neither is recoverable only by another owner/admin or the break-glass CLI. That is the deliberate price of having no email-reset path.
  • TOTP only. No WebAuthn/passkeys, no hardware security keys, no SMS (SMS is omitted deliberately — SIM-swap attacks make it weaker than an authenticator app).
  • Content history is short and covers pages and posts only. Each page and post keeps its last 20 versions with who changed it and how (§3), and connector changes and restores are in audit logs, but there is no unlimited, tamper-proof content ledger: history lives with the site's content, so restoring an older whole-site backup replaces it with that backup's copy. Settings, menus, theme, forms and media are not versioned in-product.
  • Three roles, coarse-grained. Owner, admin, and editor (§3) — but no granular per-section permissions and no content-approval workflow.
  • Rate limiting is per-process and in-memory. It weakens if a site is scaled to multiple instances.
  • 'unsafe-inline' remains in script-src. Removing it requires per-request nonces, which would force every page to render dynamically and forfeit the static delivery this product's performance depends on. We chose containment (§3, §4) over prevention, knowingly. If your policy requires a nonce-based CSP, tell us — it is a deployment-level change, not an architectural one.
  • No third-party penetration test or formal certification. No SOC 2, no ISO 27001. The testing described above is our own.
  • Young product, short track record. WordPress has two decades of adversarial attention, a dedicated security team, and a mature WAF and monitoring ecosystem. We have a much smaller attack surface and far less history. Both statements are true and a serious reviewer should weigh both.
  • Single-tenant cuts both ways. No cross-tenant risk; also no shared monitoring or centralized incident response across a fleet.

AI connector limitations

  • Rate limits and the grant lock are in-process: correct for the single-instance deployments we ship, not shared across replicas.
  • The connector audit log lives with the site's content, so restoring an older backup replaces it with that backup's copy. It is a record of attribution, not a tamper-proof ledger.
  • Revocation is from the admin only; there is no RFC 7009 token-revocation endpoint. Access tokens last one hour, refresh tokens 90 days (rotated, reuse-detected).
  • Consent requires an admin or owner. Editors cannot connect an assistant themselves.
  • No Client ID Metadata Documents yet; assistants pair by dynamic registration or an admin-created client ID and secret.

7. Side by side

Comparing architectures, not quality. A well-maintained, hardened WordPress install is a reasonable system; most of the risk difference below comes from what each platform is, not from how carefully it is run.

WordPress (typical) THINQ Site
Data store MySQL JSON files — no database
Server-side extensibility Plugins and themes execute PHP None; features compile into the build
Typical third-party code Dozens of plugins, independently maintained 22 direct packages (~200 installed), one lockfile, updated as one unit
Patch model Per-plugin, continuous, owner-driven One repository, one build, one deploy
Upload risk Historic upload-to-shell class Non-executable stack; sandboxed media route
Bad content May render incorrectly Fails validation loudly
Tenancy Often shared hosting One deploy, one site, one volume
MFA Available via plugin Built in (TOTP), enforceable per deploy
Account recovery Email reset (inbox-takeover risk) Second-factor reset, no email; break-glass CLI
Audit log Available via plugin Built in (account actions)
Track record 20+ years, mature ecosystem New; smaller surface, less history

The fair summary: WordPress can be made secure with sustained effort and vigilance. THINQ Site starts without the categories of risk that effort is usually spent on — and is missing some conveniences that mature ecosystem provides.


8. Verify this yourself

We would rather you check than take our word. On any THINQ Site deployment:

  1. Headers: curl -sI https://<site> — confirm CSP, HSTS, X-Frame-Options, nosniff.
  2. Login lockout: nine bad logins from one IP; the ninth returns 429.
  3. Two-step verification: enable it on an account, sign out, then sign in with the correct password — you should receive a code prompt and no session until the code is supplied. Submitting the same code twice should fail the second time. On a deployment with MYPRESS_REQUIRE_MFA set, sign in as an admin who has not enrolled and call GET /api/admin/site directly — expect 403 mfa_enrollment_required; GET /api/admin/mfa still answers.
  4. Role enforcement: with an editor session, call an admin-only API endpoint directly (not through the UI) — expect 403.
  5. Session cookie: log in, then check the cookie flags in your browser's developer tools — HttpOnly and SameSite should be set, and Secure on any HTTPS deployment.
  6. CSP enforcement: add a page that loads a script from an unapproved origin; the browser console should report it blocked.
  7. AI connector: curl -si -X POST https://<site>/api/mcp — expect 401 with a WWW-Authenticate header naming resource_metadata. Repeat with -H 'Origin: https://evil.example' — expect 403. With an admin login, BASE=https://<site> ADMIN_CREDENTIALS_FILE=<file> node scripts/connector-e2e.mjs --remote runs the full pairing and the refusals, reverts its one write (then undoes a second one with restore_page_revision), and deletes what it created.
  8. Revision history: edit a page in the admin, open its History tab, and restore the previous version — the page returns exactly, and the version you replaced is now at the top of the list. Delete a page and restore it from Recently deleted under the Pages list. As an editor, try to restore a version that contains an embed block — expect 403. Request https://<site>/.history/pages/home/ or /..%2F.history%2Fpages%2Fhome — expect 404. The full automated check is scripts/revisions-e2e.mjs against a local production build (usage in the script header).
  9. Invited-user onboarding: add a user, and check the address you gave receives the username and a temporary password. Sign in with it — expect no session, a forced password change, then a forced two-step setup you cannot navigate away from, at any role; after enrolling, signing in demands the code. The full automated check is scripts/onboarding-e2e.mjs against a local production build (usage in the script header); it also proves the temporary password is never stored readable, that a code spent on enrolment cannot be replayed at login, and that an account which already enrolled is not asked to enrol again after an admin reset.
  10. Source review: the platform is a single repository and we will grant read access for a security review under NDA. The controls above are in src/lib/security-headers.ts, src/lib/admin-session.ts, src/lib/rate-limit.ts, src/lib/startup-checks.ts, src/lib/block-permissions.ts, src/lib/totp.ts, src/proxy.ts, for the connector src/lib/oauth/, src/lib/mcp/ and src/app/api/mcp/route.ts, and for revision history src/lib/content-history.ts, src/lib/content-restore.ts and src/lib/content-write.ts.

Reporting a vulnerability: email [email protected]. We will acknowledge within two business days. We do not currently run a paid bounty programme.


Any claim here that you cannot verify by the methods in §8 should be treated as unproven — tell us, and we will correct the document.

This text is maintained in thinq-site-core at docs/security-posture.md (commit e72488e) and published here unchanged.