contrast-agent 4.9.1 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.rspec_parallel +6 -0
- data/ext/cs__contrast_patch/cs__contrast_patch.c +0 -1
- data/ext/cs__contrast_patch/cs__contrast_patch.h +0 -2
- data/lib/contrast/agent/assess/contrast_event.rb +0 -1
- data/lib/contrast/agent/assess/finalizers/hash.rb +0 -1
- data/lib/contrast/agent/assess/policy/patcher.rb +0 -1
- data/lib/contrast/agent/assess/policy/policy_scanner.rb +0 -2
- data/lib/contrast/agent/assess/policy/preshift.rb +8 -5
- data/lib/contrast/agent/assess/policy/propagation_method.rb +100 -57
- data/lib/contrast/agent/assess/policy/propagator/database_write.rb +0 -2
- data/lib/contrast/agent/assess/policy/propagator/match_data.rb +31 -11
- data/lib/contrast/agent/assess/policy/propagator/split.rb +3 -2
- data/lib/contrast/agent/assess/policy/propagator/substitution.rb +1 -0
- data/lib/contrast/agent/assess/policy/rewriter_patch.rb +0 -1
- data/lib/contrast/agent/assess/policy/source_method.rb +13 -17
- data/lib/contrast/agent/assess/policy/trigger/xpath.rb +0 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +59 -83
- data/lib/contrast/agent/assess/property/evented.rb +2 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +0 -1
- data/lib/contrast/agent/disable_reaction.rb +1 -1
- data/lib/contrast/agent/exclusion_matcher.rb +0 -4
- data/lib/contrast/agent/inventory/database_config.rb +117 -0
- data/lib/contrast/agent/inventory/dependency_usage_analysis.rb +5 -4
- data/lib/contrast/agent/inventory/policy/datastores.rb +2 -2
- data/lib/contrast/agent/middleware.rb +1 -0
- data/lib/contrast/agent/patching/policy/after_load_patch.rb +3 -0
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +18 -12
- data/lib/contrast/agent/patching/policy/module_policy.rb +2 -4
- data/lib/contrast/agent/patching/policy/patch.rb +5 -0
- data/lib/contrast/agent/patching/policy/patch_status.rb +3 -7
- data/lib/contrast/agent/patching/policy/patcher.rb +8 -8
- data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +1 -1
- data/lib/contrast/agent/protect/rule/no_sqli.rb +7 -53
- data/lib/contrast/agent/protect/rule/sql_sample_builder.rb +137 -0
- data/lib/contrast/agent/protect/rule/sqli.rb +7 -70
- data/lib/contrast/agent/reaction_processor.rb +1 -1
- data/lib/contrast/agent/request.rb +5 -2
- data/lib/contrast/agent/request_context.rb +19 -22
- data/lib/contrast/agent/static_analysis.rb +1 -1
- data/lib/contrast/agent/tracepoint_hook.rb +6 -1
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/api/communication/messaging_queue.rb +12 -6
- data/lib/contrast/api/communication/service_lifecycle.rb +4 -1
- data/lib/contrast/api/communication/socket_client.rb +4 -4
- data/lib/contrast/api/decorators/agent_startup.rb +4 -4
- data/lib/contrast/api/decorators/application_startup.rb +6 -5
- data/lib/contrast/api/decorators/route_coverage.rb +24 -1
- data/lib/contrast/components/agent.rb +5 -2
- data/lib/contrast/components/assess.rb +6 -3
- data/lib/contrast/components/base.rb +2 -2
- data/lib/contrast/components/config.rb +1 -0
- data/lib/contrast/components/contrast_service.rb +4 -2
- data/lib/contrast/components/logger.rb +13 -8
- data/lib/contrast/components/scope.rb +9 -28
- data/lib/contrast/config/base_configuration.rb +14 -6
- data/lib/contrast/configuration.rb +19 -15
- data/lib/contrast/extension/assess/array.rb +1 -11
- data/lib/contrast/extension/assess/eval_trigger.rb +0 -20
- data/lib/contrast/extension/assess/fiber.rb +0 -11
- data/lib/contrast/extension/assess/hash.rb +0 -10
- data/lib/contrast/extension/assess/kernel.rb +1 -10
- data/lib/contrast/extension/assess/marshal.rb +3 -11
- data/lib/contrast/extension/assess/regexp.rb +0 -11
- data/lib/contrast/extension/assess/string.rb +1 -26
- data/lib/contrast/extension/extension.rb +61 -0
- data/lib/contrast/extension/protect/kernel.rb +0 -10
- data/lib/contrast/framework/grape/support.rb +174 -0
- data/lib/contrast/framework/manager.rb +42 -6
- data/lib/contrast/framework/rack/support.rb +1 -1
- data/lib/contrast/framework/rails/patch/assess_configuration.rb +0 -1
- data/lib/contrast/framework/rails/patch/support.rb +6 -3
- data/lib/contrast/framework/rails/railtie.rb +1 -1
- data/lib/contrast/framework/rails/rewrite/active_record_named.rb +1 -0
- data/lib/contrast/framework/rails/support.rb +60 -13
- data/lib/contrast/framework/sinatra/support.rb +1 -1
- data/lib/contrast/logger/log.rb +89 -15
- data/lib/contrast/utils/io_util.rb +1 -1
- data/lib/contrast/utils/ruby_ast_rewriter.rb +16 -13
- data/lib/contrast/utils/tag_util.rb +2 -1
- data/resources/assess/policy.json +197 -2
- data/resources/deadzone/policy.json +10 -0
- data/ruby-agent.gemspec +10 -1
- metadata +78 -12
- data/lib/contrast/utils/inventory_util.rb +0 -113
@@ -9,7 +9,7 @@ module Contrast
|
|
9
9
|
# Because communication between the Agent/Service and TeamServer can only be initiated by outbound connections
|
10
10
|
# from the Agent/Service, we must provide a mechanism for the TeamServer to direct the Agent to take a specific
|
11
11
|
# action. This action is referred to as a Reaction. This class is how we handle those Reaction messages.
|
12
|
-
|
12
|
+
module ReactionProcessor
|
13
13
|
extend Contrast::Components::Logger::InstanceMethods
|
14
14
|
|
15
15
|
# Process the given Reactions from the application settings based on what
|
@@ -183,8 +183,11 @@ module Contrast
|
|
183
183
|
res[prefix] = Contrast::Utils::ObjectShare::EMPTY_STRING if prefix
|
184
184
|
res
|
185
185
|
when Enumerable
|
186
|
-
|
187
|
-
|
186
|
+
idx = 0
|
187
|
+
res = {}
|
188
|
+
while idx < val.size
|
189
|
+
res.merge! normalize_params(val[idx], prefix: "#{ prefix }[#{ idx }]")
|
190
|
+
idx += 1
|
188
191
|
end
|
189
192
|
res[prefix] = Contrast::Utils::ObjectShare::EMPTY_STRING if prefix
|
190
193
|
res
|
@@ -4,15 +4,14 @@
|
|
4
4
|
require 'contrast/utils/timer'
|
5
5
|
require 'contrast/agent/request'
|
6
6
|
require 'contrast/agent/response'
|
7
|
-
require 'contrast/
|
7
|
+
require 'contrast/agent/inventory/database_config'
|
8
8
|
require 'contrast/components/logger'
|
9
9
|
require 'contrast/components/scope'
|
10
10
|
|
11
11
|
module Contrast
|
12
12
|
module Agent
|
13
|
-
# This class acts to encapsulate information about the currently executed
|
14
|
-
#
|
15
|
-
# in a standardized and normalized format which the Agent understands.
|
13
|
+
# This class acts to encapsulate information about the currently executed request, making it available to the Agent
|
14
|
+
# for the duration of the request in a standardized and normalized format which the Agent understands.
|
16
15
|
#
|
17
16
|
# @attr_reader timer [Contrast::Utils::Timer] when the context was created
|
18
17
|
# @attr_reader logging_hash [Hash] context used to log the request
|
@@ -85,9 +84,11 @@ module Contrast
|
|
85
84
|
@sample_response
|
86
85
|
end
|
87
86
|
|
88
|
-
# Convert the discovered route for this request to appropriate forms and
|
89
|
-
#
|
90
|
-
#
|
87
|
+
# Convert the discovered route for this request to appropriate forms and disseminate it to those locations
|
88
|
+
# where it is necessary for our route coverage and finding vulnerability discovery features to function.
|
89
|
+
#
|
90
|
+
# @param route [Contrast::Api::Dtm::RouteCoverage, nil] the route of the current request, as determined from the
|
91
|
+
# framework
|
91
92
|
def append_route_coverage route
|
92
93
|
return unless route
|
93
94
|
|
@@ -108,8 +109,8 @@ module Contrast
|
|
108
109
|
# Collect the results for the given rule with the given action
|
109
110
|
#
|
110
111
|
# @param rule [String] the id of the rule to which the results apply
|
111
|
-
# @param response_type [Symbol] the result of the response, matching a
|
112
|
-
#
|
112
|
+
# @param response_type [Symbol] the result of the response, matching a value of
|
113
|
+
# Contrast::Api::Dtm::AttackResult::ResponseType
|
113
114
|
# @return [Array<Contrast::Api::Dtm::AttackResult>]
|
114
115
|
def results_for rule, response_type = nil
|
115
116
|
if response_type.nil?
|
@@ -145,10 +146,9 @@ module Contrast
|
|
145
146
|
false
|
146
147
|
end
|
147
148
|
|
148
|
-
# NOTE: this method is only used as a backstop if Speedracer sends Input Evaluations
|
149
|
-
#
|
150
|
-
#
|
151
|
-
# Speedracer for any attacks detected during prefilter.
|
149
|
+
# NOTE: this method is only used as a backstop if Speedracer sends Input Evaluations when the protect state
|
150
|
+
# indicates a security exception should be thrown. This method ensures that the attack reports are generated.
|
151
|
+
# Normally these should be generated on Speedracer for any attacks detected during prefilter.
|
152
152
|
#
|
153
153
|
# @param agent_settings [Contrast::Api::Settings::AgentSettings]
|
154
154
|
def handle_protect_state agent_settings
|
@@ -165,9 +165,8 @@ module Contrast
|
|
165
165
|
raise Contrast::SecurityException.new(nil, (state.security_message || 'Blocking suspicious behavior'))
|
166
166
|
end
|
167
167
|
|
168
|
-
# append anything we've learned to the request seen message
|
169
|
-
#
|
170
|
-
# been accumulated since the last request
|
168
|
+
# append anything we've learned to the request seen message this is the sum-total of all inventory information
|
169
|
+
# that has been accumulated since the last request
|
171
170
|
def extract_after rack_response
|
172
171
|
@response = Contrast::Agent::Response.new(rack_response)
|
173
172
|
activity.http_response = @response.dtm if @sample_response
|
@@ -185,14 +184,13 @@ module Contrast
|
|
185
184
|
|
186
185
|
def reset_activity
|
187
186
|
@activity = Contrast::Api::Dtm::Activity.new(http_request: request.dtm)
|
188
|
-
@server_activity = Contrast::Api::Dtm::ServerActivity.new
|
187
|
+
@server_activity = Contrast::Api::Dtm::ServerActivity.new
|
189
188
|
@observed_route = Contrast::Api::Dtm::ObservedRoute.new
|
190
189
|
end
|
191
190
|
|
192
191
|
private
|
193
192
|
|
194
|
-
# Generate attack results directly from any evaluations on the
|
195
|
-
# agent settings object.
|
193
|
+
# Generate attack results directly from any evaluations on the agent settings object.
|
196
194
|
#
|
197
195
|
# @param agent_settings [Contrast::Api::Settings::AgentSettings]
|
198
196
|
def build_attack_results agent_settings
|
@@ -207,9 +205,8 @@ module Contrast
|
|
207
205
|
logger.debug('Building attack result from Contrast Service input analysis result', result: ia_result.inspect)
|
208
206
|
|
209
207
|
attack_result = if rule.mode == :BLOCK
|
210
|
-
# special case for rules (like reflected xss)
|
211
|
-
#
|
212
|
-
# mode but now are just block at perimeter
|
208
|
+
# special case for rules (like reflected xss) that used to have an infilter / block mode
|
209
|
+
# but now are just block at perimeter
|
213
210
|
rule.build_attack_with_match(self, ia_result, attack_results_by_rule[rule_id],
|
214
211
|
ia_result.value)
|
215
212
|
else
|
@@ -28,7 +28,7 @@ module Contrast
|
|
28
28
|
|
29
29
|
app_update_msg = Contrast::Api::Dtm::ApplicationUpdate.build
|
30
30
|
|
31
|
-
Contrast::
|
31
|
+
Contrast::Agent::Inventory::DatabaseConfig.append_db_config(app_update_msg)
|
32
32
|
Contrast::Agent.messaging_queue.send_event_eventually(app_update_msg)
|
33
33
|
end
|
34
34
|
|
@@ -35,10 +35,15 @@ module Contrast
|
|
35
35
|
path = tracepoint_event.path
|
36
36
|
return if path&.include?('contrast')
|
37
37
|
|
38
|
+
Contrast::Agent.framework_manager.register_late_framework(loaded_module)
|
38
39
|
Contrast::Agent::Inventory::DependencyUsageAnalysis.instance.associate_file(path) if path
|
39
40
|
Contrast::Agent::Patching::Policy::Patcher.patch_specific_module(loaded_module)
|
40
|
-
|
41
|
+
if RUBY_VERSION < '2.6.0' # TODO: RUBY-714 remove guard w/ EOL of 2.5
|
42
|
+
Contrast::Agent::Assess::Policy::RewriterPatch.rewrite_interpolation(loaded_module)
|
43
|
+
end
|
41
44
|
Contrast::Agent::Assess::Policy::PolicyScanner.scan(tracepoint_event)
|
45
|
+
rescue StandardError => e
|
46
|
+
logger.error('Unable to complete TracePoint analysis', e, module: loaded_module)
|
42
47
|
end
|
43
48
|
end
|
44
49
|
end
|
@@ -11,10 +11,9 @@ module Contrast
|
|
11
11
|
class MessagingQueue < Contrast::Agent::WorkerThread
|
12
12
|
include Contrast::Components::Logger::InstanceMethods
|
13
13
|
|
14
|
-
attr_reader :
|
14
|
+
attr_reader :speedracer
|
15
15
|
|
16
16
|
def initialize
|
17
|
-
@queue = Queue.new
|
18
17
|
@speedracer = Contrast::Api::Communication::Speedracer.new
|
19
18
|
super
|
20
19
|
end
|
@@ -28,6 +27,10 @@ module Contrast
|
|
28
27
|
speedracer.return_response(event)
|
29
28
|
end
|
30
29
|
|
30
|
+
def queue
|
31
|
+
@_queue ||= Queue.new
|
32
|
+
end
|
33
|
+
|
31
34
|
# Use this to add a message to the queue and process the response internally
|
32
35
|
def send_event_eventually event
|
33
36
|
if ::Contrast::AGENT.disabled?
|
@@ -42,7 +45,6 @@ module Contrast
|
|
42
45
|
speedracer.ensure_startup!
|
43
46
|
return if running?
|
44
47
|
|
45
|
-
@queue ||= Queue.new
|
46
48
|
@_thread = Contrast::Agent::Thread.new do
|
47
49
|
loop do
|
48
50
|
event = queue.pop
|
@@ -58,13 +60,17 @@ module Contrast
|
|
58
60
|
logger.debug('Started background sending thread.')
|
59
61
|
end
|
60
62
|
|
63
|
+
def delete_queue!
|
64
|
+
@_queue&.clear
|
65
|
+
@_queue&.close
|
66
|
+
@_queue = nil
|
67
|
+
end
|
68
|
+
|
61
69
|
def stop!
|
62
70
|
return unless running?
|
63
71
|
|
64
72
|
super
|
65
|
-
|
66
|
-
@queue&.close
|
67
|
-
@queue = nil
|
73
|
+
delete_queue!
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
@@ -6,10 +6,13 @@ require 'contrast/components/logger'
|
|
6
6
|
module Contrast
|
7
7
|
module Api
|
8
8
|
module Communication
|
9
|
-
# Handles local service startup
|
9
|
+
# Handles local service startup. As this should only ever be invoked by the Speedracer class, which includes
|
10
|
+
# this, all methods here are private.
|
10
11
|
module ServiceLifecycle
|
11
12
|
include Contrast::Components::Logger::InstanceMethods
|
12
13
|
|
14
|
+
private
|
15
|
+
|
13
16
|
def attempt_local_service_startup
|
14
17
|
zombie_check
|
15
18
|
service_starter_thread.join(5)
|
@@ -37,8 +37,7 @@ module Contrast
|
|
37
37
|
log_connection
|
38
38
|
if ::Contrast::CONTRAST_SERVICE.use_tcp?
|
39
39
|
Contrast::Api::Communication::TcpSocket.new(
|
40
|
-
|
41
|
-
)
|
40
|
+
::Contrast::CONTRAST_SERVICE.host, ::Contrast::CONTRAST_SERVICE.port)
|
42
41
|
else
|
43
42
|
Contrast::Api::Communication::UnixSocket.new(::Contrast::CONTRAST_SERVICE.socket_path)
|
44
43
|
end
|
@@ -61,8 +60,9 @@ module Contrast
|
|
61
60
|
|
62
61
|
# Or something is not set.
|
63
62
|
logger.warn(
|
64
|
-
|
65
|
-
|
63
|
+
log_connection_error_msg,
|
64
|
+
host: ::Contrast::CONTRAST_SERVICE.host,
|
65
|
+
port: ::Contrast::CONTRAST_SERVICE.port)
|
66
66
|
end
|
67
67
|
|
68
68
|
# If our connection isn't built properly, we need to warn the user. This builds out the context specific
|
@@ -41,11 +41,11 @@ module Contrast
|
|
41
41
|
#
|
42
42
|
# @param msg [Contrast::Api::Dtm::AgentStartup]
|
43
43
|
def config! msg
|
44
|
-
msg.version
|
45
|
-
msg.
|
46
|
-
msg.
|
44
|
+
msg.version = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.server.version
|
45
|
+
msg.server_tags = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.server.tags
|
46
|
+
msg.library_tags = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.inventory.tags
|
47
|
+
msg.environment = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.server.environment
|
47
48
|
msg.application_tags = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.application.tags
|
48
|
-
msg.library_tags = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.inventory.tags
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -24,11 +24,12 @@ module Contrast
|
|
24
24
|
# @return [Contrast::Api::Dtm::ApplicationCreate]
|
25
25
|
def build
|
26
26
|
msg = new
|
27
|
-
msg.
|
28
|
-
msg.
|
29
|
-
msg.
|
30
|
-
msg.
|
31
|
-
msg.
|
27
|
+
msg.code = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.application.code
|
28
|
+
msg.group = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.application.group
|
29
|
+
msg.metadata = Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.application.metadata
|
30
|
+
msg.mode = Contrast::Api::Dtm::InstrumentationMode.build
|
31
|
+
msg.app_version =
|
32
|
+
Contrast::Utils::StringUtils.protobuf_format ::Contrast::CONFIG.root.application.version.to_s # rubocop:disable Layout/AssignmentIndentation Layout/FirstArgumentIndentation:
|
32
33
|
session!(msg)
|
33
34
|
msg
|
34
35
|
end
|
@@ -46,7 +46,7 @@ module Contrast
|
|
46
46
|
#
|
47
47
|
# @param controller [::Sinatra::Base] the route's final controller.
|
48
48
|
# @param method [String] GET, PUT, POST, etc...
|
49
|
-
# @param
|
49
|
+
# @param pattern [::Mustermann::Sinatra] the pattern that was matched in routing.
|
50
50
|
# @param url [String, nil] use url from string instead matched pattern.
|
51
51
|
# @return [Contrast::Api::Dtm::RouteCoverage]
|
52
52
|
def from_sinatra_route controller, method, pattern, url = nil
|
@@ -59,6 +59,29 @@ module Contrast
|
|
59
59
|
msg.url = Contrast::Utils::StringUtils.force_utf8(safe_url)
|
60
60
|
msg
|
61
61
|
end
|
62
|
+
|
63
|
+
# Convert Grape route data to dtm message.
|
64
|
+
#
|
65
|
+
# @param controller [::Grape::API] the route's final controller.
|
66
|
+
# @param method [String] GET, PUT, POST, etc...
|
67
|
+
# @param url [String, nil] use url from string instead matched pattern.
|
68
|
+
# @param pattern [String, Grape::Router::Route] the pattern that was matched in routing.
|
69
|
+
# @return [Contrast::Api::Dtm::RouteCoverage]
|
70
|
+
def from_grape_controller controller, method, pattern, url = nil
|
71
|
+
if pattern.cs__is_a?(Grape::Router::Route)
|
72
|
+
safe_pattern = pattern.pattern&.path&.to_s
|
73
|
+
safe_url = source_or_string(url || safe_pattern)
|
74
|
+
else
|
75
|
+
safe_pattern = source_or_string(pattern)
|
76
|
+
safe_url = source_or_string(url || pattern)
|
77
|
+
end
|
78
|
+
|
79
|
+
msg = new
|
80
|
+
msg.route = "#{ controller }##{ method } #{ safe_pattern }"
|
81
|
+
msg.verb = Contrast::Utils::StringUtils.force_utf8(method)
|
82
|
+
msg.url = Contrast::Utils::StringUtils.force_utf8(safe_url)
|
83
|
+
msg
|
84
|
+
end
|
62
85
|
end
|
63
86
|
end
|
64
87
|
end
|
@@ -54,7 +54,9 @@ module Contrast
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def interpolation_enabled?
|
57
|
-
|
57
|
+
if @_interpolation_enabled.nil?
|
58
|
+
@_interpolation_enabled = !false?(::Contrast::CONFIG.root.agent.ruby.interpolate)
|
59
|
+
end
|
58
60
|
@_interpolation_enabled
|
59
61
|
end
|
60
62
|
|
@@ -69,7 +71,8 @@ module Contrast
|
|
69
71
|
status:
|
70
72
|
::Contrast::CONFIG.root.agent.ruby.exceptions.override_status || 403,
|
71
73
|
message:
|
72
|
-
::Contrast::CONFIG.root.agent.ruby.exceptions.override_message ||
|
74
|
+
::Contrast::CONFIG.root.agent.ruby.exceptions.override_message ||
|
75
|
+
Contrast::Utils::ObjectShare::OVERRIDE_MESSAGE
|
73
76
|
}
|
74
77
|
end
|
75
78
|
|
@@ -5,7 +5,6 @@ require 'contrast/components/base'
|
|
5
5
|
require 'contrast/components/config'
|
6
6
|
require 'contrast/components/settings'
|
7
7
|
|
8
|
-
|
9
8
|
module Contrast
|
10
9
|
module Components
|
11
10
|
module Assess
|
@@ -78,7 +77,9 @@ module Contrast
|
|
78
77
|
end
|
79
78
|
|
80
79
|
def track_frozen_sources?
|
81
|
-
|
80
|
+
if @_track_frozen_sources.nil?
|
81
|
+
@_track_frozen_sources = !false?(::Contrast::CONFIG.root.agent.ruby.track_frozen_sources)
|
82
|
+
end
|
82
83
|
@_track_frozen_sources
|
83
84
|
end
|
84
85
|
|
@@ -93,7 +94,9 @@ module Contrast
|
|
93
94
|
|
94
95
|
def disabled_rules
|
95
96
|
# TODO: RUBY-903
|
96
|
-
::Contrast::CONFIG.root.assess&.rules&.disabled_rules ||
|
97
|
+
::Contrast::CONFIG.root.assess&.rules&.disabled_rules ||
|
98
|
+
::Contrast::SETTINGS.assess_state.disabled_assess_rules ||
|
99
|
+
[]
|
97
100
|
end
|
98
101
|
|
99
102
|
private
|
@@ -18,7 +18,7 @@ module Contrast
|
|
18
18
|
return true if config_param == false
|
19
19
|
return false unless config_param.cs__is_a?(String)
|
20
20
|
|
21
|
-
Contrast::Utils::ObjectShare::FALSE
|
21
|
+
config_param.downcase == Contrast::Utils::ObjectShare::FALSE
|
22
22
|
end
|
23
23
|
|
24
24
|
# use this to determine if the configuration value is literally boolean
|
@@ -33,7 +33,7 @@ module Contrast
|
|
33
33
|
return true if config_param == true
|
34
34
|
return false unless config_param.cs__is_a?(String)
|
35
35
|
|
36
|
-
Contrast::Utils::ObjectShare::TRUE
|
36
|
+
config_param.downcase == Contrast::Utils::ObjectShare::TRUE
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -32,11 +32,13 @@ module Contrast
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def host
|
35
|
-
@_host ||=
|
35
|
+
@_host ||=
|
36
|
+
(::Contrast::CONFIG.root.agent.service.host || Contrast::Config::ServiceConfiguration::DEFAULT_HOST).to_s
|
36
37
|
end
|
37
38
|
|
38
39
|
def port
|
39
|
-
@_port ||=
|
40
|
+
@_port ||=
|
41
|
+
(::Contrast::CONFIG.root.agent.service.port || Contrast::Config::ServiceConfiguration::DEFAULT_PORT).to_i
|
40
42
|
end
|
41
43
|
|
42
44
|
def socket_path
|
@@ -6,20 +6,25 @@ require 'contrast/components/base'
|
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Components
|
9
|
-
module Logger
|
10
|
-
module InstanceMethods
|
9
|
+
module Logger # :nodoc:
|
10
|
+
module InstanceMethods # :nodoc:
|
11
11
|
def logger
|
12
12
|
Contrast::Logger::Log.instance.logger
|
13
13
|
end
|
14
|
+
|
15
|
+
def add_trace_perf_logging_for sym, custom_message = nil
|
16
|
+
logger.add_trace_perf_logging(self, sym, custom_message)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def add_trace_log_timing_for clazz, method_name, custom_message = nil
|
22
|
+
Contrast::Logger::Log.instance.add_method_to_trace_timing(clazz, method_name, custom_message)
|
23
|
+
end
|
14
24
|
end
|
15
|
-
ClassMethods = InstanceMethods
|
16
25
|
|
17
|
-
# A wrapper build around the Common Agent Configuration project to allow
|
18
|
-
# for access of the values contained in its
|
19
|
-
# parent_configuration_spec.yaml.
|
20
|
-
# Specifically, this allows for querying the state of the Agent Logger.
|
21
26
|
class Interface
|
22
|
-
include
|
27
|
+
include InstanceMethods
|
23
28
|
end
|
24
29
|
end
|
25
30
|
end
|