# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true cs__scoped_require 'English' # Config interface, also cruft around logger interfaces etc. # this comes early bc legacy. cs__scoped_require 'contrast/agent/feature_state' # This must precede other Contrast C extensions cs__scoped_require 'cs__common/cs__common' # defining instrumentation, this must precede core extensions # because they need to register their patches cs__scoped_require 'contrast/agent/patching/policy/patcher' cs__scoped_require 'contrast/agent/patching/policy/patch' # core extensions cs__scoped_require 'contrast/extensions/ruby_core/assess' cs__scoped_require 'contrast/extensions/ruby_core/delegator' cs__scoped_require 'contrast/extensions/ruby_core/inventory' cs__scoped_require 'contrast/extensions/ruby_core/module' cs__scoped_require 'contrast/extensions/ruby_core/protect' cs__scoped_require 'contrast/extensions/ruby_core/protect/kernel' cs__scoped_require 'contrast/utils/object_share' cs__scoped_require 'contrast/utils/boolean_util' cs__scoped_require 'contrast/utils/string_utils' cs__scoped_require 'contrast/utils/io_util' cs__scoped_require 'contrast/utils/os' cs__scoped_require 'contrast/common_agent_configuration' cs__scoped_require 'contrast/utils/hash_digest' cs__scoped_require 'contrast/utils/invalid_configuration_util' # scoping cs__scoped_require 'contrast/agent/scope' cs__scoped_require 'contrast/utils/thread_tracker' # Framework support cs__scoped_require 'contrast/framework/manager' module Contrast # Top namespace of the Agent section. Holds tracking contexts that will be # accessed throughout the Agent. module Agent # build a map for tracking the context of the current request REQUEST_TRACKER = Contrast::Utils::ThreadTracker.new def self.framework_manager @_framework_manager ||= Contrast::Framework::Manager.new end end end cs__scoped_require 'contrast/api' cs__scoped_require 'contrast/utils/resource_loader' cs__scoped_require 'contrast/utils/duck_utils' cs__scoped_require 'contrast/agent/tracepoint_hook' cs__scoped_require 'contrast/agent/at_exit_hook' # communication with contrast service cs__scoped_require 'contrast/agent/exclusion_matcher' cs__scoped_require 'contrast/agent/socket_client' # threads that handle contrast scope cs__scoped_require 'contrast/agent/thread' # keep track of attacks cs__scoped_require 'contrast/agent/request_context' cs__scoped_require 'contrast/agent/assess' # Unconditional early-framework patches. # These happen regardless of analysis mode, & should be lightweight. cs__scoped_require 'contrast/utils/rack_assess_session_cookie' cs__scoped_require 'contrast/utils/rails_assess_configuration' # In Rails, session configuration occurs extremely early & only once. # If we defer our patching of the rails session configuration too long # (i.e., where we normally patch) we will miss the configuration # and will never be able to report session misconfiguration rules. cs__scoped_require 'contrast/extensions/framework/rails/configuration' if defined?(Rails) # protect rules cs__scoped_require 'contrast/agent/protect/rule' # application libraries and technologies cs__scoped_require 'contrast/utils/gemfile_reader' # rack event monitoring cs__scoped_require 'contrast/agent/middleware' cs__scoped_require 'contrast/agent/railtie' if defined?(Rails) && Rails::VERSION::MAJOR.to_i >= 3