Guide technique
Vue complète de l'infrastructure, du stack technologique, des flux de données et des mécanismes de sécurité de la plateforme Livodit AI.
Stack technologique
| Couche | Technologie | Version | Rôle |
|---|---|---|---|
| Backend | Python + FastAPI | 3.12 | API REST, orchestration des audits, analyse IA |
| Frontend | HTML/CSS/JS + Nginx | Alpine | SPA mono-page, proxy inverse vers le backend |
| Base de données | MySQL | 8.0 | Stockage structuré : audits, findings, crédits, alertes |
| Authentification | Keycloak (OIDC) | 24.0 | Identity Provider, SSO, JWT RS256 |
| Object Storage | MinIO (S3-compatible) | Latest | Rapports JSON et PDF |
| IA | Anthropic Claude / Mistral | Sonnet 4 / Large 25.12 | Résumé exécutif, plan d'action, conformité |
| Paiement | Stripe | API v2024 | Checkout, webhooks, portail de facturation |
| Conteneurisation | Docker Compose | v2 | Orchestration de 10 services |
Infrastructure & Réseau
Matrice de flux
Chaque flux est identifié sur le schéma ci-dessus par un badge coloré (F01–F14).
| ID | Source | Destination | Protocole | Authentification | Description |
|---|---|---|---|---|---|
F01 | Utilisateur (Internet) | Frontend Nginx | HTTPS / TCP 8000 | , | Accès à l'application web (SPA) |
F02 | Utilisateur (Internet) | Ranking | HTTPS / TCP 8001 | , | Accès au ranking public mondial |
F03 | Utilisateur (Internet) | Website Nginx | HTTPS / TCP 8002 | , | Site vitrine et documentation |
F04 | Frontend Nginx | Backend FastAPI | HTTP / TCP 8000 | JWT Bearer (RS256) | Reverse proxy , toutes les requêtes /api/* |
F05 | Backend FastAPI | Keycloak | HTTP / TCP 8080 | Client Secret (OIDC) | Validation JWT, token exchange, introspection JWKS |
F06 | Backend FastAPI | MySQL | TCP 3306 | Login / Password | Requêtes SQL paramétrées (16 tables, pool connexions) |
F07 | Backend FastAPI | MinIO (S3) | HTTP / TCP 9000 | Access Key / Secret Key | Stockage et récupération des rapports JSON et PDF |
F08 | Backend FastAPI | APIs Cloud (AWS, GCP, Azure, Scaleway, Outscale) | HTTPS 443 | Credentials utilisateur (Access Key, Service Account, OAuth2, Role ARN) | Collecte des données cloud et exécution Auto-Fix |
F09 | Backend FastAPI | Anthropic / Mistral API | HTTPS 443 | API Key | Analyse IA : résumé exécutif, plan d'action, conformité, effort |
F10 | Backend FastAPI | Stripe API | HTTPS 443 | API Key (Stripe Secret) | Création de sessions de paiement, portail de facturation |
F11 | Stripe | Backend FastAPI | HTTPS 443 (entrant) | Webhook Signature (HMAC) | Notifications de paiement , validation Stripe-Signature |
F12 | Backend FastAPI | Serveur SMTP | TCP 587 (STARTTLS) | Login / Password | Envoi d'emails : reset mot de passe, tickets support, notifications |
F13 | Keycloak | PostgreSQL (Keycloak-DB) | TCP 5432 | Login / Password | Persistance des realms, utilisateurs, sessions OIDC |
F14 | SonarQube | PostgreSQL (SonarQube-DB) | TCP 5432 | Login / Password | Stockage des analyses de qualité de code |
Réseaux Docker isolés
| Réseau | Services | Accès |
|---|---|---|
net-frontend | Frontend, Backend, Ranking | Exposé (:8000, :8001) |
net-backend | Backend, MySQL, MinIO | Interne uniquement |
net-keycloak | Backend, Keycloak, Keycloak-DB | Interne + :8080 |
net-sonar | SonarQube, SonarQube-DB, Scanner | Interne + :9001 |
net-website | Website | Exposé (:8002) |
Le backend est le seul service présent sur 3 réseaux (net-frontend, net-backend, net-keycloak), servant de pont entre le frontend et les services internes.
Règles de filtrage
| Sens | Flux autorisés | Flux bloqués |
|---|---|---|
| Entrant | F01 (8000), F02 (8001), F03 (8002), Keycloak (8080), F11 (webhook Stripe) | Tout autre port , MySQL, MinIO, PostgreSQL inaccessibles depuis Internet |
| Inter-services | Uniquement entre services du même réseau Docker , le Backend est le seul pont (3 réseaux) | Frontend ↛ MySQL, Website ↛ Backend, Ranking ↛ Keycloak |
| Sortant | F08–F10, F12 (SMTP) , uniquement depuis le Backend | Frontend, Ranking, Website n'effectuent aucun appel sortant |
Architecture backend (Controller / Service / DAO)
Endpoints par domaine
| Domaine | Endpoints | Détail |
|---|---|---|
| Authentification & Profil | 14 | Login OIDC, register, refresh, logout, forgot-password, profil, export RGPD, suppression |
| Audit | 7 | Start, status polling, result, report PDF, historique, suppression |
| Admin utilisateurs | 4 | CRUD utilisateurs (admin only) |
| Entreprises | 7 | CRUD + assignation utilisateur |
| Crédits & Stripe | 10 | Solde, transfer, packs, checkout, webhook, portail facturation |
| Alertes | 5 | Liste, compteur, marquer lu, configuration seuils |
| Auto-Fix | 4 | Disponibilité, preview (dry-run), exécution, historique |
| Posture & Drift | 3 | Historique de posture, scopes, comparaison de drift |
| Scheduled | 7 | Credentials chiffrés, planification CRUD, toggle |
| Référentiels | 7 | Catalogue de contrôles, topics, mappings CIS/ANSSI |
| Dashboard & Ranking | 7 | Top findings, benchmark, ranking public (k-anonymity) |
| Assets & Attack Paths | 3 | Inventaire, chemins d'attaque MITRE ATT&CK, threat model IA narratif |
| SLA & Monitoring | 4 | SLA remédiation, MTTR, stats admin, logs |
| Autres | 3 | Health, release notes, support |
Schéma de données (MySQL)
| Table | Colonnes clés | Rôle |
|---|---|---|
audit_jobs | job_id (PK), audit_name, provider, score, level, findings_count, created_by, status, report_s3_key, pdf_s3_key | Enregistrement principal de chaque audit |
audit_findings | job_id (FK), service, check_name, severity, detail, remediation, finding_hash (SHA256, UNIQUE) | Findings avec déduplication par hash |
user_credits | user_id (UNIQUE), credits, updated_at | Solde de crédits par utilisateur |
credit_transactions | user_id, delta, reason, note, created_at | Historique de toutes les opérations crédits |
companies | name (UNIQUE), sector, size, country | Référentiel des entreprises |
user_company | user_id (UNIQUE), company_id (FK) | Association utilisateur ↔ entreprise |
audit_alerts | user_id, job_id (FK), alert_type, message, severity, seen | Alertes de drift et régressions |
alert_config | user_id (UNIQUE), score_drop_threshold, notify_new_critical/high, enabled | Préférences d'alerte |
autofix_actions | job_id, finding_hash, check_name, provider, tier, status, before_state, after_state | Historique des remédiations auto |
audit_credentials | username, name, provider, encrypted_data (AES-256) | Credentials cloud chiffrés |
scheduled_audits | credential_id (FK), schedule_type, schedule_day/hour, enabled, next_run_at | Planification d'audits récurrents |
controls_config | provider, domain_key, check_id, enabled | Activation/désactivation de contrôles |
activity_log | username, action, category, target, detail, ip | Journal d'audit RGPD (rétention 365j) |
audit_usage | job_id (UNIQUE), username, provider | Tracking de consommation |
ranking_snapshots | job_id, provider, sector, score, severity counts | Données anonymisées pour le ranking public |
cgu_acceptances | username, cgu_version, accepted_at, ip | Acceptation des CGU |
Index optimisés , Indexes composites sur audit_jobs(created_by, status, created_at), index sur finding_hash pour la déduplication et le drift, index sur ranking_snapshots(is_demo, provider, sector) pour le benchmark.
Migrations automatiques , Appliquées au démarrage : ajout de colonnes, backfill de données, création d'index manquants.
Collecteurs & Couverture de sécurité
| Provider | Contrôles | Domaines couverts | SDK |
|---|---|---|---|
| AWS | 506 | IAM, S3, EC2, VPC, RDS, KMS, Lambda, ELB, CloudTrail, GuardDuty, EKS, WAF, CloudFront, DynamoDB, Route 53, Redshift, Glue, Athena, MSK, Organizations, FinOps, RGPD... (51 domaines) | boto3 |
| GCP | 419 | Compute, GKE, Cloud Run, Cloud SQL, AlloyDB, BigQuery, Cloud Storage, IAM, Cloud Armor, Cloud KMS, Secret Manager, Filestore, Cloud NAT, FinOps, RGPD... (38 domaines) | google-cloud-* |
| Azure | 524 | VMs, AKS, App Service, SQL Database, Cosmos DB, Blob Storage, Entra ID, Key Vault, Defender, Front Door, Firewall, Redis, Event Hubs, Synapse, FinOps, RGPD... (39 domaines) | azure-mgmt-* |
| Scaleway | 439 | Instances, Kapsule/Kosmos, Serverless, Object Storage, Managed DB (5 moteurs), VPC, Load Balancer, DNS, Edge Services/WAF, Messaging, TEM, Security Groups, Cockpit, FinOps... (36 domaines) | scaleway SDK |
| Outscale | 101 | Instances, Security Groups, OOS, EIM/IAM, LBU, VPC, Snapshots, Direct Links, FinOps, RGPD... (25 domaines) | API REST |
| Web (OWASP) | 89 | OWASP Top 10 (A01-A10), DNS/Email Security, TLS Deep Analysis, Technology Detection, WAF Detection, Sensitive Files... (16 domaines) | requests + BeautifulSoup |
Pipeline d'audit
Enrichissement automatique , Chaque finding est mappé aux référentiels CIS, ANSSI Hygiène, NIST, PCI-DSS et HIPAA par correspondance de mots-clés. L'IA génère un résumé exécutif, un plan d'action priorisé, une estimation d'effort et une analyse de conformité.
Sécurité de la plateforme
Authentification & Autorisation
| Mécanisme | Implémentation |
|---|---|
| Protocole | Keycloak OIDC , Authorization Code Flow avec PKCE |
| Signature JWT | RS256 avec validation JWKS (cache 3600s, rotation automatique) |
| Rôles | admin (accès total), auditor (audits + résultats), demo (lecture seule) |
| Protection CSRF | Validation Origin/Referer, exemption webhooks Stripe |
| Token Refresh | Renouvellement automatique côté client via /api/auth/refresh |
Protection réseau
| Couche | Configuration |
|---|---|
| Rate Limiting (Nginx) | Auth : 10 req/min , Audit start : 5 req/min , API générale : 30 req/s |
| Headers de sécurité | CSP strict, X-Frame-Options SAMEORIGIN, X-Content-Type-Options nosniff, Referrer-Policy, Permissions-Policy |
| Isolation réseau | 5 réseaux Docker isolés , MySQL et MinIO inaccessibles depuis l'extérieur |
| CORS | Origins autorisées configurables via variable d'environnement |
| Proxy timeout | 600s read (audits longs), 10s connect |
Protection des données
| Donnée | Mesure |
|---|---|
| Credentials cloud | Chiffrement AES-256 au repos dans audit_credentials |
| Mots de passe | Gérés par Keycloak (bcrypt, politique de complexité) |
| Paiement | Stripe PCI-DSS niveau 1 , aucune donnée carte stockée |
| Journal d'audit | activity_log avec IP, rétention RGPD configurable (365j par défaut) |
| Ranking public | k-anonymité (MIN_SAMPLE=3), aucune donnée identifiante exposée |
| Logs SIEM | Export JSON structuré pour intégration Wazuh / ELK |
| Droit à l'oubli | Export et suppression de compte via /api/me/export et DELETE /api/me |
Validation des entrées
- Pydantic models , Validation stricte de tous les champs (types, longueurs, formats).
- Protection SSRF , Validation d'URL pour les audits web : blocage des IPs privées, localhost, réseaux internes.
- Validation ARN , Format regex strict pour les AWS Role ARN.
- Requêtes paramétrées , Prévention d'injection SQL dans toute la couche DAO.
Architecture frontend
Application mono-page (SPA) servie par Nginx, sans framework JS. Navigation via showView(name) avec chargement dynamique des vues.
| Couche | Fichiers | Détail |
|---|---|---|
| JavaScript | 17 modules | core, auth, i18n, audit, dashboard, history, posture, results, admin, alerts, autofix, assets, attack-paths, monitoring, scheduled, credits, cookies |
| CSS | 15 feuilles | base, layout, login, dashboard, audit, history, results, posture, admin, credits, support, monitoring, scheduled, attack-paths, cookies |
| Vues HTML | 15 partials | login, dashboard, new-audit, history, results, posture, scheduled, admin (users/companies/controls/monitoring), support, progress, modals |
| i18n | FR / EN | Traduction complète via data-i18n attributes et dictionnaire JS |
Nginx , Proxy inverse & Sécurité
- Proxy , Toutes les requêtes
/api/*sont relayées au backend FastAPI (port interne 8000). - Rate limiting , 3 zones (auth, audit, general) avec burst et nodelay.
- Cache , Assets statiques (CSS, JS, images) : 7 jours, immutable.
- Blocage , Fichiers dotfiles (
.*) retournent 403.
Intégrations externes
| Service | Usage | Configuration |
|---|---|---|
| Anthropic Claude | Analyse IA : résumé exécutif, plan d'action, conformité, estimation effort | ANTHROPIC_API_KEY |
| Mistral | Alternative IA (modèle sélectionnable par audit) | MISTRAL_API_KEY |
| Stripe | Paiement : checkout sessions, webhooks, portail de facturation | STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET |
| AWS | Collecteur (boto3), Auto-Fix (70+ fixes T1+T2) | Access Key / Role ARN / Profil local |
| GCP | Collecteur (google-cloud-*), Auto-Fix (24 fixes) | Service Account JSON / Default Credentials |
| Azure | Collecteur (azure-mgmt-*), Auto-Fix (49 fixes T1+T2) | Tenant ID + Client ID + Client Secret |
| Scaleway | Collecteur (SDK), Auto-Fix (37 fixes T1+T2) | Access Key + Secret Key |
| 3DS Outscale | Collecteur (API REST) | Access Key + Secret Key |
| SMTP | Emails : reset mot de passe, tickets support, notifications | SMTP_HOST, SMTP_USER, SMTP_PASSWORD |
| MinIO (S3) | Stockage objet : rapports JSON, PDF générés | S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY |
Flux fonctionnels principaux
Flux d'audit complet
Flux de drift detection
Flux Auto-Fix
Flux de paiement
Déploiement & Configuration
Variables d'environnement
| Catégorie | Variables |
|---|---|
| Base de données | MYSQL_HOST, MYSQL_PORT, MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD |
| Keycloak | KEYCLOAK_URL, KEYCLOAK_PUBLIC_URL, KEYCLOAK_REALM, KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET |
| IA | ANTHROPIC_API_KEY, MISTRAL_API_KEY |
| Paiement | STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PUBLIC_URL |
| Stockage S3 | S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET |
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_FROM | |
| Sécurité | ALLOWED_ORIGINS, SECURE_COOKIES, RETENTION_ACTIVITY_LOG_DAYS |
Volumes persistants
mysql_data, Données MySQLkeycloak_db_data, Données Keycloak (PostgreSQL)minio_data, Rapports et PDF stockéssonarqube_data, Analyse de qualité de code/reports, Cache local des rapports PDF générés/var/log/auditai, Logs applicatifs + SIEM JSON
Health checks
- Backend ,
GET /api/health(vérification MySQL, Keycloak, MinIO) - MySQL ,
mysqladmin ping - Keycloak , Endpoint OIDC Discovery
- Frontend ,
curl http://localhost:80/