Static site for Nexus Security Advisors, deployed on Cloudflare Pages.
site/– the deployed website (Cloudflare Pages build output directory). Pretty URLs:/servicesservesservices.html.site/_headers– security headers (CSP, HSTS, frame, referrer, permissions policies).functions/_middleware.js– adds a fresh nonce toscript-srcon every HTML response, so Cloudflare's injected bot-detection script is allowed without'unsafe-inline'.site/_redirects– legacy URL redirects.tools/build.py– rebuildssite/from the original Zoho Sites exports inzoho-export/.zoho-export/– original page snippets and assets exported from Zoho Sites (Oct 2026), kept for reference..python-version– Python used for thetools/scripts (3.14, the same version as the org's other repos).
Every push to main deploys automatically. No build step is required on Cloudflare: framework preset None, build command empty, output directory site.
python3 tools/serve.py site # preview with the production CSP at http://127.0.0.1:8088
python3 tools/build.py zoho-export site # rebuild site/ from the Zoho exports (standard library only)
python3 tools/externalise_styles.py site # move inline CSS into hashed files under site/css/
python3 tools/bundle_styles.py site # then combine each page's stylesheets into one /css/b-<hash>.cssBoth scripts need only the Python standard library. Use the version in .python-version.
Note:
build.pydoes not producesite/nexus-favicon-512.webp(it was added tosite/directly). Restore it after a rebuild, or add it tozoho-export/assets/.
Security contact: see /.well-known/security.txt or https://www.nexussecurityadvisors.com/trust#disclosure
/readiness-check is an interactive 8-question self-assessment (CMMC/800-171, HIPAA, SOC 2, cyber insurance, AI governance). It produces an instant score and top-3 priorities, creates a Lead in Zoho CRM (Lead Source "Readiness Check"), and pre-fills /get-started for the follow-up call.
site/readiness-check.html,site/js/readiness-check.js: page and client logic (CSP-compliant, no inline script).site/readiness-bank.json: question bank used by both the page and the API.functions/api/readiness.js: Cloudflare Pages Function atPOST /api/readiness. Validates input, blocks bots (honeypot, minimum fill time, and server-verified Turnstile), rate-limits (5 per IP per hour, 3 per email per day), scores server-side, optionally writes the summary with Claude Haiku, and posts the lead to Zoho Web-to-Lead server-side.
The Anthropic API key exists only as a Cloudflare secret. The browser never sees it. Without a key, the tool still works with the built-in report.
- Bindings > KV namespace: create a namespace
nexus-readiness-rl, then bind it asRL(Production and Preview). - Variables and Secrets: add
ANTHROPIC_API_KEYas an encrypted secret (a key from thewebsite-leadgenworkspace in Claude Console) andTURNSTILE_SECRETas an encrypted secret from the existing Turnstile widget. Optional:AI_DAILY_CAP(default 150) andTURNSTILE_HOSTNAMES(comma-separated hostnames for this deployment; defaults towww.nexussecurityadvisors.com,nexussecurityadvisors.com). Keep production hostnames exact and never includelocalhostor127.0.0.1in a production value. - Edge rules (WAF, rate limiting, URL normalization): the custom WAF rules must let
POSTthrough towwwon/api/readiness,/api/intake,/csp-reportand the analytics relay under/r7/, or submissions get Cloudflare's "Sorry, you have been blocked" page and analytics stops. The exact rules and settings are documented in the privateNexusSecurityAdvisors/infrarepo, where a daily drift check compares the live zone with a reviewed baseline. Change them there, not here. - Optional: in Zoho CRM, add "Readiness Check" to the Lead Source picklist so leads are tagged cleanly.
npx wrangler pages dev site --kv RL --binding LEAD_SINK=off. LEAD_SINK=off skips the Zoho POST so tests don't create real leads.
The 5-step intake no longer posts from the browser straight to Zoho. It sends JSON to functions/api/intake.js (POST /api/intake), which:
- checks origin and size, and forwards only an allowlist of Zoho fields (the client cannot override form tokens, Lead Source, or add fields)
- requires consent, drops honeypot and too-fast (<8s) submissions with a fake success
- appends the visitor's PostHog anonymous ID (if PostHog loaded and they did not opt out) to the end of the lead summary (
LEADCF6, shown in Zoho as Inquiry Message) asPostHog ID: …, the join key between a Zoho lead and its analytics session. Web-to-Lead accepts only fields on the Zoho web form, so move it to a dedicated field once one is added there - verifies Cloudflare Turnstile server-side (action
intake, same widget andTURNSTILE_SECRETas the Readiness Check) - rate-limits per IP (5/hour) and per email (3/day) in the
RLKV namespace, failing open if the binding is missing - posts the lead to Zoho Web-to-Lead and only reports success to the visitor if Zoho accepted it
/api/intake is already in the WAF exception above. Local test: npx wrangler pages dev site --kv RL --binding LEAD_SINK=off.
site/js/analytics.jsandsite/js/readiness-check.jskeep fixed names; their script tags carry?v=<content hash>so/js/*can be cached for a year. After editing either file runpython3 tools/stamp_assets.py site(tools/check_site.pyfails on a stale stamp).site/js/analytics.js(source copy:tools/analytics.js) loads PostHog through the first-party relayfunctions/r7/[[path]].js(/r7/*to PostHog US Cloud), based on PostHog's Cloudflare proxy. The relay forwards only to PostHog's two hosts and only for an allowlist of SDK endpoints (anything else returns 404). It rebuilds request headers from an allowlist, so cookies and Authorization (includingphx_personal API keys) never reach PostHog, caps bodies at 2 MB, and stripsSet-Cookiefrom responses. If PostHog adds an SDK endpoint, add it toAPI_ROUTESor those calls will 404. It needs the/r7/exception in the edge rules above.- Page scripts send custom events with
(window.__nsaq = window.__nsaq || []).push([name, props]), neverposthog.capturedirectly: they run before the deferred analytics.js, and the queue is flushed once PostHog initialises. Current events:intake_step_viewed,intake_started{field},intake_blocked{reason: required | email | consent | turnstile, detail},intake_send_failed{status, error},intake_submitted,readiness_check_completed. Never put form contents or contact details in event properties. - Your own visits: open any page once with
?internal=1in each browser you use. PostHog's default filter then excludes it.?internal=0removes the tag. - PostHog honours Do Not Track. Project-side settings (IP discarding, replay masking, the test-account filter) live in PostHog, not in this repo.