Fix: Correcciones en análisis de seguridad y middleware tenant

- Corregido query SQL para detección de escalada de privilegios (JSONB operator)
- Añadidas rutas de autenticación faltantes al middleware tenant
- Sistema completamente verificado y funcional v1.6.0
This commit is contained in:
2026-02-16 10:59:08 -07:00
parent 6af80f1960
commit caeac3e96c
2 changed files with 9 additions and 2 deletions

View File

@@ -491,7 +491,7 @@ async def get_security_analysis(
AuditLog.tenant_id == current_tenant.id, AuditLog.tenant_id == current_tenant.id,
AuditLog.action == 'user.update', AuditLog.action == 'user.update',
AuditLog.created_at >= analysis_start, AuditLog.created_at >= analysis_start,
AuditLog.new_values.contains('"role"') AuditLog.new_values.op('?')('role')
) )
).group_by(User.email).having(func.count(AuditLog.id) >= 3) ).group_by(User.email).having(func.count(AuditLog.id) >= 3)

View File

@@ -24,10 +24,17 @@ class TenantMiddleware(BaseHTTPMiddleware):
EXCLUDED_PATHS = { EXCLUDED_PATHS = {
"/health", "/health",
"/", "/",
"/api/v1/auth/login",
"/v1/auth/login", "/v1/auth/login",
"/docs", "/docs",
"/api/v1/docs",
"/v1/docs",
"/openapi.json", "/openapi.json",
"/redoc" "/api/v1/openapi.json",
"/v1/openapi.json",
"/redoc",
"/api/v1/redoc",
"/v1/redoc"
} }
async def dispatch(self, request: Request, call_next) -> Response: async def dispatch(self, request: Request, call_next) -> Response: