feat: LLM response validation with defaults, security headers middleware, cleaner stats endpoint
This commit is contained in:
@@ -136,15 +136,16 @@ async def export_scans_csv(
|
||||
@router.get("/stats", response_model=StatsResponse)
|
||||
async def scan_stats(session: AsyncSession = Depends(get_session)) -> dict:
|
||||
dashboard = await get_dashboard_stats(session)
|
||||
latest = dashboard["latest_flagged"]
|
||||
return {
|
||||
"total_scans": dashboard["total_scans"],
|
||||
"flagged_scans": dashboard["flagged_scans"],
|
||||
"recent_flagged": dashboard["recent_flagged"],
|
||||
"total_findings": dashboard["total_findings"],
|
||||
"top_rules": dashboard["top_rules"],
|
||||
"latest_scan_at": dashboard["latest_flagged"][0].started_at.isoformat()
|
||||
if dashboard["latest_flagged"] and dashboard["latest_flagged"][0].started_at
|
||||
else None,
|
||||
"latest_scan_at": (
|
||||
latest[0].started_at.isoformat() if latest and latest[0].started_at else None
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user