(connection: sqlite3.Connection, args: argparse.Namespace)
| 3027 | |
| 3028 | |
| 3029 | def list_findings(connection: sqlite3.Connection, args: argparse.Namespace) -> dict[str, Any]: |
| 3030 | scan = require_scan(connection, args.scan_id) |
| 3031 | backfill_legacy_finding_details(connection, scan) |
| 3032 | limit = min(args.limit, FINDINGS_PAGE_MAX) |
| 3033 | rows = finding_occurrence_rows(connection, scan["id"], offset=args.offset, limit=limit) |
| 3034 | total = connection.execute( |
| 3035 | "SELECT COUNT(*) FROM finding_occurrences WHERE scan_id = ?", (scan["id"],) |
| 3036 | ).fetchone()[0] |
| 3037 | next_offset = args.offset + len(rows) |
| 3038 | return { |
| 3039 | "findingsPage": { |
| 3040 | "findings": [finding_result(connection, scan, row) for row in rows], |
| 3041 | "limit": limit, |
| 3042 | "nextOffset": next_offset if next_offset < total else None, |
| 3043 | "offset": args.offset, |
| 3044 | "scanId": scan["id"], |
| 3045 | "total": total, |
| 3046 | } |
| 3047 | } |
| 3048 | |
| 3049 | |
| 3050 | def scan_result( |
no test coverage detected