Improve Secure fixtures for local development
Fixtures for development that we have right now don't provide useful data for local development: only SAST vulnerabilities are created and only 20 of them. That leads to the fact that engineers have to set up runner and run CI jobs locally to get the data that they need for their work process. This is not efficient for the next reasons:
- Running jobs takes time
- GDK + Runner can be unstable so people end up fixing their local environment instead of developing new features.
The fact that there are fixtures only for SAST leads to the fact that features such as Dependency list and License Compliance can't be tested. Since only items of Vulnerabilities::Occurrence are created, without reports, it also breaks testing of Project Security Dashboard.
Proposal
- Add fixtures for Dependency Scanning and License Compliance report
- Add fixtures for different security vulnerabilities (with auto-fix solutions, with dependency list) + license compliance findings.
- Add license compliance policies to projects.
Implementation Details
Data for Vulnerability Report page:
- Create a new
ee/db/fixtures/development/number_items.rbfile to create needed development fixtures. - In this file create pipeline with dependency_scanning trait `create(:ee_ci_pipeline, :dependency_scanning)
- Pipeline contains artifacts that needed to be parsed in the same way as it's done in production using
StoreReportService. - Check
Vulnerability Reportand individual vulnerability pages to ensure that data is set up correctly.
Data for Dependency List and License Compliance page
- Create
JobArtifactthat hasdependency_scanningreportcreate(:ee_ci_job_artifact, :dependency_list). Assign it to thedependency_scanningjob in the latest pipeline. - Add to the same pipeline
license_scanningjob and add JobArtifact oflicense_scanningtypecreate(:ee_ci_job_artifact, :license_scanning).
Edited by Tetiana Chupryna