Cross-Cutting Concerns & Shared Infrastructure
- Authentication, Sessions, MFA & RBAC:
- Application Auth: Self-hosted GoTrue (
v2.132.3) issues HS256 JWTs (aud: authenticated) signed withJWT_SECRETfor email/password, magic link, invite (INVITE_LINK_MODE=token_hash), and Google OAuth. Application-level RBAC/MFA rules are enforced byplanovi-backend(RLS/Edge Functions) andplanovi-flutter-app, notplanovi-vps. - Infrastructure/Host RBAC: 4 Linux groups (
planovi-admin,planovi-dev,planovi-auditor,sftp-only) provisioned viascripts/planovi-adduser.shwith key-only SSH (passwd -l) and command-restrictedscripts/planovi-dev-docker.sh. - Machine-to-Machine Auth: GitHub webhooks use HMAC-SHA256 (
WEBHOOK_SECRET); Edge Runtime -> PHP microservices useX-Api-Secret(DEALFLOW_API_SECRET/DEALFLOW_API_SECRET_DEV); IoT devices use mTLS viaplanovi-device-ca.pem(TCP:443SNI passthrough & MQTT:8883). - Network Perimeter Auth: Cloudflare origin-IP verification (
$is_cloudflare,444drop) on all public HTTPS vhosts +proxy/allowed_ips.confIP whitelist on Studio, Docs, Converter Admin/, and MQTT:8883.
- Application Auth: Self-hosted GoTrue (
- Multi-Tenancy & Data Isolation:
planovi-vpsenforces Environment Isolation (PROD vs DEV) via separate Docker containers, PostgreSQL volumes (supabase-db-datavssupabase-db-data-dev), Storage volumes, Edge Functions directories, and/opt/vps-apps/*/{prod,dev}folders.- Row-level multi-tenancy (
company_idRLS) is owned byplanovi-backendmigrations, notplanovi-vps.
- Branding Rules & i18n (PL/EN):
- Platform UI (
proxy/html/{404,50x,default}.html): Bilingual PL/EN via inline JS dictionary (defaults topl). Outdated branding: still uses deprecated#090d16dark navy,#3b82f6blue,#8b5cf6purple,#10b981emerald,Outfitfont, and text-basedPlanoviheader instead of canonical#09090B/#32CA42/Poppins/ official SVG logo. - GoTrue Auth Email Subjects (
docker-compose.yml:215-220,620-625): Hardcoded in Polish ("Planovi – potwierdź adres e-mail", etc.); HTML bodies are fetched fromplanovi-microservices. - Operational Chat Alerts (
deployer.py,backup.sh,check-health.sh,docker-prune.sh): Hardcoded in Polish.
- Platform UI (
- Global Error Handling, Logging, Timeouts & Security Guards:
- Docker Logs: Uniform
json-filedriver (max-size: 20m,max-file: 3) on all 22 services. - Nginx Timeouts & Limits:
keepalive_timeout 65,client_max_body_size 500M, defaultproxy_read_timeout 60s(no custom override on/functions/v1/or/api/v1/). - Deployer Safety Guards: Mandatory
WEBHOOK_SECRET, HMAC-SHA256 constant-time check, 600s rejection alert rate-limit,_deploy_lockserialization,.public.envsecret-regex +service_roleJWT blocker, and automaticgit reset --hardrollback.
- Docker Logs: Uniform