Sha256: 1683d52b562994bfd551d4ba38ee4ba3421d2d97460b8e6f1b36fc5e381d3638
Contents?: true
Size: 1.86 KB
Versions: 9
Compression:
Stored size: 1.86 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/utils/string_utils' module Contrast module Api module Decorators # Used to decorate the {Contrast::Api::Dtm::ApplicationUpdate} protobuf # model so it can own some of the data massaging required for AppUpdate # dtm. module ApplicationUpdate def self.included klass klass.extend(ClassMethods) end def append_library_update library_dtm_list library_dtm_list.each do |library_dtm| libraries[library_dtm.hash_code] = library_dtm end end # TS only allows you to report 500 routes per application def append_route_coverage_data route_coverage_dtms route_coverage_dtms.take(500).each do |route_coverage_dtm| routes << route_coverage_dtm end end def append_platform_version platform_version self.platform = Contrast::Api::Dtm::Platform.new if platform.nil? platform.major = platform_version.major platform.minor = platform_version.minor platform.build = platform_version.patch end # Used to add class methods to the ApplicationUpdate class on inclusion of the decorator module ClassMethods def build msg = new msg.append_route_coverage_data(Contrast::Agent.framework_manager.find_route_discovery_data) msg.append_platform_version(Contrast::Agent.framework_manager.platform_version) msg.append_library_update(Contrast::Agent::Inventory::DependencyAnalysis.instance.library_pb_list) msg end end end end end end Contrast::Api::Dtm::ApplicationUpdate.include(Contrast::Api::Decorators::ApplicationUpdate)
Version data entries
9 entries across 9 versions & 1 rubygems