contrast-agent 4.8.0 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -1
  3. data/.simplecov +1 -0
  4. data/lib/contrast.rb +24 -14
  5. data/lib/contrast/agent/assess/contrast_event.rb +1 -4
  6. data/lib/contrast/agent/assess/finalizers/hash.rb +2 -4
  7. data/lib/contrast/agent/assess/policy/patcher.rb +6 -4
  8. data/lib/contrast/agent/assess/policy/policy.rb +1 -1
  9. data/lib/contrast/agent/assess/policy/policy_scanner.rb +3 -5
  10. data/lib/contrast/agent/assess/policy/preshift.rb +4 -4
  11. data/lib/contrast/agent/assess/policy/propagation_method.rb +4 -4
  12. data/lib/contrast/agent/assess/policy/propagator/database_write.rb +3 -6
  13. data/lib/contrast/agent/assess/policy/propagator/split.rb +9 -6
  14. data/lib/contrast/agent/assess/policy/propagator/substitution.rb +2 -3
  15. data/lib/contrast/agent/assess/policy/rewriter_patch.rb +7 -7
  16. data/lib/contrast/agent/assess/policy/source_method.rb +6 -6
  17. data/lib/contrast/agent/assess/policy/trigger/xpath.rb +0 -3
  18. data/lib/contrast/agent/assess/policy/trigger_method.rb +2 -3
  19. data/lib/contrast/agent/assess/policy/trigger_node.rb +1 -1
  20. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +4 -4
  21. data/lib/contrast/agent/at_exit_hook.rb +3 -3
  22. data/lib/contrast/agent/class_reopener.rb +6 -5
  23. data/lib/contrast/agent/disable_reaction.rb +3 -4
  24. data/lib/contrast/agent/exclusion_matcher.rb +2 -3
  25. data/lib/contrast/agent/inventory/dependency_analysis.rb +2 -6
  26. data/lib/contrast/agent/inventory/dependency_usage_analysis.rb +3 -5
  27. data/lib/contrast/agent/inventory/policy/datastores.rb +3 -4
  28. data/lib/contrast/agent/inventory/policy/policy.rb +1 -1
  29. data/lib/contrast/agent/middleware.rb +14 -13
  30. data/lib/contrast/agent/patching/policy/after_load_patch.rb +3 -3
  31. data/lib/contrast/agent/patching/policy/after_load_patcher.rb +3 -4
  32. data/lib/contrast/agent/patching/policy/patch.rb +8 -8
  33. data/lib/contrast/agent/patching/policy/patcher.rb +6 -6
  34. data/lib/contrast/agent/patching/policy/policy.rb +2 -4
  35. data/lib/contrast/agent/patching/policy/policy_node.rb +2 -3
  36. data/lib/contrast/agent/protect/policy/policy.rb +1 -1
  37. data/lib/contrast/agent/protect/policy/rule_applicator.rb +3 -5
  38. data/lib/contrast/agent/protect/rule/base.rb +10 -10
  39. data/lib/contrast/agent/protect/rule/cmd_injection.rb +4 -5
  40. data/lib/contrast/agent/protect/rule/path_traversal.rb +1 -5
  41. data/lib/contrast/agent/reaction_processor.rb +2 -3
  42. data/lib/contrast/agent/request.rb +4 -3
  43. data/lib/contrast/agent/request_context.rb +9 -9
  44. data/lib/contrast/agent/request_handler.rb +5 -3
  45. data/lib/contrast/agent/response.rb +2 -3
  46. data/lib/contrast/agent/rewriter.rb +4 -3
  47. data/lib/contrast/agent/rule_set.rb +5 -4
  48. data/lib/contrast/agent/service_heartbeat.rb +2 -3
  49. data/lib/contrast/agent/static_analysis.rb +6 -5
  50. data/lib/contrast/agent/thread.rb +2 -4
  51. data/lib/contrast/agent/thread_watcher.rb +3 -4
  52. data/lib/contrast/agent/tracepoint_hook.rb +4 -4
  53. data/lib/contrast/agent/version.rb +1 -1
  54. data/lib/contrast/api/communication/messaging_queue.rb +4 -5
  55. data/lib/contrast/api/communication/response_processor.rb +11 -11
  56. data/lib/contrast/api/communication/service_lifecycle.rb +5 -4
  57. data/lib/contrast/api/communication/socket_client.rb +18 -14
  58. data/lib/contrast/api/communication/speedracer.rb +5 -6
  59. data/lib/contrast/api/decorators/address.rb +2 -3
  60. data/lib/contrast/api/decorators/agent_startup.rb +7 -9
  61. data/lib/contrast/api/decorators/application_startup.rb +8 -10
  62. data/lib/contrast/api/decorators/application_update.rb +0 -4
  63. data/lib/contrast/api/decorators/http_request.rb +3 -7
  64. data/lib/contrast/api/decorators/instrumentation_mode.rb +3 -5
  65. data/lib/contrast/api/decorators/message.rb +7 -7
  66. data/lib/contrast/api/decorators/trace_event_object.rb +2 -3
  67. data/lib/contrast/components/agent.rb +10 -15
  68. data/lib/contrast/components/app_context.rb +7 -11
  69. data/lib/contrast/components/assess.rb +16 -16
  70. data/lib/contrast/components/base.rb +40 -0
  71. data/lib/contrast/components/config.rb +0 -2
  72. data/lib/contrast/components/contrast_service.rb +6 -11
  73. data/lib/contrast/components/heap_dump.rb +5 -4
  74. data/lib/contrast/components/inventory.rb +2 -7
  75. data/lib/contrast/components/logger.rb +1 -2
  76. data/lib/contrast/components/protect.rb +10 -13
  77. data/lib/contrast/components/sampling.rb +5 -5
  78. data/lib/contrast/components/scope.rb +0 -4
  79. data/lib/contrast/components/settings.rb +1 -5
  80. data/lib/contrast/configuration.rb +3 -4
  81. data/lib/contrast/extension/assess/array.rb +2 -4
  82. data/lib/contrast/extension/assess/eval_trigger.rb +2 -3
  83. data/lib/contrast/extension/assess/fiber.rb +6 -5
  84. data/lib/contrast/extension/assess/hash.rb +3 -3
  85. data/lib/contrast/extension/assess/kernel.rb +2 -4
  86. data/lib/contrast/extension/assess/marshal.rb +4 -4
  87. data/lib/contrast/extension/assess/regexp.rb +5 -4
  88. data/lib/contrast/extension/assess/string.rb +6 -6
  89. data/lib/contrast/extension/kernel.rb +2 -4
  90. data/lib/contrast/extension/protect/kernel.rb +0 -5
  91. data/lib/contrast/framework/manager.rb +2 -3
  92. data/lib/contrast/framework/rack/patch/session_cookie.rb +6 -6
  93. data/lib/contrast/framework/rails/patch/assess_configuration.rb +5 -7
  94. data/lib/contrast/framework/rails/patch/support.rb +40 -36
  95. data/lib/contrast/framework/rails/railtie.rb +8 -6
  96. data/lib/contrast/framework/rails/rewrite/active_record_named.rb +3 -4
  97. data/lib/contrast/funchook/funchook.rb +4 -3
  98. data/lib/contrast/logger/application.rb +1 -6
  99. data/lib/contrast/logger/log.rb +22 -6
  100. data/lib/contrast/logger/request.rb +0 -4
  101. data/lib/contrast/tasks/service.rb +1 -6
  102. data/lib/contrast/utils/assess/sampling_util.rb +2 -3
  103. data/lib/contrast/utils/assess/tracking_util.rb +2 -4
  104. data/lib/contrast/utils/heap_dump_util.rb +5 -3
  105. data/lib/contrast/utils/invalid_configuration_util.rb +4 -3
  106. data/lib/contrast/utils/inventory_util.rb +2 -3
  107. data/lib/contrast/utils/io_util.rb +2 -4
  108. data/lib/contrast/utils/job_servers_running.rb +4 -3
  109. data/lib/contrast/utils/os.rb +2 -3
  110. data/lib/contrast/utils/string_utils.rb +2 -3
  111. data/lib/contrast/utils/tag_util.rb +25 -19
  112. data/ruby-agent.gemspec +4 -2
  113. data/service_executables/VERSION +1 -1
  114. data/service_executables/linux/contrast-service +0 -0
  115. data/service_executables/mac/contrast-service +0 -0
  116. metadata +28 -15
  117. data/lib/contrast/components/interface.rb +0 -196
  118. data/lib/contrast/delegators/input_analysis.rb +0 -12
