Commit 433abced authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'exend-security-scanner-type-enum' into 'master'

Exclude license scanner types from SecurityScannerType enum

See merge request gitlab-org/gitlab!37318
parents e5f7847f 2baac9e0
......@@ -14,7 +14,8 @@ module EE
end
def scanners_run_in_last_pipeline
latest_builds_reports(only_successful_builds: true).map { |scanner| scanner.upcase.to_s }.compact
reports = latest_builds_reports(only_successful_builds: true)
all_security_scanners.map { |scanner| scanner.upcase.to_s if reports.include?(scanner) }.compact
end
private
......
---
title: Fix security dashboard by excluding license scanning information
merge_request: 37318
author:
type: fixed
......@@ -45,9 +45,11 @@ RSpec.describe GitlabSchema.types['Project'] do
before do
project.add_developer(user)
create(:ci_build, :sast, pipeline: pipeline, status: 'success')
create(:ci_build, :dast, pipeline: pipeline, status: 'success')
create(:ci_build, :secret_detection, pipeline: pipeline, status: 'pending')
create(:ci_build, :success, :sast, pipeline: pipeline)
create(:ci_build, :success, :dast, pipeline: pipeline)
create(:ci_build, :success, :license_scanning, pipeline: pipeline)
create(:ci_build, :success, :license_management, pipeline: pipeline)
create(:ci_build, :pending, :secret_detection, pipeline: pipeline)
end
it 'returns a list of analyzers enabled for the project' do
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSchema.types['SecurityScannerType'] do
it 'exposes all security scanner types' do
expect(described_class.values.keys).to contain_exactly(*%w[CONTAINER_SCANNING COVERAGE_FUZZING DAST DEPENDENCY_SCANNING SAST SECRET_DETECTION])
end
end
......@@ -7,9 +7,10 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.id, ref: project.default_branch) }
before do
create(:ci_build, :sast, pipeline: pipeline, status: 'success')
create(:ci_build, :dast, pipeline: pipeline, status: 'success')
create(:ci_build, :secret_detection, pipeline: pipeline, status: 'pending')
create(:ci_build, :success, :sast, pipeline: pipeline)
create(:ci_build, :success, :dast, pipeline: pipeline)
create(:ci_build, :success, :license_scanning, pipeline: pipeline)
create(:ci_build, :pending, :secret_detection, pipeline: pipeline)
end
describe '#available_scanners' do
......@@ -34,5 +35,9 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
it 'returns a list of all scanners which were run successfully in the latest pipeline' do
expect(project.scanners_run_in_last_pipeline).to match_array(%w(DAST SAST))
end
it 'does not include non-security scanners' do
expect(project.scanners_run_in_last_pipeline).not_to include(%w(LICENSE_SCANNING))
end
end
end
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