Skip to content
📦 ARCHIVED SNAPSHOT (v1.0) You are viewing historical business logic and documentation for Webpage (planovi.app) v1.0 (frozen on 2026-11-23, commit 69f9463). Switch to Latest →

Cross-Cutting Concerns & Shared Infrastructure

Authentication, Sessions, MFA & RBAC

  • No user authentication, JWTs, MFA, or RBAC exist in this repository. All web pages and JSON endpoints are public.
  • PHP Sessions (i18n.php:8-15): Used exclusively to persist UI language ($_SESSION['lang']). Configured with HttpOnly=1, SameSite=Lax, and Secure=1 when $_SERVER['HTTPS'] is on. Waitlist API endpoints (waitlist-handler.php, waitlist-qualify-handler.php) and sitemap.php are completely stateless (do not start sessions).
  • Service-to-Service Auth:
    • contact-handler.php, includes/blog-repository.php, status.php authenticate to Supabase using supabase.key (anon/public key relying on RLS).
    • includes/waitlist.php authenticates to Supabase using waitlist.supabase_service_key (service_role, bypassing RLS) and to Resend using resend.api_key (Bearer token).
    • Step 2 waitlist authorization uses a cryptographically random 32-byte bearer token (SHA-256 hashed in DB, 24h TTL, single-use atomic CAS).

Multi-Tenancy & Data Isolation

  • Single-tenant public marketing platform: No tenant/company scoping, org switching, or tenant JWTs exist in planovi-webpage.
  • Database Schema Isolation (supabase/website_schema.sql): Marketing tables reside in a dedicated PostgreSQL website schema (website.website_form_messages, website.waitlist, website.blog_posts) separate from core multi-tenant platform tables in public (except status.php, which reads public.app_modules + public.app_modules_maintenance).
  • RLS Summary (supabase/website_schema.sql):
    • website.website_form_messages: anon/authenticated → INSERT only (WITH CHECK (true)); service_role → ALL.
    • website.waitlist: service_role → ALL; anon/authenticated → completely denied.
    • website.blog_posts: anon/authenticated → SELECT where is_published = true; service_role → ALL.
    • storage.objects (blog-media): anon/authenticated → SELECT; service_role → ALL.

Branding Rules (Zone 1 vs. Zone 2) & i18n (pl / en)

  • Zone 1 (100% of planovi-webpage):
    • Neutral graphite dark mode (#09090B main, #121215 secondary, rgba(20,20,24,0.72) glass cards) and crisp zinc light mode (#FAFAFA main, #F4F4F5 secondary, rgba(255,255,255,0.88) glass cards).
    • Brand accent #32CA42 (--brand-solid, Dark Mode text/borders) and #22A830 (Light Mode text/links for WCAG AA).
    • WCAG AAA button rule: #09090B foreground on #32CA42 solid controls (9.4:1 contrast).
    • Official SVG wordmark (assets/brand/planovi-logo-currentcolor.svg) via components/brand-logo.php; no .logo-dot recreation.
    • Legacy CSS variable aliases --teal and --teal-glow are preserved in css/style.css:26-27,55-56 mapped directly to var(--brand) / var(--brand-glow).
  • Zone 2 (Not rendered here, documented in BRANDING_GUIDE.md): White-label tenant widgets in planovi-microservices / planovi-flutter-app use dynamic --tenant-primary and WCAG luminance contrast (lum > 0.42 ? #09090B : #FFFFFF).
  • i18n (pl / en): JSON dictionaries in lang/pl.json and lang/en.json (213 lines each). Default 'pl'. Switchable via ?lang=pl|en with 302 clean redirect and 30-day lang cookie. Blog articles override <html lang> with $post['lang'] and switch across localized slugs via translation_key.

Global Error Handling, Logging, Retry/Timeout Policies & Security Guards

  • Outbound HTTP Timeouts (cURL):
    • Cloudflare Turnstile siteverify: 10s (includes/waitlist.php:116, contact-handler.php:76).
    • Supabase PostgREST: 10s for waitlist/contact/status (includes/waitlist.php:173, contact-handler.php:137, status.php:22); 8s for blog list/post (includes/blog-repository.php:62,107); 4s for blog translation lookup (includes/blog-repository.php:136).
    • Google Chat webhook: 10s (contact-handler.php:166).
    • Resend API: 5s (includes/waitlist.php:232).
  • Retry Policies:
    • Server-side: Zero automatic retries on external HTTP failures (waitlist handles 409 insert race by performing one GET + PATCH recovery).
    • Client-side: js/script.js:271-279 and js/waitlist.js:17-19 perform 1 retry of POST to response.url if the server returned an HTTP redirect (response.redirected).
  • Logging Policy:
    • Only includes/waitlist.php writes structured server logs via error_log('[waitlist] ...') (PII-free and secret-free).
    • contact-handler.php, includes/blog-repository.php, and status.php perform zero error_log() calls on cURL/API failures.
  • Security Guards:
    • Fail-closed Cloudflare Turnstile on both forms (waitlist also enforces action, hostname, and token <= 2048 bytes).
    • Baseline HTTP security headers via send_security_headers() on all pages including i18n.php (missing on sitemap.php and waitlist JSON endpoints).
    • Open Redirect guard on ?lang= redirect (i18n.php:41).
    • PostgREST filter sanitization + slug regex validation + DOMDocument HTML sanitizer (includes/security.php — note DOM-unwrapping XSS bug BR-SEC-06).