Files
worldmonitor/api
Pranav Garg b793a61c87 fix(api): harden IP extraction, input validation, redirect SSRF check, and origin-pattern parity (#1013)
- register-interest.js: coerce source/appVersion to string with a 100-char cap
  before forwarding to Convex. Non-string values (objects, arrays) are truthy so
  the previous || 'unknown' guard passed them through, causing Convex to throw
  a type-validation error and surface a 500 to the caller. Also fixes unbounded
  metadata strings filling the registrations table cheaply.

- rss-proxy.js: apply the same www-normalization used by the initial domain check
  to the 301-redirect hostname check. The old bare ALLOWED_DOMAINS.includes(hostname)
  call rejected canonical redirects (e.g. bbc.co.uk -> www.bbc.co.uk) even when
  one form is allowlisted, breaking several feeds silently.

- _api-key.js: align BROWSER_ORIGIN_PATTERNS Vercel-preview regex with the
  narrower pattern already enforced by _cors.js (worldmonitor-*-elie-*.vercel.app).
  The broader worldmonitor-*.vercel.app pattern was dead code because _cors.js
  rejects those origins before _api-key.js is reached.
2026-03-05 07:18:59 +04:00
..