Skip to content
代码片段 群组 项目
未验证 提交 19c0c802 编辑于 作者: Alan (Maciej) Paruszewski's avatar Alan (Maciej) Paruszewski 提交者: GitLab
浏览文件

Prevent CS SBOM to be parsed as ready for License Scanning rules

Changelog: fixed
EE: true
上级 affa618a
No related branches found
No related tags found
无相关合并请求
......@@ -11,6 +11,7 @@ def fetch
pipeline.sbom_reports.reports.flat_map do |sbom_report|
sbom_report.components.map do |component|
next unless component.purl
next unless supported_for_license_scanning?(component.purl.type)
Hashie::Mash.new(name: component.name, purl_type: component.purl.type,
version: component.version, path: sbom_report.source&.input_file_path)
......@@ -21,6 +22,10 @@ def fetch
private
attr_reader :pipeline
def supported_for_license_scanning?(purl_type)
::Enums::Sbom.dependency_scanning_purl_type?(purl_type)
end
end
end
end
......@@ -10,6 +10,14 @@
context 'when the pipeline has an sbom report' do
let_it_be(:pipeline) { create(:ee_ci_pipeline, :with_cyclonedx_report, project: project) }
context 'and sbom components are not supported by license scanning' do
let_it_be(:pipeline) { create(:ee_ci_pipeline, :with_cyclonedx_container_scanning, project: project) }
it 'returns an empty list' do
expect(fetch).to be_empty
end
end
context 'and some of the sbom components do not have purl values' do
it 'returns a list with the expected size' do
expected_number_of_components = pipeline.sbom_reports.reports.sum do |report|
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册