Update MR widget to consider sbom based security findings
Why are we doing this work
With the deprecation of Gemnasium, there is a need for displaying sbom-based security findings by the MR Widget.
Relevant links
Non-functional requirements
-
Documentation: -
Feature flag: -
Performance: -
Testing:
Potential solution
Instead of fetching sbom data as in-memory sbom reports (i.e., above solution), sbom related security findings could be be fetched as part of the findings_finder, which implies that Security::Finding would be persisted. Therefore, the ingestion might require changes around store_grouped_scans_service and store_scans_service in order to have sbom report data ingested. Another possible approach is to have the sbom data loaded as security report and reuse the whole of the ingestion flow as is.
This approach aligns with the requirements for both Add support for security findings into pipeline... (#490334 - closed) • Zamir Martins • 17.9 • Needs attention and Add support for merge request approval policy (#490347 - closed) • Oscar Tovar • Backlog. With security findings persisted a new comparison service will be required as it will differ from the existing logic (used by other report types).
Alternative solution based on this POC MR
-
backend Update
MergeRequest#enabled_reportsand add something likenew_cyclonedx_comparison_pathtowindow.gl.mrWidgetDataso the frontend code can consider sending request to-/merge_requests/:id/security_reports?type=cyclonedx. This is going to require addingcyclonedxas part intoULTIMATE_FEATURESandREPORT_LICENSED_FEATURES. -
frontend Update
MergeRequestStore.setPathwith the new path, e.g.new_cyclonedx_comparison_pathand updated the list of endpoints inWidgetSecurityReportsto include the new path in relation toCYCLONEDX. This will initiate the request tosecurity_reportswithtypeset tocyclonedx. -
backend Update
MergeRequestSecurityReportGenerationServiceby addingcyclonedxintoALLOWED_REPORT_TYPESandreports. -
backend Create a new method into
MergeRequestin order to triggercompare_reportsin case there are sbom reports. -
backend Add
create_atintoSbom::Reportso it can be provided by the report artifact inEE::Ci::Build#collect_sbom_reports!. -
backend Update
Security::PipelineVulnerabilitiesFinder#requested_reportsso it can also consider cyclonedx data with findings viaVulnerabilityScanning::SecurityReportBuilder. -
backend Update
VulnerabilityScanning::SecurityReportBuilderso it can traverse the valid sbom reports and return their respective security report with findings. Similar to what has been done forSbom::CreateVulnerabilitiesService.
Note: This alternative solution would only work if there the scope of this epic was only in regards to MR widget. The fact that it includes MR security report and approval rules seems to invalidate this approach.