Commit 4d180e42 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Prevent augmenting for orphan dependencies

parent f8aeff16
......@@ -51,7 +51,7 @@ module Gitlab
def augment_ancestors!
@dependencies.each_value do |dep|
next unless dep.iid
next unless dep.location[:ancestors]
next if dep.location[:top_level]
if dep.vulnerabilities.empty?
......
......@@ -44,6 +44,19 @@ RSpec.describe Gitlab::Ci::Reports::DependencyList::Report do
expect(ancestors.last).to eq({ name: direct[:name], version: direct[:version] })
end
context 'when dependency path info is not full' do
let(:orphan_dependency) { build :dependency, :with_vulnerabilities, iid: 3 }
before do
report.add_dependency(orphan_dependency)
end
it 'returns array of hashes' do
expect(dependencies).to be_an(Array)
expect(dependencies.first).to be_a(Hash)
end
end
context 'with multiple dependency files matching same package manager' do
let(:indirect_other) { build :dependency, :with_vulnerabilities, iid: 32 }
let(:direct_other) { build :dependency, :direct, :with_vulnerabilities }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment