Last updated: 2026-11-10
What protects the site, the quote and keepalive functions, the leads database and the currency middleware, and what to do when you change something that touches them. To report a vulnerability, see ../SECURITY.md.
The site is static. The server code is api/quote.ts and api/keepalive.ts (Vercel Functions) and middleware.ts (a Vercel Edge Middleware that only chooses which prebuilt page to serve), plus whatever Vercel serves. /nullbreach belongs to a different Vercel application (microfrontends.json) with its own repository and policy. There are no user accounts and no cookies. Quote leads are stored in the Supabase project db-luminaw-terracore-okroot-pages (table public.leads, shared with TerraCore, OKroot and Lúmina W), which only the functions reach with the service role key.
- Runs only on the priced routes (
/servicios,/cotizar,/en/services,/en/quote, with and without the trailing slash) and on the internal/cop/prefix; every other path never reaches it (config.matcher). - Reads one header,
x-vercel-ip-country, which Vercel sets at the edge and the client cannot spoof. When it isCOthe request is rewritten internally to the prebuilt/cop/...variant of the same page; anything else, or no header, serves the public USD page. It never reads, logs or stores the address, and it sets no cookie. - A direct request to
/cop/...is answered with a 308 to the public URL, so the only way to see COP is to be in Colombia. Query strings, cookies and client headers have no effect (tests/currency.spec.ts). GEO_COUNTRY_OVERRIDEreplaces the detected country only whenVERCEL_ENVis notproduction; it exists to check the COP variant from a preview deployment orvercel dev. In production it is ignored even if set.- The variant pages are the same Astro pages built under another path: same inline scripts and CSP hashes, same canonical URL, hreflang and structured data (
publicUrlinLayout.astro), and they are excluded from the sitemap. Nothing new is loaded, so the CSP does not change. - It has no dependencies: the rewrite and pass-through responses are the
x-middleware-rewriteandx-middleware-nextheaders the official helpers emit.
| Header | Value |
|---|---|
X-Frame-Options |
DENY |
X-Content-Type-Options |
nosniff |
Referrer-Policy |
strict-origin-when-cross-origin |
Permissions-Policy |
camera=(), microphone=(), geolocation=(), payment=(), usb=() |
Cross-Origin-Opener-Policy |
same-origin |
Strict-Transport-Security |
max-age=63072000; includeSubDomains; preload |
Content-Security-Policy |
see below |
default-src 'self';object-src 'none';frame-ancestors 'none';base-uri 'self';form-action 'self';upgrade-insecure-requests.script-src 'self'plus 7sha256-hashes (one per distinct inline script, none left over), plushttps://cloud.umami.is,https://analytics.umami.is,https://assets.calendly.comandhttps://tracker.metricool.com.connect-src 'self'plus the Umami hosts andhttps://calendly.com;frame-src https://calendly.com.style-src 'self' 'unsafe-inline'plushttps://assets.calendly.com;font-src 'self'.img-src 'self' data:plushttps://*.calendly.comand one CloudFront host (d3v0px0pttie1i.cloudfront.net) andhttps://tracker.metricool.com(the Metricool page-view beacon).
Inline scripts (theme, navigation loader, bundled module scripts such as the on-demand Calendly loader of the contact page that Astro inlines; JSON-LD is data and exempt) are allowed only by hash. When an inline script changes, its hash changes and the browser would block it in production.
npm run buildnpm run csp:check(scripts/check-csp-hashes.mjs, which readsdist/) lists every inline script whose hash is missing fromvercel.jsonand every hash invercel.jsonthat no inline script uses; either one fails the check.- Replace the stale hash with the new one in
script-src, or remove it when its script is gone; CI runs the same check.
- Accepts only
POST; anything else returns 405. Responses carryCache-Control: no-store; success is 201. - Monthly SEO is sold only to development clients: a quote that asks for
monthly-seois accepted only whenpublic.leadsholds awavivallead with statuswon, the same email and at least one development service, the REST APIs block or a kit. The lookup is a read (select=id&limit=1); when it finds nothing (unknown email, lead not won, no development service), fails or the Supabase variables are missing, the function answers the same 422{"error":"Development clients only"}, never sooner thanREFUSAL_FLOOR_MS(1200 ms) after the check started, and neither stores nor emails the quote. Status, body and timing are the same in every refusal so the answer cannot tell whether an email belongs to a client. The form then shows "Este servicio es solo para clientes que han contratado un servicio de desarrollo conmigo." / "This service is only available to clients who have hired me for a development service." - Checks run in this order, and a failure stops the request:
- Origin: the
Originheader must behttps://www.wavival.dev,https://wavival.dev, anhttp://localhostorhttp://127.0.0.1origin, the host of the running Vercel deployment (VERCEL_URL,VERCEL_BRANCH_URL) or a host listed inQUOTE_ALLOWED_HOSTS. Anything else, or a missing header, returns 403. This stops other sites from using the visitor's browser to post to the function; it is not authentication, because a script can set any header. - Content type:
application/jsononly; anything else returns 415. - Rate limit: 5 requests per source address in 10 minutes, answered with 429 and
Retry-After. The address comes fromx-real-ipor the firstx-forwarded-forvalue, is held only in the memory of the function instance (at most 1000 entries, expired ones pruned) and is never stored or sent anywhere. It is best-effort: each Vercel instance keeps its own count and a restart clears it, so the durable limit is a Vercel firewall rule (see "Settings that live outside the repository"). - Body: more than 20,000 characters returns 413; a body that is not JSON returns 400.
- Origin: the
- Validates every field on the server against closed lists (
src/data/quoteOptions.ts,src/data/countries.ts,src/data/pricing.ts,src/utils/currency.ts). Name (up to 120 characters), business (up to 160), email (up to 254, well formed), phone, description, services, country, budget range, currency, locale, consent and source are required. The phone must be in international format (+and 8 to 15 digits; spaces, parentheses and hyphens are stripped first). The description has up to 5000 characters and 500 words. Services must all be catalog ids (the ids of the previous form are mapped first:custom-web-applications,ai-integrations,security-appsec), the country an ISO 3166-1 alpha-2 code of the list, the currencyCOPorUSD, the budget range one of the seven ids with bounds in that currency, the localeesoren, the three optional fields (how found, preferred channel, timeline) empty or one of their options,consentexactlytrue, andsourcea path that starts with/cotizar,/en/quoteor their/cop/variants. Anything else returns 400; nothing unknown is silently dropped. - Reads two request headers into the lead:
x-vercel-ip-country(set by Vercel, stored asgeo_country) anduser-agent(trimmed to 512 characters). The address is never read or stored.consent_atis the server time. - Honeypot: a filled
websitefield returns the same 201 success without sending anything. - Output is escaped (
escapeHtml) before it goes into the email HTML. - Stores the lead first, then notifies. The insert goes to
public.leadsthrough PostgREST (src/server/supabase.ts,POST /rest/v1/leadswithPrefer: return=minimal, 10 second timeout) asproduct = 'wavival'withname,email,phone,company,message,services,country,geo_country,budget_range,currency,how_found,preferred_channel,timeline,locale,user_agent,sourceandconsent_at. The email then goes towavival.dev@luminaw.cothrough the Brevo API with a 10 second timeout,replyTothe sender, every field above and the line "Guardado en base de datos: sí / no". - Answers 201 when at least one of the two channels worked and 502 only when both failed (a missing variable counts as a failure of that channel), so a database outage never loses the email and an email outage never loses the row.
BREVO_API_KEY,SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEYare read from the server environment only and never have thePUBLIC_prefix. The service role key bypasses RLS, sosrc/server/supabase.tsis imported only by the functions and never by browser code.- Failures are written to the Vercel function logs with a fixed message ("Supabase insert failed or timed out", "Supabase variables are not set, lead not stored", "Brevo request failed or timed out") and, for Brevo, only the status code: never the name, email, phone, description or any key. Those logs are the only monitoring today.
- The browser form posts to the same origin and keeps the submit button disabled until the form and the privacy consent are complete. Any non-success response shows the generic error message.
- Tests:
tests/quote-api.spec.tscovers the closed-list validation, the legacy id mapping, the stored row, the email content, origin, content type, size, rate limit, each channel failing alone and both together, the honeypot, and that neither key nor any personal data reaches a response or a log line.
- Supabase pauses a Free project after seven days without requests.
vercel.jsonschedules a Vercel Cron (0 9 */3 * *, every three days) that callsGET /api/keepalive. - Vercel sends the cron request with
Authorization: Bearer <CRON_SECRET>; the function answers 401 to any other value, to a missing header and whenCRON_SECRETis not set, and 405 to anything butGET. - It runs one
HEAD /rest/v1/leads?select=id&limit=1with the service role key and returns{ "ok": "true" }: no row, column or count leaves the function. A failure returns 502 (500 when the Supabase variables are missing) with a fixed log line. - Tests:
tests/keepalive-api.spec.ts. - Not implemented: CAPTCHA. Add it only if the rate limit and the firewall rule prove insufficient.
- Quote data: name, email, phone, business name, services, country, budget range and currency, description, the three optional answers, page language, user agent, entry page and consent time, stored in Supabase (us-east-1) to follow up and emailed to the owner (
/privacidad, sections 02, 04 and 05). The source address used by the rate limit is not part of that data and is not stored; the detected country code is stored (geo_country) but the address is not. - Retention: leads of people who do not become clients are deleted 24 months after the last contact, and earlier on request to
wavival.dev@luminaw.co. The deletion is a pending job (seeROADMAP.md). - Database access: RLS is enabled on
public.leadswith no policies, andanonandauthenticatedhave no grants, so the Supabase anon key cannot read or write leads. The service role key lives only in Vercel. The migration issupabase/migrations/20261108120000_wavival_quote_leads.sql. - Country: the middleware reads the country code Vercel derives from the address to pick the currency of the page and does not store it; the quote function stores the same code with the lead. The address itself is never read by either.
- Analytics: Umami, cookieless and aggregated, enabled only when both variables are set. Metricool's web tracker (
public/scripts/metricool.js, production builds only) is also cookieless: per page view it sends an image request with the page URL, window size and referrer. No tracking cookies, so no consent banner. - Third parties: Supabase (lead storage), Brevo (quote delivery), Calendly (contact page, loaded only after the visitor presses "Agendar una llamada" / "Book a call"), Vercel (hosting, logs and cron). Fonts are self-hosted.
scripts/check-audit.mjsfails CI on high or critical advisories in production dependencies unless the advisory is listed with a reason inACCEPTED. The list is empty today:npm auditreports 0 vulnerabilities. Add an entry only when no patched release exists, with the reason and when to look at it again. The script reports an accepted advisory that is no longer flagged so it can be removed.package.jsonoverridespin patched versions of transitive packages:basic-ftp,tmpanduuid;lighthouse,puppeteer-coreand@puppeteer/browsers(the Lighthouse CI chain, which also dropsextract-zip); andjs-yaml4 inside@lhci/utils(it removesargparse1 andsprintf-js; it is safe becauselighthouserc.jsonis JSON and@lhci/utilsonly calls the removedyaml.safeLoadfor YAML configuration files).eslint-plugin-astrois on 3, which fixes thefast-globchain ofastro-eslint-parser.@vercel/microfrontendswas removed: its Vite plugin only served the local development proxy, production routing of/nullbreachstays inmicrofrontends.json, and the package carried thebracesadvisory (GHSA-vfj7-8cjw-p6xm, no patched release) throughfast-globandmicromatch.npm auditreports 0 vulnerabilities. Tailwind 4 andnpm audit fixcleared the others.- Gitleaks scans every push and pull request (
.github/workflows/gitleaks.yml). - CodeQL (
.github/workflows/codeql.yml) analyzes the TypeScript, JavaScript and GitHub Actions code on pushes and pull requests todev,stgandmain, and weekly. Results appear under Security > Code scanning. - Dependency updates are manual. Run
npm outdatedandnpm auditperiodically;check-audit.mjsgates CI on production advisories. npm major versions are migrated by hand in their own pull request (seeROADMAP.md). - Reusable workflows come from the public repository
lumina-w/agents, pinned to a tag. First-party actions are pinned to a major version tag. scripts/check-security-txt.mjsruns in CI (npm run security-txt:check): it fails whensecurity.txthas expired and warns during the last 60 days.- Secrets live only in Vercel and GitHub settings.
.envis ignored by git;.env.exampledocuments the names without values. - Links that open a new tab get
rel="noopener noreferrer"(ButtonandTextLink). public/.well-known/security.txt(RFC 9116) expires on 2027-06-18 and must be renewed before then; CI warns from 2027-04-19 and fails after the date.
How each category applies to this site, what covers it and what is left. "Not applicable" means the site has no such feature today; if it gains one, the category applies.
| Category | Status | What covers it | Gap |
|---|---|---|---|
| A01 Broken Access Control | Covered | No accounts or roles on the site. The leads table has RLS enabled with no policies and no grants to anon or authenticated; only the service role key, held in Vercel, reaches it from the two functions. The quote function accepts one action and checks the request origin; the keepalive requires CRON_SECRET; the middleware only picks a prebuilt page. |
None. |
| A02 Cryptographic Failures | Covered | HTTPS only (Strict-Transport-Security with preload, upgrade-insecure-requests); the Brevo key, the Supabase service key and the cron secret live in server variables; leads travel to Supabase over TLS and rest in a managed Postgres. |
None. |
| A03 Injection | Covered | Server-side validation against closed lists, escapeHtml in the email, JSON body parsed as data, the insert sent to PostgREST as JSON (no SQL is built from input), CSP with script hashes, no eval. |
None. |
| A04 Insecure Design | Partial | Honeypot, field limits, body limit, origin check, rate limit, timeout and generic errors. Currency decided from a header the client cannot set; the override is ignored in production. | Rate limit is per instance; no CAPTCHA. |
| A05 Security Misconfiguration | Partial | Full header set (CSP, HSTS, framing, MIME sniffing, referrer, permissions, opener), checked by tests/security-headers.spec.ts; .env ignored. |
style-src 'unsafe-inline'; the CloudFront image host. |
| A06 Vulnerable and Outdated Components | Partial | check-audit.mjs gates CI on production advisories; CodeQL; overrides for patched transitive packages. |
Advisories without a patched release (see ROADMAP.md). |
| A07 Identification and Authentication | Not applicable | No login on this site. /nullbreach is another application with its own policy. |
None here. |
| A08 Software and Data Integrity | Partial | Lockfile with npm ci, hashed inline scripts, reusable workflows pinned to a tag, Gitleaks, CodeQL on workflows, contents: read permissions. |
Actions are pinned to tags, not commit SHAs. |
| A09 Logging and Monitoring | Partial | Both functions log every failure without personal data or keys; the middleware logs nothing; Vercel keeps the logs and the cron history; the email says whether the lead was stored; CI reports every check. | No alert on repeated function errors. |
| A10 Server-Side Request Forgery | Not applicable | The functions call two fixed destinations: the Brevo URL and the Supabase project URL from a server variable; no request or user value reaches a URL. | None. |
These are set in GitHub and Vercel, so no pull request can enforce them. Check them after any change of repository, plan or team, and tick them off in ROADMAP.md.
- GitHub, Settings > Rules or Branches:
dev,stgandmainprotected, pull request required, status checks required (quality,tests,lighthouse,links,gitleaks, commit lint, PR title, base check), force pushes and deletions blocked. - GitHub, Settings > Code security: secret scanning with push protection, and code scanning (fed by
codeql.yml) enabled. - Vercel, Firewall: a rate limit rule on
POST /api/quote(for example 5 requests per 10 minutes per IP) so the limit survives instance restarts and spans instances. - Vercel, Environment variables:
BREVO_API_KEYin Production and Preview only;SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEYandCRON_SECRETin Production only, never in Preview or Development, so no preview deployment can reach the shared database (a quote sent from a preview is emailed with "Guardado en base de datos: no" and the cron only runs in production);QUOTE_ALLOWED_HOSTSonly when another domain (for example a staging domain) must post quotes;GEO_COUNTRY_OVERRIDEnever in Production (the code ignores it there, but keep it out as well). - Vercel, Cron Jobs:
/api/keepaliveevery three days (vercel.json); check the first runs after the deployment. - Supabase, project
db-luminaw-terracore-okroot-pages:public.leadswith RLS enabled, no policies, no grants toanonorauthenticated. After the 2026-11-08 migration the security advisor reports only the INFO notice "RLS enabled, no policy", which is the intended state, and the performance advisor only the two new indexes as unused so far. Any change goes through a migration file insupabase/migrations/shown to the owner first, because the table is shared with TerraCore, OKroot and Lúmina W. - Vercel, first deployment of the middleware: check from a preview deployment that
/serviciosreturns the COP variant withGEO_COUNTRY_OVERRIDE=CO, that/cop/serviciosredirects to/servicios, and that/servicioswithout the override shows USD. - Gitleaks over the whole history: run
gitleaks gitonce from a clone after any change of its configuration; the CI job scans each push.
- New inline script: update the CSP hash and run
npm run csp:check. - New third-party host: add the minimum CSP directive, document it here and in the privacy page.
- New environment variable: document it in the README table and
.env.example; usePUBLIC_only for values safe to expose. - Change to
api/quote.ts: keep the origin, content type, rate limit and body checks, the closed-list validation and escaping, the store-then-email order and the 201/502 rule, and updatetests/quote-api.spec.ts. - Change to the database: write a new file in
supabase/migrations/, show the full SQL to the owner and apply it only after her confirmation; never touch the columns of the other products; run the Supabase security advisors afterwards. - New page with a price: add its route to
PRICED_ROUTES(src/utils/currency.ts), to the matcher inmiddleware.tsand a one-line variant page undersrc/pages/cop/;tests/currency.spec.tschecks the three stay in sync and that no page mixes currencies. - New feature with accounts, uploads, stored data or outbound requests: revisit the OWASP table above before merging.
- Change to the headers: update the table above and
tests/security-headers.spec.ts. - Never put secrets, client data or vulnerabilities in the repository, issues or pull requests.
See ROADMAP.md: the quote limit is per instance and has no CAPTCHA, actions are pinned to tags and not SHAs, the CloudFront image host and style-src 'unsafe-inline' are to review.