8f30b1c1ec427169e7aa2eafadf94d6d07fc9349
Cierra autenticación en /api/deployer, POST /api/modules, /api/stats y /verify (assertIT + validación de slugs/nombres). GET /api/modules público sanitizado (solo visibles, sin repoUrl ni logs). Corrige estado unhealthy, XSS en plantillas, open redirect en login. Sesión HMAC en tiempo constante, secret obligatorio, 503 si el backend cae, cookie secure solo en prod. Migra middleware a proxy, rate-limit en login, vitest + typecheck, Tailwind/CDN fuera, Boxicons local, polling pausado y código muerto eliminado. Estandariza pnpm (lock, Dockerfile, packageManager).
SAM Portal (Portal IT)
Índice de aplicaciones SAM + portal de gestión IT. Next.js 16 + Bootstrap 5 + Boxicons.
- Índice público: https://sam.devops.norteamericano.cl (aplicaciones integradas por sección)
- Portal IT (login): https://it.sam.devops.norteamericano.cl (tablero, gestión y tableros por módulo)
Rutas
| Ruta | Auth | Descripción |
|---|---|---|
/ |
no | Índice: módulos visibles por sección |
/login |
no | Ingreso IT (estilo legacy, USUARIO=idUsuario + CLAVE) |
/tablero |
sí | Tablero IT: estado global, carga por app (docker stats), servicios base |
/m/:name |
sí | Tablero del módulo (Portal IT redirige al tablero) |
/upload |
sí | Integrar módulo (categoría, tipo, visibilidad) |
/actualizar |
sí | Redeploy + webhook + toggle visibilidad |
/eliminar |
sí | Baja de módulos (con/sin código) |
/correo |
sí | Claves de correo por módulo (POST /api/email/modules, banco mail.*) |
/correo/plantillas |
sí | Plantillas del banco mail.templates (listar, crear, editar, activar) |
/api/modules, /api/stats |
no/sí | Proxy al deployer (token server-side) |
/api/deployer/* |
sí | Proxy genérico al deployer |
/api/auth, /api/me |
— | Sesión HMAC 12h en cookie httpOnly |
Auth IT
Login contra el backend (POST /api/Auth/it-login, tabla sige_sam_v3.usuario,
clave en texto plano o SHA256) + allowlist IT_USERS (solo esos correos entran).
# Env del contenedor (las inyecta el deployer al registrar)
DEPLOYER_URL=http://sam-deployer:3010
DEPLOYER_TOKEN=<token>
NEXT_PUBLIC_API_URL=https://api.devops.norteamericano.cl
IT_USERS=cgaray@norteamericano.cl,fmena@norteamericano.cl,jallende@norteamericano.cl
IT_SESSION_SECRET=<openssl rand -hex 24>
# Cuenta de servicio helpdesk (usuario sige real con rol admin) para
# administrar claves de correo desde /correo (solo servidor):
HELPDESK_SERVICE_USER=<idUsuario>
HELPDESK_SERVICE_PASS=<clave>
# SAM_API_URL=https://api.devops.norteamericano.cl # default prod
Desarrollo
npm install
npm run dev # http://localhost:3000
npm run lint && npm run build
El deploy a producción (.4) es vía push a main del repo + rebuild del
contenedor (portal-frontend). El módulo está registrado en el deployer
(categoría sam, subdominio sam); sus pushes ya no autodespliegan solos
(ver deployer state.json en .4).
Languages
TypeScript
94.6%
CSS
4.7%
JavaScript
0.4%
Dockerfile
0.3%