ealmeida
17e5736a0a
feat(observabilidade): setup dependências e tipos SessionMeta/SessionEvent
...
- Instala better-sqlite3 + chokidar + @types/better-sqlite3
- Upgrade googleapis 144 → 171 (resolve 4 vulns moderate em uuid/gaxios)
- Cria api/types/session.ts (SessionMeta, SessionEvent, ParseResult, SessionOutcome)
- Cria SPEC.md raiz com marker APPROVED a referenciar SPEC autoritativo no Hub
- Task 1 de 10 do plano Observabilidade (Espelho)
- Desk #2059 , Projecto #65
Security Audit (Regra #47 ):
- npm audit --audit-level=moderate: 0 vulnerabilities
- Calendar API continua operacional (google.calendar v3 inalterada)
2026-04-23 00:38:34 +01:00
ealmeida
12f688ff7c
feat: adicionar 5 novos painéis ao dashboard (MCPs, n8n, Paperclip, IA, Operações)
...
Expansão do dashboard de 3 para 8 páginas com dados reais do stack:
- MCPs: monitorização de 33 MCPs no gateway com ping e estado online/offline
- n8n: 14 workflows com último run, duração e falhas 24h
- Paperclip: 16 agentes operacionais, routines e issues (PostgreSQL)
- IA/Claude: visão das 3 camadas (189 skills, 72 agents, 39 MCPs, CARL)
- Operações: tickets Desk CRM por departamento + cobertura PROCs
16 ficheiros novos (3042 linhas), 3 existentes editados.
Nova dependência: pg (PostgreSQL client para Paperclip).
Audit: 0 vulnerabilidades (npm audit fix aplicado).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-06 20:58:48 +01:00
ealmeida
ca73a9ddbd
test: validate gitea webhook to easypanel auto-deploy
...
chore: npm audit fix (ajv, express-rate-limit, minimatch, rollup)
2026-03-12 14:46:45 +00:00
ealmeida
3283d338ce
quality: improve README and add testing infrastructure (Fase 4 partial)
...
LOW-SEVERITY FIXES:
1. README Genérico (Vulnerabilidade 4.4) ✅
2. Ausência de Testes (Vulnerabilidade 4.3) ✅
3. Logs Verbosos em Produção (Vulnerabilidade 4.5) ✅
FILES: README.md, package.json, vitest.config.ts, src/test/*
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 04:26:27 +00:00
ealmeida
f1756829af
security: implement 6 high-severity vulnerability fixes
...
HIGH-SEVERITY FIXES (Fase 2):
1. Rate Limiting (Vulnerabilidade 2.1)
- express-rate-limit: 100 req/15min (prod), 1000 req/15min (dev)
- Applied to all /api/* routes
- Standard headers for retry-after
2. CORS Restrictions (Vulnerabilidade 2.2)
- Whitelist: dashboard.descomplicar.pt, desk.descomplicar.pt
- Localhost only in development
- CORS blocking logs
3. Input Validation with Zod (Vulnerabilidade 2.4)
- Generic validateRequest() middleware
- Schemas: WordPress Monitor, server metrics, dashboard, financial
- Applied to api/routes/wp-monitor.ts POST endpoint
- Detailed field-level error messages
4. Backend Authentication OIDC (Vulnerabilidade 2.5 - OPTIONAL)
- Enabled via OIDC_ENABLED=true
- Bearer token validation on all APIs
- Backward compatible (disabled by default)
5. SSH Key-Based Auth Migration (Vulnerabilidade 2.6)
- Script: /media/ealmeida/Dados/Dev/ClaudeDev/migrate-ssh-keys.sh
- Generates ed25519 key, copies to 6 servers
- Instructions to remove passwords from .env
- .env.example updated with SSH_PRIVATE_KEY_PATH
6. Improved Error Handling (Vulnerabilidade 2.5)
- Unique error IDs (UUID) for tracking
- Structured JSON logs in production
- Stack traces blocked in production
- Generic messages to client
FILES CHANGED:
- api/server.ts - Complete refactor with all security improvements
- api/middleware/validation.ts - NEW: Zod middleware and schemas
- api/routes/wp-monitor.ts - Added Zod validation on POST
- .env.example - Complete security documentation
- CHANGELOG.md - Full documentation of 9 fixes (3 critical + 6 high)
- package.json + package-lock.json - New dependencies
DEPENDENCIES ADDED:
- express-rate-limit@7.x
- zod@3.x
- express-openid-connect@2.x
AUDIT STATUS:
- npm audit: 0 vulnerabilities
- Hook Regra #47 : PASSED
PROGRESS:
- Phase 1 (Critical): 3/3 ✅ COMPLETE
- Phase 2 (High): 6/6 ✅ COMPLETE
- Phase 3 (Medium): 0/6 - Next
- Phase 4 (Low): 0/5 - Next
Related: AUDIT-REPORT.md vulnerabilities 2.1, 2.2, 2.4, 2.5, 2.6
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 04:09:50 +00:00
ealmeida
20c16ab1e0
security: fix 3 critical vulnerabilities + dependency audit
...
CRITICAL FIXES:
- Remove hardcoded DB password from api/db.ts (was: 9qPRdCGGqM4o)
- Remove hardcoded API key from api/routes/wp-monitor.ts
- Add mandatory env var validation for DB_USER, DB_PASS, DB_NAME
- Add mandatory env var validation for WP_MONITOR_API_KEY
- Add connection timeouts to MySQL pool (10s/15s/30s)
VERIFIED:
- .env never committed to Git (credentials not exposed in repo)
- .gitignore working correctly
DEPENDENCIES:
- Fix qs vulnerability (GHSA-w7fw-mjwx-w883)
- npm audit: 1 low → 0 vulnerabilities
Related: AUDIT-REPORT.md vulnerabilities 1.1, 1.2, 1.3
Next: Implement rate limiting, CORS restrictions, input validation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-14 03:38:09 +00:00
ealmeida
10fc8f5ccc
feat: add SSH metrics collection with ssh2 library and auto-scheduler
...
Replace sshpass with ssh2 Node.js library for reliable SSH connections.
Add all 6 servers (CWP, EasyPanel, MCP Hub, Meet, WhatsApp, WhatSMS).
Add 5-minute auto-collection scheduler in production mode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-07 22:14:22 +00:00
ealmeida
853b2f526e
fix: API funcionando com dados reais + dotenv config
...
- Adiciona dotenv para carregar variáveis de ambiente
- Configura DB_HOST para servidor remoto (176.9.3.158)
- Cria endpoint /api/diagnostic para testes
- Actualiza título: "Plan EAL" → "Dashboard Descomplicar"
- Adiciona tsconfig.json para pasta /api
- Fix: Carrega .env antes de inicializar MySQL pool
Tarefa: #1556
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-04 03:46:34 +00:00
ealmeida
7aae4f3c52
feat: adicionar página de Monitorização
...
- React Router para SPA routing
- Página /monitor com status de sistemas
- Cards de servidores, serviços, sites, containers
- Barras de progresso animadas
- Auto-refresh de 60s
- Link no header do dashboard
DeskCRM Task: #1604
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-03 14:17:02 +00:00
ealmeida
4fe8db23ed
Initial commit: Plan EAL v3 Dashboard
...
- React 19 + Vite 7 + TypeScript
- Tailwind CSS 4 com glassmorphism
- Framer Motion animações
- Bento Grid layout
- Sparkline charts SVG
- Progress ring animado
DeskCRM Task: #1604
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-02-03 13:46:57 +00:00