@@ -1,6 +1,9 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'contrast/components/base'
5
+ require 'contrast/components/heap_dump'
6
+
4
7
  module Contrast
5
8
  module Components
6
9
  module HeapDump
@@ -11,9 +14,6 @@ module Contrast
11
14
  # utility.
12
15
  module ClassMethods
13
16
  include Contrast::Components::ComponentBase
14
- include Contrast::Components::Interface
15
-
16
- access_component :config
17
17
 
18
18
  def heap_dump_enabled?
19
19
  heap_dump_control[:enabled]
@@ -21,7 +21,7 @@ module Contrast
21
21
 
22
22
  def heap_dump_control
23
23
  @_heap_dump_control ||= begin
24
- config = CONFIG.root&.agent&.heap_dump
24
+ config = ::Contrast::CONFIG.root&.agent&.heap_dump
25
25
  {
26
26
  enabled: true?(config&.enable),
27
27
  path: File.absolute_path(config&.path),
@@ -33,6 +33,7 @@ module Contrast
33
33
  end
34
34
  end
35
35
  end
36
+ InstanceMethods = ClassMethods
36
37
  end
37
38
  end
38
39
  end
@@ -11,22 +11,17 @@ module Contrast
11
11
  # product.
12
12
  class Interface
13
13
  include Contrast::Components::ComponentBase
14
- include Contrast::Components::Interface
15
-
16
- access_component :config, :settings
17
14
 
18
15
  def enabled?
19
- @_enabled = !false?(CONFIG.root.inventory.enable) if @_enabled.nil?
16
+ @_enabled = !false?(::Contrast::CONFIG.root.inventory.enable) if @_enabled.nil?
20
17
  @_enabled
21
18
  end
22
19
 
23
20
  def analyze_libraries?
24
- @_analyze_libraries = !false?(CONFIG.root.inventory.analyze_libraries) if @_analyze_libraries.nil?
21
+ @_analyze_libraries = !false?(::Contrast::CONFIG.root.inventory.analyze_libraries) if @_analyze_libraries.nil?
25
22
  @_analyze_libraries
26
23
  end
27
24
  end
28
-
29
- COMPONENT_INTERFACE = Interface.new
30
25
  end
31
26
  end
32
27
  end
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'contrast/logger/log'
5
+ require 'contrast/components/base'
5
6
 
6
7
  module Contrast
7
8
  module Components
@@ -20,8 +21,6 @@ module Contrast
20
21
  class Interface
21
22
  include Contrast::Components::ComponentBase
22
23
  end
23
-
24
- COMPONENT_INTERFACE = Interface.new
25
24
  end
26
25
  end
27
26
  end
@@ -1,6 +1,8 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'contrast/components/base'
5
+
4
6
  module Contrast
5
7
  module Components
6
8
  module Protect
@@ -8,34 +10,31 @@ module Contrast
8
10
  # its parent_configuration_spec.yaml. Specifically, this allows for querying the state of the Protect product.
9
11
  class Interface
10
12
  include Contrast::Components::ComponentBase
11
- include Contrast::Components::Interface
12
-
13
- access_component :config, :settings
14
13
 
15
14
  def enabled?
16
15
  # config overrides if forcibly set
17
16
  return false if forcibly_disabled?
18
17
  return true if forcibly_enabled?
19
18
 
20
- SETTINGS.protect_state.enabled == true
19
+ ::Contrast::SETTINGS.protect_state.enabled == true
21
20
  end
22
21
 
23
22
  def rule_config
24
- CONFIG.root.protect.rules
23
+ ::Contrast::CONFIG.root.protect.rules
25
24
  end
26
25
 
27
26
  def rules
28
- SETTINGS.protect_state.rules
27
+ ::Contrast::SETTINGS.protect_state.rules
29
28
  end
30
29
 
31
30
  def rule_mode rule_id
32
- CONFIG.root.protect.rules[rule_id]&.applicable_mode ||
33
- SETTINGS.application_state.modes_by_id[rule_id] ||
31
+ ::Contrast::CONFIG.root.protect.rules[rule_id]&.applicable_mode ||
32
+ ::Contrast::SETTINGS.application_state.modes_by_id[rule_id] ||
34
33
  Contrast::Api::Settings::ProtectionRule::Mode::NO_ACTION
35
34
  end
36
35
 
37
36
  def rule name
38
- SETTINGS.protect_state.rules[name]
37
+ ::Contrast::SETTINGS.protect_state.rules[name]
39
38
  end
40
39
 
41
40
  def report_any_command_execution?
@@ -55,17 +54,15 @@ module Contrast
55
54
  end
56
55
 
57
56
  def forcibly_disabled?
58
- @_forcibly_disabled ||= false?(CONFIG.root.protect.enable)
57
+ @_forcibly_disabled ||= false?(::Contrast::CONFIG.root.protect.enable)
59
58
  end
60
59
 
61
60
  private
62
61
 
63
62
  def forcibly_enabled?
64
- @_forcibly_enabled ||= true?(CONFIG.root.protect.enable)
63
+ @_forcibly_enabled ||= true?(::Contrast::CONFIG.root.protect.enable)
65
64
  end
66
65
  end
67
-
68
- COMPONENT_INTERFACE = Interface.new
69
66
  end
70
67
  end
71
68
  end
@@ -1,6 +1,8 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'contrast/components/base'
5
+
4
6
  module Contrast
5
7
  module Components
6
8
  module Sampling
@@ -15,9 +17,6 @@ module Contrast
15
17
  module ClassMethods #:nodoc:
16
18
  include Contrast::Components::ComponentBase
17
19
  include Constants
18
- include Contrast::Components::Interface
19
-
20
- access_component :config, :settings
21
20
 
22
21
  def sampling_enabled?
23
22
  sampling_control[:enabled]
@@ -25,8 +24,8 @@ module Contrast
25
24
 
26
25
  def sampling_control
27
26
  @_sampling_control ||= begin
28
- config_settings = CONFIG.root.assess&.sampling
29
- settings = SETTINGS&.assess_state&.[](:sampling_settings)
27
+ config_settings = ::Contrast::CONFIG.root.assess&.sampling
28
+ settings = ::Contrast::SETTINGS&.assess_state&.[](:sampling_settings)
30
29
  {
31
30
  enabled: enabled?(config_settings, settings),
32
31
  baseline: baseline(config_settings, settings),
@@ -94,6 +93,7 @@ module Contrast
94
93
  module InstanceMethods #:nodoc:
95
94
  include Contrast::Components::ComponentBase
96
95
  include Constants
96
+ include ClassMethods
97
97
  end
98
98
  end
99
99
  end
@@ -20,8 +20,6 @@ module Contrast
20
20
  EXECUTION_CONTEXT = {} # rubocop:disable Style/MutableConstant
21
21
 
22
22
  class Interface # :nodoc:
23
- include Contrast::Components::ComponentBase
24
-
25
23
  def initialize
26
24
  # This is probably redundant with #scope_for_current_ec's nil check.
27
25
  EXECUTION_CONTEXT[Fiber.current] = Contrast::Agent::Scope.new
@@ -146,8 +144,6 @@ module Contrast
146
144
  end
147
145
 
148
146
  ClassMethods = InstanceMethods
149
-
150
- COMPONENT_INTERFACE = Interface.new
151
147
  end
152
148
  end
153
149
  end
@@ -22,9 +22,7 @@ module Contrast
22
22
 
23
23
  # This is a class.
24
24
  class Interface
25
- include Contrast::Components::ComponentBase
26
- include Contrast::Components::Interface
27
- access_component :config
25
+ extend Contrast::Components::Config
28
26
 
29
27
  # tainted_columns are database columns that receive unsanitized input.
30
28
  attr_reader :tainted_columns # This can probably go into assess_state?
@@ -76,8 +74,6 @@ module Contrast
76
74
  Contrast::Agent::Protect::Rule::Xxe.new
77
75
  end
78
76
  end
79
-
80
- COMPONENT_INTERFACE = Interface.new
81
77
  end
82
78
  end
83
79
  end
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
 
7
7
  require 'contrast/config'
8
8
  require 'contrast/utils/object_share'
9
- require 'contrast/components/interface'
9
+ require 'contrast/components/scope'
10
10
 
11
11
  module Contrast
12
12
  # This is how we read in the local settings for the Agent, both ENV/ CMD line
@@ -15,9 +15,8 @@ module Contrast
15
15
  class Configuration
16
16
  extend Forwardable
17
17
 
18
- include Contrast::Components::Interface
19
-
20
- access_component :scope
18
+ include Contrast::Components::Scope::InstanceMethods
19
+ extend Contrast::Components::Scope::InstanceMethods
21
20
 
22
21
  def_delegator :root, :assign_value_to_path_array
23
22
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'contrast/agent/patching/policy/patch'
5
5
  require 'contrast/agent/patching/policy/patcher'
6
- require 'contrast/components/interface'
6
+ require 'contrast/components/scope'
7
7
 
8
8
  module Contrast
9
9
  module Extension
@@ -12,9 +12,7 @@ module Contrast
12
12
  # Disclaimer: there may be a better way, but we're in a 'get it work' state.
13
13
  # Hopefully, we'll be in a 'get it right' state soon.
14
14
  class ArrayPropagator
15
- include Contrast::Components::Interface
16
-
17
- access_component :scope
15
+ extend Contrast::Components::Scope::InstanceMethods
18
16
 
19
17
  ARRAY_JOIN_HASH = {
20
18
  'class_name' => 'Array',
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'contrast/components/interface'
4
+ require 'contrast/components/logger'
5
5
 
6
6
  module Contrast
7
7
  module Extension
@@ -11,8 +11,7 @@ module Contrast
11
11
  # apply the trigger in a custom patch over one of the generic triggers in
12
12
  # TriggerMethod.
13
13
  class EvalTrigger
14
- include Contrast::Components::Interface
15
- access_component :logging
14
+ include Contrast::Components::Logger::InstanceMethods
16
15
 
17
16
  class << self
18
17
  def instance_eval_trigger_check obj, source, ret
@@ -2,7 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'contrast/agent/assess/policy/propagation_node'
5
- require 'contrast/components/interface'
5
+ require 'contrast/components/logger'
6
+ require 'contrast/components/scope'
6
7
 
7
8
  # In order to instrument some difficult methods like String#gsub, as it
8
9
  # returns an enumerator, we need to instrument methods on Fiber.
@@ -16,9 +17,9 @@ module Contrast
16
17
  # Contrast::Agent::Assess::Policy::Propagator molds without cluttering up the
17
18
  # Fiber Class or exposing our methods there.
18
19
  class FiberPropagator
19
- include Contrast::Components::Interface
20
+ extend Contrast::Components::Logger::InstanceMethods
21
+ extend Contrast::Components::Scope::InstanceMethods
20
22
 
21
- access_component :analysis, :logging, :scope
22
23
 
23
24
  # we use funchook to patch rb_fiber_new the initialize method is not exposed by Ruby core
24
25
  FIBER_NEW_NODE_HASH = {
@@ -53,7 +54,7 @@ module Contrast
53
54
 
54
55
  class << self
55
56
  def track_rb_fiber_yield fiber, _method, results
56
- return unless ASSESS.enabled?
57
+ return unless ::Contrast::ASSESS.enabled?
57
58
 
58
59
  # results will be nil if StopIteration was raised,
59
60
  # otherwise an Array of the yielded arguments
@@ -72,7 +73,7 @@ module Contrast
72
73
  end
73
74
 
74
75
  def track_rb_fiber_new fiber, _enum, _enum_method, underlying, _underlying_method
75
- return unless ASSESS.enabled?
76
+ return unless ::Contrast::ASSESS.enabled?
76
77
  return unless underlying.is_a?(String) && !underlying.empty?
77
78
 
78
79
  with_contrast_scope do
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'contrast/components/interface'
4
+ require 'contrast/components/logger'
5
5
 
6
6
  module Contrast
7
7
  module Extension
@@ -10,8 +10,8 @@ module Contrast
10
10
  # methods which are too complex to fit into one of the standard
11
11
  # Contrast::Agent::Assess::Policy::Propagator molds.
12
12
  class HashPropagator
13
- include Contrast::Components::Interface
14
- access_component :logging
13
+ include Contrast::Components::Logger::InstanceMethods
14
+
15
15
  class << self
16
16
  def cs__duplicate_and_freeze object
17
17
  return object unless object.is_a?(String) && !object.cs__frozen?
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'contrast/components/interface'
5
4
  require 'contrast/extension/assess/exec_trigger'
5
+ require 'contrast/components/logger'
6
6
 
7
7
  module Contrast
8
8
  module Extension
@@ -13,11 +13,9 @@ module Contrast
13
13
  # Kernel Module or exposing our methods there.
14
14
  module KernelPropagator
15
15
  class << self
16
- include Contrast::Components::Interface
16
+ extend Contrast::Components::Logger::InstanceMethods
17
17
  include Contrast::Extension::Assess::ExecTrigger
18
18
 
19
- access_component :logging
20
-
21
19
  # We're 'tracking' sprintf now, meaning if anything is tracked on the way
22
20
  # in, the entire result will be tracked out. We're going to take this
23
21
  # approach for now b/c it's fast and easy. I don't super love it, and by
@@ -1,7 +1,8 @@
1
1
  # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'contrast/components/interface'
4
+ require 'contrast/components/logger'
5
+ require 'contrast/components/scope'
5
6
 
6
7
  module Contrast
7
8
  module Extension
@@ -11,9 +12,8 @@ module Contrast
11
12
  # Hopefully, we'll be in a 'get it right' state soon.
12
13
  # This module is used for our Marshal.load patches
13
14
  class MarshalPropagator
14
- include Contrast::Components::Interface
15
-
16
- access_component :logging, :scope
15
+ extend Contrast::Components::Logger::InstanceMethods
16
+ extend Contrast::Components::Scope::InstanceMethods
17
17
 
18
18
  class << self
19
19
  def cs__load_protect arg
@@ -2,7 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'contrast/agent/assess/policy/propagation_node'
5
- require 'contrast/components/interface'
5
+ require 'contrast/components/logger'
6
+ require 'contrast/components/scope'
6
7
 
7
8
  module Contrast
8
9
  module Extension
@@ -12,9 +13,9 @@ module Contrast
12
13
  # Contrast::Agent::Assess::Policy::Propagator molds without cluttering up the
13
14
  # Regexp Class or exposing our methods there.
14
15
  class RegexpPropagator
15
- include Contrast::Components::Interface
16
+ extend Contrast::Components::Logger::InstanceMethods
17
+ extend Contrast::Components::Scope::InstanceMethods
16
18
 
17
- access_component :analysis, :logging, :scope
18
19
 
19
20
  REGEXP_EQUAL_SQUIGGLE_HASH = {
20
21
  'id' => 'regexp_100',
@@ -34,7 +35,7 @@ module Contrast
34
35
 
35
36
  class << self
36
37
  def track_equal_squiggle info_hash
37
- return unless ASSESS.enabled?
38
+ return unless ::Contrast::ASSESS.enabled?
38
39
 
39
40
  # Because we have a special case for this propagation,
40
41
  # it falls out of regular scoping. As such, any patch to the `=~` method
@@ -2,7 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'contrast/agent/assess/policy/propagation_node'
5
- require 'contrast/components/interface'
5
+ require 'contrast/components/logger'
6
+ require 'contrast/components/scope'
6
7
 
7
8
  module Contrast
8
9
  module Extension
@@ -12,9 +13,8 @@ module Contrast
12
13
  # Contrast::Agent::Assess::Policy::Propagator molds without cluttering up the
13
14
  # String Class or exposing our methods there.
14
15
  class StringPropagator
15
- include Contrast::Components::Interface
16
-
17
- access_component :agent, :analysis, :logging, :scope
16
+ extend Contrast::Components::Logger::InstanceMethods
17
+ extend Contrast::Components::Scope::InstanceMethods
18
18
 
19
19
  NODE_HASH = {
20
20
  'class_name' => 'String',
@@ -31,7 +31,7 @@ module Contrast
31
31
 
32
32
  class << self
33
33
  def track_interpolation inputs, result
34
- return unless AGENT.interpolation_enabled?
34
+ return unless ::Contrast::AGENT.interpolation_enabled?
35
35
  return if in_contrast_scope?
36
36
  return unless inputs.any? { |input| Contrast::Agent::Assess::Tracker.tracked?(input) }
37
37
 
@@ -66,7 +66,7 @@ module Contrast
66
66
  def instrument_string_interpolation
67
67
  if @_instrument_string_interpolation.nil?
68
68
  @_instrument_string_interpolation = begin
69
- if AGENT.patch_interpolation? && Funchook.available?
69
+ if ::Contrast::AGENT.patch_interpolation? && Funchook.available?
70
70
  require 'cs__assess_string_interpolation26/cs__assess_string_interpolation26'
71
71
  end
72
72
  true