Implement export API to project security dashboard

What does this MR do and why?

Implement the PDF export request for the project security dashboard

Issue: #545959 (closed)

Payload Response
image image

This is the data format being sent over:

{
  export_format: 'pdf',
  dashboard_type: 'project',
  full_path: 'secure-ex/security-reports',
  project_vulnerabilities_history: {
    svg: 'data:image ...'
  }
}

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable feature flag: vulnerabilities_pdf_export
  2. Clone this project: https://gitlab.com/gitlab-examples/security/security-reports
  3. Run a successful pipeline
  4. Go to the project security dashboard
  5. You will see the export button and on click it will make the request

The email can take awhile, apply this patch to have it sent immediately:

1 file changed, 1 insertion(+), 1 deletion(-)
ee/app/services/vulnerability_exports/create_service.rb | 2 +-

modified   ee/app/services/vulnerability_exports/create_service.rb
@@ -27,7 +27,7 @@ def execute
         **create_params
       )
 
-      ::VulnerabilityExports::ExportWorker.perform_async(vulnerability_export.id)
+      ::VulnerabilityExports::ExportWorker.perform_inline(vulnerability_export.id)
 
       if vulnerability_export.persisted?
         ServiceResponse.success(payload: { vulnerability_export: vulnerability_export })
  1. Open the dev tool and navigate to the "Network tab"
  2. Click on the export button
  3. From the response, copy the "download" link and open it to download the file
  4. Change the extension to "pdf" and when open you should get some thing like this: secure-ex-security-reports_vulnerabilities_2025-06-16T1434.pdf
  5. Alternatively, access the email here: http://gdk.test:3000/rails/letter_opener/
PDF pg 1 PDF pg 2
image image

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #545958 (closed)

Edited by Samantha Ming

Merge request reports

Loading