Sha256: b9d6690bad1761a7ee7d59dfe1b2b1930d618a4d76a3457426b0efb5f7366b2e
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 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/components/logger' require 'contrast/components/scope' require 'contrast/api/decorators/application_update' module Contrast module Agent # this module handles one time static analysis tasks class StaticAnalysis include Singleton include Contrast::Components::Logger::InstanceMethods include Contrast::Components::Scope::InstanceMethods class << self # After the first request is complete, we do a one-time manual catchup to review and report the already-loaded # gems. def catchup @_catchup ||= begin threaded_analysis! true end end # TODO: RUBY-1354 # TODO: RUBY-1356 def send_inventory_message return unless ::Contrast::INVENTORY.enabled? app_update_msg = Contrast::Api::Dtm::ApplicationUpdate.build Contrast::Agent::Inventory::DatabaseConfig.append_db_config(app_update_msg) Contrast::Agent.messaging_queue.send_event_eventually(app_update_msg) end private def threaded_analysis! Contrast::Agent::Thread.new do Contrast::Agent::Inventory::DependencyUsageAnalysis.instance.catchup send_inventory_message rescue StandardError => e logger.warn('Unable to run post-initialization static analysis', e) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-4.13.1 | lib/contrast/agent/static_analysis.rb |
contrast-agent-4.13.0 | lib/contrast/agent/static_analysis.rb |