Tour the Atmosphere. Switch clients, share universal links, browse any PDS.

Harden security, error handling, and platform config from codebase review (#55)

Security - Escape JSON-LD before dangerouslySetInnerHTML on both record pages via a tested serializeJsonLd() helper, closing a stored-XSS vector where a post's text or author display name (e.g. </script><img onerror=...>) could break out of the ld+json script and execute on any shared universal link. - Sanitize the reply-parent external-embed URL/thumb in PostPreview and guard its hostname parse, matching the already-sanitized main-post and quote paths (blocks javascript: hrefs from attacker-controlled parent records). - Add an edge-safe SSRF host guard (ssrfGuard.ts) and apply it in /api/resolve head-detection and /api/og/explore did:web resolution, so caller-supplied URLs/hosts can no longer probe loopback/private/link-local addresses. Mirrors the existing /api/did-doc guard. Reliability / performance - Add upstreamFetch() wrapping every appview/PDS/PLC call with an 8s timeout and one network-level retry, fixing 300s function timeouts on /api/og/profile and transient ECONNRESET failures against public.api.bsky.app. - Bound remaining OG-route upstream fetches with AbortSignal.timeout. - sanitizeOgText() strips decorative-symbol glyphs and swap literal arrow/ chevron glyphs for inline SVG, fixing @vercel/og dynamic-font HTTP 400s that crashed image generation for exotic display names. - Log expected upstream 4xx (bad handle/rkey in a shared link) as warnings instead of errors so the production error dashboard stays signal-rich. Platform / Next.js - Add error.tsx + global-error.tsx (styled error boundaries with retry), sitemap.ts, and robots.ts. - Drop the 1-year immutable Cache-Control on /api/og/* in vercel.json so OG images refresh (routes set their own 1h cache + revalidate). - Stop tracking tsconfig.tsbuildinfo (build artifact) and gitignore it. Code quality - Replace `any` with precise types across recordFetcher, profileFetcher, PostPreview and margin previews; resolve all 29 ESLint errors (incl. set-state-in-effect in CredBlueScore/DownloadCTA). Typecheck + lint clean. Claude-Session: https://claude.ai/code/session_01DF1WX7iG9AL7FVXVbmmPNo Co-authored-by: Claude <noreply@anthropic.com>


Author dame.is
Co-author Claude Committer GitHub Date Commit Parent bdce414b