Vulnerability CSV export silently drops some Vulnerability Report filters

Summary

With vulnerability_csv_export_filters enabled (#581520 (closed)), the Vulnerability Report sends its active filters with the CSV export request. The export API only accepts some of them. Grape drops every key that isn't declared, with no error, so for those filters the CSV is a superset of what the report shows. That contradicts what the feature promises (#579107): "the exported file matches the filtered view".

Where it happens

  • Frontend: ee/app/assets/javascripts/security_dashboard/components/shared/csv_export_button.vue posts filters: convertObjectPropsToSnakeCase(filters.value), which is every key in the report's filter store.
  • API: ee/lib/api/vulnerability_exports.rb, params :filters, only declares these: severity, state, report_type, scanner_id, project_id, has_resolution, has_issues, has_merge_request, has_remediations, scanner, image, cluster_agent_id.

Filters that are dropped

These are the ones the report's filter tokens produce that have no matching declared param (from filtered_search/tokens/* and vulnerability_report.vue):

UI filter Key sent Finder param it should map to
Status → dismissal reason dismissal_reason dismissal_reason
Identifier identifier_name identifier_name
OWASP Top 10 (2017 / 2021 / 2025) owasp_top_10* owasp_top_10
Tracked ref tracked_ref_ids security_project_tracked_context_id (name differs)
Validity check validity_check (check finder support)
Reachability reachability (check finder support)
Malware malware (check finder support)
Activity: AI resolution / other AI flags has_ai_resolution, … has_ai_resolution, …

Tracked ref matters most, because the report applies it by default: tracked_ref_token.vue defaultValues falls back to the default branch. So by default, the export includes vulnerabilities from every tracked ref, while the report only shows the default branch.

Proposal

  1. Declare the missing keys in params :filters, with the same coercion as the existing ones, and map tracked_ref_ids to security_project_tracked_context_id.
  2. Check that each of them reaches Security::VulnerabilityReadsFinder through Vulnerabilities::Export#filters, and that the finder supports it at project level.
  3. Add a request spec asserting that every filter key the report can emit is either honoured or explicitly rejected, so the frontend and API can't drift apart silently again.

Impact

It's not a data leak, because the user can already see every row in the CSV. It's a correctness gap: exports can contain more rows than the filtered view, including by default through the tracked-ref default. This should be fixed before the feature is announced or re-added to the release notes (see !258366 (merged)).

Related: #579107, #581520 (closed), #627540, #627590