Codex LaboratoriesAnalytics
Sign inGet started

Security

Defense in depth, described the way it's actually implemented - not the way marketing wishes it were.

Authentication

  • Email + password accounts, bcrypt-hashed at rest (cost 10). Plaintext passwords are never stored or returned by any API.
  • Session tokens are `v1.<base64url payload>.<hmac-sha256>` signatures verified with a constant-time compare, carrying a 7-day server-enforced expiry.
  • Every token carries a unique jti; logout records it in a revocation denylist so the credential dies immediately instead of lingering until expiry. The list self-prunes expired entries.
  • Sessions are delivered as HttpOnly, SameSite=Lax cookies; the Secure flag is set whenever the request arrives over TLS.
  • Registration is rate-limited per IP; login attempts are rate-limited on both client IP and target email - spoofing X-Forwarded-For cannot unlock unlimited attempts against one account.
  • Failed logins always return the same "Invalid credentials" error, so the endpoint cannot be used to enumerate accounts. The real reason (unknown email vs bad password) goes only to the audit log.
  • The realtime socket gate verifies the same signed token through the same verifier module the HTTP guards use - one crypto implementation, no drift - then rechecks site access against the database.

Authorization & tenancy

  • Every signup creates an isolated organization - users never see another org by default.
  • Access is granted per user, per website on a five-rank ladder: viewer < analyst < editor < admin < owner.
  • Server-side requireWebsiteAccess() enforces the role floor on every site-scoped API route: reads need viewer, exports and forecasting need analyst, mutations need editor, access management and audit trails need admin, destructive actions need owner.
  • Grants are re-read from the database on each request, so a revoked user loses access on their very next call - there is no cached session-side permission to go stale.
  • Org-level roles in the session token do not substitute for a website grant; WebsiteAccess rows are the single source of truth.
  • Only owners may grant the owner role; the last owner of a site cannot be removed. Tracking-ID rotation and site deletion are owner-only.

Ingest integrity

  • Public beacon endpoint accepts only schema-validated events (v:1 contract); bodies are capped at ~1 MB / 100 events per batch and rejected before any database write when invalid.
  • Ingest is rate-limited per client IP (100 req/min) with Retry-After semantics.
  • Server-side dedup on the (website, eventId) unique constraint makes retries safe - redeliveries are acked as duplicates without inflating counts.
  • Loopback/LAN source IPs and localhost event URLs are filtered before they mint sessions; blocklisted tracking IDs (e.g. excluded properties) are acked and dropped.
  • Unknown or deactivated tracking IDs are rejected outright - events only land on properties that exist and are active.
  • Client timestamps are untrusted: anything future-dated beyond a 15-minute skew allowance is clamped to server time, and server-side createdAt remains the authoritative ingest time.
  • CORS echoes an explicit origin allowlist - no wildcard credentialled access.

Privacy controls

  • Visitor IPs are anonymized before storage: the last IPv4 octet (or IPv6 segment) is zeroed, so the full address is never persisted.
  • Geo resolution runs fully offline against bundled GeoLite2 data - no external lookup calls - and only country and city are stored alongside the anonymized address.
  • Bot and synthetic traffic is classified at ingest (crawlers, social link-previews, headless browsers, CLI tools, uptime monitors, load testers) and excluded from audience metrics; synthetic senders flag themselves via properties.synthetic.
  • No third-party trackers on this application; the only beacon is our own first-party script.
  • See /privacy for the data-handling policy.

Application hardening

  • CSRF guard on every mutating route: Sec-Fetch-Site must be same-origin when present and Origin must match the forwarded host - layered on top of SameSite=Lax cookies.
  • Tiered rate limits: 5/min on auth endpoints, 100/min on the public beacon, 1000/min across the rest of the API.
  • Parameterized ORM queries only - no raw user SQL.
  • File uploads (support attachments) are validated by magic bytes rather than the client-declared MIME type, capped at 5 MB against an explicit allowlist, and stored under server-generated random keys - never a user-supplied path.
  • Security headers on every route: Content-Security-Policy (default-src 'self', object-src 'none', frame-ancestors 'none'), X-Frame-Options DENY, X-Content-Type-Options nosniff, Referrer-Policy strict-origin-when-cross-origin, and a Permissions-Policy disabling camera, microphone and geolocation.
  • Payment webhooks (APEX) are HMAC-verified with constant-time comparison and a 300-second replay window; an idempotent handler makes redelivery safe.
  • Structured audit log of administrative actions (who, what, where); audit writes are fail-open so logging can never break the request path.
  • API errors follow a stable machine-readable code contract (VALIDATION, FORBIDDEN, RATE_LIMITED, ...) - stack traces and internals are never leaked to clients.
  • Secrets live in environment files with 0600 permissions; never returned by any API.

Found a vulnerability? Report it through the channels on the support page. Do not publicly disclose before we've had a reasonable window to respond.