lib/contrast/components/app_context.rb in contrast-agent-4.3.2 vs lib/contrast/components/app_context.rb in contrast-agent-4.4.0

- old
+ new

@@ -1,9 +1,11 @@ # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'rubygems/version' +require 'contrast/api/decorators/agent_startup' +require 'contrast/api/decorators/application_startup' require 'contrast/utils/object_share' module Contrast module Components module AppContext @@ -75,34 +77,14 @@ DEFAULT_SERVER_PATH end end def build_app_startup_message - msg = Contrast::Api::Dtm::ApplicationCreate.new - - msg.group = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.group - msg.app_version = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.version.to_s - msg.code = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.code - msg.metadata = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.metadata - # Other fields have limits in TeamServer, the rest don't. - msg.session_id = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.session_id, truncate: false - msg.session_metadata = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.session_metadata, truncate: false - - msg + Contrast::Api::Dtm::ApplicationCreate.build end def build_agent_startup_message - msg = Contrast::Api::Dtm::AgentStartup.new - msg.server_name = Contrast::Utils::StringUtils.protobuf_format server_name - msg.server_path = Contrast::Utils::StringUtils.protobuf_format server_path - msg.server_type = Contrast::Utils::StringUtils.protobuf_format server_type - msg.server_version = Contrast::Agent::VERSION - msg.version = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.server.version - msg.environment = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.server.environment - msg.server_tags = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.server.tags - msg.application_tags = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.application.tags - msg.library_tags = Contrast::Utils::StringUtils.protobuf_format CONFIG.root.inventory.tags - msg.finding_tags = Contrast::Utils::StringUtils.protobuf_format ASSESS.tags + msg = Contrast::Api::Dtm::AgentStartup.build(server_name, server_path, server_type) logger.info('Application context', server_name: msg.server_name, server_path: msg.server_path, server_type: msg.server_type, application_name: name,