diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-26 03:09:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-26 03:09:31 +0300 |
commit | b3618e799d30ae6df5c55e47b8ec8ebedb1af5a0 (patch) | |
tree | f2e68cff99dfa77096177caf86f7ac11e6793fd4 /lib/gitlab/ci/reports | |
parent | 52f765baf4931efd40d10b1eb5f2818923ddf26f (diff) |
Add latest changes from gitlab-org/gitlab@master
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 |