Sha256: 0fb762df475b3d56852a348cfe758c50ea048b1c10af9ebad81c93409f730b26

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

# Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/api/dtm.pb'
require 'contrast/utils/string_utils'
require 'contrast/components/base'

module Contrast
  module Api
    module Decorators
      # Used to decorate the {Contrast::Api::Dtm::Finding} protobuf
      # model so it can own the request which its data is for.
      module Finding
        def self.included klass
          klass.extend(ClassMethods)
        end

        # Used to add class methods to the AgentStartup class on inclusion of the decorator
        module ClassMethods
          def build
            new
          end

          def to_controlled_hash finding, *_args
            {
                hash_code: finding.hash_code,
                platform: finding.platform,
                rule_id: finding.rule_id,
                evidence: finding.evidence,
                properties: finding.properties,
                events: finding.events,
                tags: finding.tags,
                version: finding.version,
                routes: finding.routes,
                session_id: finding.session_id,
                teamserver_url: ::Contrast::API.api_url
            }
          end
        end
      end
    end
  end
end

Contrast::Api::Dtm::Finding.include(Contrast::Api::Decorators::Finding)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-4.14.1 lib/contrast/api/decorators/finding.rb
contrast-agent-4.14.0 lib/contrast/api/decorators/finding.rb