Issue Task Resolved

#110516Improve scoped CSP report cleanup performance

Wouter Wolters 08/21/26, 21:13 updated 09/30/26, 09:30

Description

ReportRepository::removeAll() deletes scoped CSP reports using only the scope column.

The sys_http_report table already provides a composite (type, scope) index, but the current query cannot use it because the report type is omitted. It can also delete records
belonging to another report type when they share the same scope.

Include the repository’s static csp-report type in the delete criteria. This:

- Activates the existing (type, scope) index.
- Avoids full table scans on large report tables.
- Prevents deletion of unrelated report types.

A synthetic SQLite benchmark with 100,000 rows improved predicate lookup from 2.148 ms to 0.021 ms—approximately 100× faster.

A functional test verifies that scoped CSP reports are removed while another report type remains intact.

Reviews 1

History 12

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-30T09:30:10+00:00" > 09/30/26, 09:30 </span>

    Applied in changeset commit:96c373d6e2f36bff36c87b536acb6b272b73ba0a.