Repository navigation
Production hardening: webhook auth, audit trail, atomic approvals y recovery de huérfanos - #54
Merged
Merged
Conversation
…als y recovery Correcciones de la revisión de preparación para producción: - Webhook /api/alerts autenticado con ALERT_WEBHOOK_SECRET (Bearer); Alertmanager envía el secreto vía http_config.authorization - Auditoría human-in-the-loop: execute/reject/postpone registran approved_by - Transiciones atómicas: el claim de awaiting_approval es un UPDATE condicional — elimina la doble ejecución de acciones en paralelo - Deduplicación por fingerprint de Alertmanager con índice único parcial (garantía a nivel de BD, no check-then-insert) - Recovery sweep: incidentes huérfanos por reinicios del backend se marcan failed con nota tras 30 min (startup + cada 15 min) - Fix: runbooks e incidentes similares de K8s/Podman consultaban las colecciones de Docker - CORS configurable por entorno (CORS_ORIGINS / CORS_ORIGIN_REGEX) - Migraciones SQL versionadas en supabase/migrations/ - Tests: validadores de comandos (inyección) y auth del webhook (76 passing) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Correcciones de la revisión de preparación para producción de Sentinel:
Seguridad
/api/alertsautenticado: exigeAuthorization: Bearer <ALERT_WEBHOOK_SECRET>. Sin la env var queda abierto (modo dev) con warning en logs. Alertmanager envía el secreto víahttp_config.authorization.approved_by(email del JWT).awaiting_approvales un UPDATE condicional — dos aprobaciones simultáneas ya no ejecutan el comando dos veces (la segunda recibe 409).Robustez
detected/investigating/executing_solution/verifying>30 min) se marcanfailedcon nota explicativa. Corre al arrancar y cada 15 min.Bugs y configuración
CORS_ORIGINS/CORS_ORIGIN_REGEX(necesario para que el frontend de Render funcione sin hardcodear orígenes).supabase/migrations/(baseline reconstruido + hardening).Tests
;,$(), backticks, pipes, path traversal) y auth del webhook. 76 passing, ruff limpio.Pasos post-merge (manuales)
supabase/migrations/0002_production_hardening.sqlen el SQL Editor de Supabase (soloADD COLUMN IF NOT EXISTS+ índice; seguro sobre datos existentes).CORS_ORIGINS=https://sentinel-softserve-1.onrender.comy unALERT_WEBHOOK_SECRETfuerte.POST /api/alertssin header → 401; con el secreto → 200.