debian-mirror-gitlab/lib/gitlab/security/scan_configuration.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.1 KiB
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
module Gitlab
module Security
class ScanConfiguration
include ::Gitlab::Utils::StrongMemoize
include Gitlab::Routing.url_helpers
attr_reader :type
def initialize(project:, type:, configured: false)
@project = project
@type = type
@configured = configured
end
def available?
# SAST and Secret Detection are always available, but this isn't
# reflected by our license model yet.
# TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/333113
2022-08-13 15:12:31 +05:30
%i[sast sast_iac secret_detection container_scanning].include?(type)
2022-04-04 11:22:00 +05:30
end
def can_enable_by_merge_request?
scans_configurable_in_merge_request.include?(type)
2022-01-26 12:08:38 +05:30
end
def configured?
configured
end
2022-04-04 11:22:00 +05:30
def configuration_path; end
2022-01-26 12:08:38 +05:30
2022-06-21 17:19:12 +05:30
def meta_info_path; end
2022-01-26 12:08:38 +05:30
private
attr_reader :project, :configured
2022-04-04 11:22:00 +05:30
def scans_configurable_in_merge_request
%i[sast sast_iac secret_detection]
2022-01-26 12:08:38 +05:30
end
end
end
end
Gitlab::Security::ScanConfiguration.prepend_mod_with('Gitlab::Security::ScanConfiguration')