Remove empty objects from remediations array
Summary
Remove empty objects from remediations array
The container scanning report is returning remediations":[{},{},{},{},{},{}] and failing to parse with the error [Schema] property '/remediations/0' is missing required keys: fixes, summary, diff
It appears to be generating five different empty arrays.
The error was introduced as part of #390188 (closed) In the scenario when git is not available in the working directory, the remediation was returned empty.
Steps to reproduce
Can be reproduced by disabling git for the repo.
Ticket Id
Configuration used
Customer is running the Container Scanning job on GitLab Runner 5.9.1 on Gitlab.com They appear to be using our templates and I don't see any configuration that would result in empty elements.
Architecture
Gitlab.com
Current behaviour
Report is as attached: gl-container-scanning-report_5___2_.json
Expected behaviour
Remediations data is present?
Versions
Platforms
N/A
Relevant logs
Pipeline with Debug enabled: 4115242109 Job log from above link: job.log
Customer Impact
The container scanning feature is not useful if it does not report on remdiations.
Implementation Plan
- Add check for
inside git working treein collection. - Add test cases for the same.
Draft changes: gitlab-org/security-products/analyzers/container-scanning@547b3a1a
