- Backend:
* Agregado endpoint /v1/audit/security/incidents con paginación y filtros
* Nuevos schemas SecurityIncidentResponse y SecurityIncidentListResponse
* Fix timezone: datetime.utcnow() → datetime.now(timezone.utc) en 4 ubicaciones
* Detección automática de incidentes: mass deletion, brute force, privilege escalation
- Frontend (Internal):
* Nueva sección de Incidentes de Seguridad con modal de detalles
* Filtros por severidad, estado y tipo de incidente
* Conversión completa a esquema grayscale (gray-100 a gray-900)
* Eliminados todos los emojis de páginas audit y security
* Implementada paginación para incidentes
- Fixes:
* Resuelto error 500: TypeError con datetimes timezone-aware/naive
* Resuelto error 404: endpoint de incidentes faltante
CARACTERÍSTICAS PRINCIPALES v1.6.0:
- Sistema de auditoría multi-tenant completo
- Análisis de seguridad con detección de amenazas en tiempo real
- Panel de seguridad con 4 algoritmos de detección:
* Ataques de fuerza bruta
* Escalada de privilegios
* Eliminaciones masivas
* Cuentas comprometidas
- Acciones de seguridad: bloquear IP, resetear contraseña, notificar admin
- Cross-tenant viewing para ADMIN/SUPPORT_MANAGER
- Frontend completamente funcional con nuevo menú Seguridad
- Sistema completamente verificado y operativo
Resolución de conflictos:
- Versiones actualizadas a 1.6.0 en todos los package.json y pyproject.toml
- Menú de seguridad integrado en Sidebar
- Tickets endpoint actualizado con auditoría
- Correcciones de middleware y queries SQL aplicadas
- backend/app/core/config.py: Add APP_VERSION = '1.6.0' setting
- backend/app/main.py: Update health and root endpoints to show APP_VERSION
- frontend-internal/Sidebar.svelte: Add version display in sidebar footer
- frontend-client/+layout.svelte: Add version in page footer
- All endpoints now return both app_version (1.6.0) and api_version (v1)
Features:
- ✅ Cross-tenant audit log viewing for ADMIN/SUPPORT_MANAGER
- ✅ New 'all_tenants' parameter in audit endpoints
- ✅ Frontend toggle to view all clients' logs
- ✅ Multi-tenant stats support in /audit/stats
- ✅ Fixed timezone issue with date filters (UTC consistency)
- ✅ Fixed date_to filter overlap causing duplicate records
Changes:
- backend/app/api/v1/endpoints/audit.py:
* Added tenant_id and all_tenants query parameters
* Permission checks for cross-tenant viewing
* Dynamic tenant filtering based on user role
* Fixed date_to filter (removed +1 day overlap)
* Updated all stats queries for multi-tenant support
- frontend-internal/src/routes/audit/+page.svelte:
* Import auth store for role detection
* Added 'Ver todos los clientes' toggle for admins
* Pass all_tenants parameter to API calls
* UI badge indicating multi-tenant mode
- Version bump: 1.5.1.2 → 1.6.0 across all packages
- Agregado módulo de auditoría con AuditLog model
- Implementado endpoint /api/v1/audit para consulta de logs
- Integrado audit_service para registro automático de acciones
- Agregado token_service para gestión de refresh tokens
- Frontend: Vista de auditoría en panel interno
- Actualizada versión en pyproject.toml y package.json
- Sistema de auditoría completamente funcional y testeado
🔒 Seguridad:
- Implementación completa de RBAC (Role-Based Access Control)
- Staff interno (ADMIN/AGENT/SUPPORT_MANAGER) accede a todos los tickets del tenant
- Clientes (CLIENT_USER/CLIENT_ADMIN) solo acceden a sus propios tickets
- Restricción de creación/modificación de categories/systems a ADMIN/SUPPORT_MANAGER
- Agregado header X-Tenant-ID en frontend-internal para multi-tenancy
🐛 Correcciones:
- Fix crítico: Prevención de números de ticket duplicados
- Implementado retry logic con 3 intentos en creación de tickets
- Generación de ticket_number basada en MAX existente (no contador simple)
- Corrección de filtros en GET /tickets según roles
✨ Mejoras:
- Validación robusta de permisos en todos los endpoints
- Mejor manejo de excepciones y mensajes de error
- Multi-tenancy reforzado con validaciones adicionales
📚 Documentación:
- Agregado CHANGELOG.md con historial de versiones
- Actualizada versión a 1.5.1 en package.json y pyproject.toml
- Scripts de prueba para validación de RBAC
✨ New Features:
• Added admin filter by client/organization in internal frontend
• Enhanced attachments viewer with toggle button in client frontend
• Added attachment counter and improved UX in ticket conversation
🔧 Backend Improvements:
• New `/tickets/admin/all` endpoint for administrators
• Advanced filtering by tenant, status, and priority
• Rich response data with tenant and user information
• Proper admin permissions validation
🎨 Frontend Enhancements:
• Client filter dropdown in admin panel
• Enhanced ticket table with client/organization info
• Collapsible attachments section with visual indicator
• Improved API parameter handling (fixed undefined filters)
• Better responsive design and hover effects
🐛 Bug Fixes:
• Fixed undefined URL parameters in API calls
• Corrected parameter filtering in API utility
• Improved error handling for admin endpoints
📱 UI/UX:
• Added visual badges for attachment count
• Enhanced table columns with client/creator information
• Improved button styling and interaction feedback
• Better organization of ticket conversation layout
- Fixed TypeScript errors in tickets.ts (FastAPIValidationError interface)
- Corrected SQLAlchemy imports with TYPE_CHECKING pattern in models
- Created missing tsconfig.json files for both frontends
- Enhanced .env configuration with additional security settings
- Completed /auth/me endpoint implementation with database queries
- Fixed Alembic migrations issue (a7f9c8d2e4b1 → 13362e8c493a)
- Set up basic testing framework with pytest
- Resolved configuration issues in Pydantic Settings
- Cleaned up duplicate migrations structure
- Format improvements in tsconfig.json files
✅ All services healthy, tests passing (9/10), migrations working
- Added pytest configuration and test suite
- Added TypeScript configuration for both frontend apps
- Removed duplicate migration files from backend/backend/migrations/
- Enhanced project structure for better testing and development"
- Fixed proxy configuration in vite.config.js (servicemanager-backend -> backend)
- Added X-Tenant-ID header to client-profile API calls
- Improved error handling with proper authentication checks
- Updated profile page UI to white theme (removed icons and colors)
- Changed all btn-primary buttons to white theme styling
- Enhanced API call error handling in tickets store