import { MarkerType } from "@xyflow/react"; import type { ZTNodeData, ZTScenarioDefinition } from "../types"; const node = ( id: string, x: number, y: number, data: ZTNodeData, ): Node => ({ id, type: "ztNode", position: { x, y }, data, }); const edgeOk = ( id: string, source: string, target: string, label: string, ): Edge => ({ id, source, target, label, animated: true, markerEnd: { type: MarkerType.ArrowClosed, width: 18, height: 18 }, style: { stroke: "#0d9488" }, labelStyle: { fill: "#134e4a", fontWeight: 500, fontSize: 11 }, labelBgStyle: { fill: "#ecfdf5", fillOpacity: 0.95 }, }); const edgeBlocked = ( id: string, source: string, target: string, label: string, ): Edge => ({ id, source, target, label, animated: false, markerEnd: { type: MarkerType.ArrowClosed, width: 18, height: 18, color: "#dc2626" }, style: { stroke: "#dc2626", strokeDasharray: "6 4" }, labelStyle: { fill: "#991b1b", fontWeight: 600, fontSize: 11 }, labelBgStyle: { fill: "#fef2f2", fillOpacity: 0.95 }, }); export const eastWestScenario: ZTScenarioDefinition = { id: "east-west", title: "Micro-segmentation east-west", subtitle: "Contrôler les flux latéraux entre charges", intro: "Sans segmentation, un compromis sur un service peut se propager. Les politiques réseau et applicatives limitent qui peut parler à qui, avec observabilité centralisée.", nodes: [ node("svc-a", 80, 200, { kind: "workload", label: "Service A", role: "Microservice", }), node("svc-b", 480, 200, { kind: "workload", label: "Service B", role: "Microservice", }), node("seg", 280, 200, { kind: "gateway", label: "Segmentation / politique", role: "Contrôle réseau", }), node("siem", 280, 40, { kind: "monitoring", label: "SIEM / observabilité", role: "Journalisation", }), ], edges: [ edgeOk("e-a-s", "svc-a", "seg", "Flux autorisé et inspecté"), edgeOk("e-s-b", "seg", "svc-b", "Suite si politique OK"), edgeBlocked("e-a-b", "svc-a", "svc-b", "Direct — refusé"), edgeOk("e-a-m", "svc-a", "siem", "Événements"), edgeOk("e-b-m", "svc-b", "siem", "Événements"), ], steps: [ { id: "ew1", title: "Flux latéraux contrôlés", description: "Le chemin autorisé passe par la couche de segmentation (pare-feu distribué, service mesh, politiques cloud).", highlightNodes: ["svc-a", "seg", "svc-b"], highlightEdges: ["e-a-s", "e-s-b"], pillars: ["network", "application"], practices: [ "Définir des groupes de charges et des règles explicites (allow-list), pas un « tout ouvert » en interne.", "Réviser régulièrement les règles avec les propriétaires métier.", ], }, { id: "ew2", title: "Blocage du raccourci", description: "Une tentative de communication directe entre services sans passer par la politique est refusée et visible.", highlightNodes: ["svc-a", "svc-b"], highlightEdges: ["e-a-b"], pillars: ["network", "data"], practices: [ "Supposer la compromission : limiter le blast radius par défaut.", "Tester les règles (red team / tests de fuite) pour valider la segmentation.", ], }, { id: "ew3", title: "Visibilité et corrélation", description: "Les journaux remontent vers une couche d’observabilité pour corréler identités, flux et alertes.", highlightNodes: ["svc-a", "svc-b", "siem"], highlightEdges: ["e-a-m", "e-b-m"], pillars: ["network", "application"], practices: [ "Never trust, always verify : la supervision continue valide que les politiques sont effectivement appliquées.", "Alertes sur les flux non conformes ou les nouvelles dépendances applicatives.", ], }, ], };