diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /lib/gitlab/ci/reports | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'lib/gitlab/ci/reports')
-rw-r--r-- | lib/gitlab/ci/reports/security/finding.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/ci/reports/security/flag.rb | 34 |
2 files changed, 38 insertions, 1 deletions
diff --git a/lib/gitlab/ci/reports/security/finding.rb b/lib/gitlab/ci/reports/security/finding.rb index dc1c51b3ed0..39531e12f69 100644 --- a/lib/gitlab/ci/reports/security/finding.rb +++ b/lib/gitlab/ci/reports/security/finding.rb @@ -10,6 +10,7 @@ module Gitlab attr_reader :compare_key attr_reader :confidence attr_reader :identifiers + attr_reader :flags attr_reader :links attr_reader :location attr_reader :metadata_version @@ -30,10 +31,11 @@ module Gitlab delegate :file_path, :start_line, :end_line, to: :location - def initialize(compare_key:, identifiers:, links: [], remediations: [], location:, metadata_version:, name:, raw_metadata:, report_type:, scanner:, scan:, uuid:, confidence: nil, severity: nil, details: {}, signatures: [], project_id: nil, vulnerability_finding_signatures_enabled: false) # rubocop:disable Metrics/ParameterLists + def initialize(compare_key:, identifiers:, flags: [], links: [], remediations: [], location:, metadata_version:, name:, raw_metadata:, report_type:, scanner:, scan:, uuid:, confidence: nil, severity: nil, details: {}, signatures: [], project_id: nil, vulnerability_finding_signatures_enabled: false) # rubocop:disable Metrics/ParameterLists @compare_key = compare_key @confidence = confidence @identifiers = identifiers + @flags = flags @links = links @location = location @metadata_version = metadata_version @@ -58,6 +60,7 @@ module Gitlab compare_key confidence identifiers + flags links location metadata_version diff --git a/lib/gitlab/ci/reports/security/flag.rb b/lib/gitlab/ci/reports/security/flag.rb new file mode 100644 index 00000000000..7e6cc758864 --- /dev/null +++ b/lib/gitlab/ci/reports/security/flag.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + module Reports + module Security + class Flag + attr_reader :type, :origin, :description + + MAP = { 'flagged-as-likely-false-positive' => :false_positive }.freeze + DEFAULT_FLAG_TYPE = :false_positive + + def flag_type + MAP.fetch(type, DEFAULT_FLAG_TYPE) + end + + def initialize(type: nil, origin: nil, description: nil) + @type = type + @origin = origin + @description = description + end + + def to_hash + { + flag_type: flag_type, + origin: origin, + description: description + }.compact + end + end + end + end + end +end |