$root, 'config' => $config] = require __DIR__ . '/_bootstrap.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { Http::methodNotAllowed(['POST']); exit; } Security::validateCsrf(); (new RateLimiter($root, $config, RateLimiter::clientIp()))->check('notify'); $maxBody = (int) ($config['max_body_bytes'] ?? 1_048_576); $body = Http::readJsonBody($maxBody > 0 ? $maxBody : null); $email = (string) ($body['email'] ?? ''); $tool = (string) ($body['tool'] ?? ''); $allowedTools = (array) ($config['allowed_notify_tools'] ?? ['process-mapper']); if ($tool === '' || !in_array($tool, $allowedTools, true)) { Http::json(['error' => 'Outil invalide ou non autorisé'], 400); exit; } if ($email === '' || !filter_var($email, FILTER_VALIDATE_EMAIL)) { Http::json(['error' => 'Email invalide'], 400); exit; } (new OutboxStorage($root . '/storage/outbox'))->storeNotify($tool, $email); Http::json(['status' => 'ok']);