Module: Threatstack::Control
- Includes:
- Constants
- Defined in:
- lib/control.rb
Constant Summary
collapse
- @@agent_initialized =
false
- @@agent_init_mutex =
Mutex.new
Constants included
from Constants
Threatstack::Constants::AGENT_ID, Threatstack::Constants::AGENT_INSTANCE_ID, Threatstack::Constants::AGENT_NAME, Threatstack::Constants::APPSEC_BASE_URL, Threatstack::Constants::APPSEC_EVENTS_URL, Threatstack::Constants::ATTACK, Threatstack::Constants::AWS_METADATA_URL, Threatstack::Constants::BLOCK_SQLI, Threatstack::Constants::BLOCK_XSS, Threatstack::Constants::CGI_VARIABLES, Threatstack::Constants::DEPENDENCIES, Threatstack::Constants::DETECTED_NOT_BLOCKED, Threatstack::Constants::DISABLED, Threatstack::Constants::DROP_FIELDS, Threatstack::Constants::ENVIRONMENT, Threatstack::Constants::EVENTS_PER_REQ, Threatstack::Constants::INSTRUMENTATION, Threatstack::Constants::IPV4, Threatstack::Constants::IPV6, Threatstack::Constants::JOB_INTERVAL, Threatstack::Constants::LOG_COLORS, Threatstack::Constants::LOG_LEVEL, Threatstack::Constants::MANUAL_INIT, Threatstack::Constants::REDACTED, Threatstack::Constants::REQUEST_BLOCKED, Threatstack::Constants::RUBY, Threatstack::Constants::SQLI, Threatstack::Constants::TRUTHY, Threatstack::Constants::XSS
Class Method Summary
collapse
Methods included from Constants
env, is_truthy
Class Method Details
._setup_agent ⇒ Object
56
57
58
59
|
# File 'lib/control.rb', line 56
def self._setup_agent
self.init unless DISABLED || MANUAL_INIT
end
|
.init ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/control.rb', line 21
def self.init
@@agent_init_mutex.synchronize do
return if @@agent_initialized
@@agent_initialized = true
end
logger = Threatstack::Utils::TSLogger.create 'MainAgent'
logger.info 'Initializing Threatstack Ruby agent'
logger.info 'Instrumenting Rails...'
Threatstack::Instrumentation::TSRails.patch_action_controller
logger.info 'Done instrumenting Rails'
logger.info 'Instrumenting Kernel methods...'
Threatstack::Instrumentation::TSKernel.wrap_methods
logger.info 'Done instrumenting Kernel methods'
logger.info 'Starting Event Submitter...'
Threatstack::Jobs::EventSubmitter.instance.start
logger.info 'Started Event Submitter'
Threatstack::Jobs::DelayedJob.new(logger, 5) do
dep_event = Threatstack::Events::DependencyEvent.new
Threatstack::Jobs::EventSubmitter.instance.queue_event dep_event
Threatstack::Jobs::EventSubmitter.instance.queue_event Threatstack::Events::EnvironmentEvent.new
end
logger.info 'Initialization done for agent'
end
|