contrast-agent 6.0.0 → 6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +1 -1
- data/Rakefile +1 -1
- data/ext/build_funchook.rb +3 -3
- data/ext/cs__assess_basic_object/cs__assess_basic_object.c +5 -1
- data/ext/cs__assess_regexp/cs__assess_regexp.c +15 -2
- data/ext/cs__assess_regexp/cs__assess_regexp.h +2 -0
- data/ext/cs__assess_string/cs__assess_string.c +8 -0
- data/ext/cs__assess_test/cs__assess_test.h +9 -0
- data/ext/cs__assess_test/cs__assess_tests.c +22 -0
- data/ext/cs__assess_test/extconf.rb +5 -0
- data/ext/cs__common/cs__common.c +101 -0
- data/ext/cs__common/cs__common.h +29 -5
- data/ext/cs__contrast_patch/cs__contrast_patch.c +1 -1
- data/ext/cs__tests/cs__tests.c +12 -0
- data/ext/cs__tests/cs__tests.h +3 -0
- data/ext/cs__tests/extconf.rb +5 -0
- data/ext/extconf_common.rb +1 -1
- data/lib/contrast/agent/assess/contrast_object.rb +16 -16
- data/lib/contrast/agent/assess/events/source_event.rb +17 -19
- data/lib/contrast/agent/assess/finalizers/hash.rb +2 -2
- data/lib/contrast/agent/assess/policy/policy.rb +9 -10
- data/lib/contrast/agent/assess/policy/policy_node.rb +9 -10
- data/lib/contrast/agent/assess/policy/policy_scanner.rb +2 -16
- data/lib/contrast/agent/assess/policy/propagation_method.rb +3 -3
- data/lib/contrast/agent/assess/policy/propagation_node.rb +2 -3
- data/lib/contrast/agent/assess/policy/propagator/base.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/buffer.rb +2 -1
- data/lib/contrast/agent/assess/policy/propagator/database_write.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/splat.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/split.rb +17 -21
- data/lib/contrast/agent/assess/policy/propagator/trim.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +10 -18
- data/lib/contrast/agent/assess/policy/trigger_node.rb +16 -16
- data/lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb +1 -1
- data/lib/contrast/agent/assess/property/evented.rb +2 -2
- data/lib/contrast/agent/assess/property/tagged.rb +2 -2
- data/lib/contrast/agent/assess/rule/provider/hardcoded_key.rb +6 -8
- data/lib/contrast/agent/assess/rule/provider/hardcoded_password.rb +6 -7
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +12 -7
- data/lib/contrast/agent/assess/rule/response/base_rule.rb +13 -6
- data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +66 -43
- data/lib/contrast/agent/assess/rule/response/click_jacking_header_rule.rb +4 -4
- data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +6 -6
- data/lib/contrast/agent/assess/rule/response/csp_header_missing_rule.rb +4 -4
- data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +4 -4
- data/lib/contrast/agent/assess/rule/response/x_content_type_header_rule.rb +4 -4
- data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +3 -4
- data/lib/contrast/agent/assess/tag.rb +13 -14
- data/lib/contrast/agent/at_exit_hook.rb +12 -1
- data/lib/contrast/agent/inventory/database_config.rb +22 -7
- data/lib/contrast/agent/middleware.rb +9 -6
- data/lib/contrast/agent/patching/policy/after_load_patch.rb +3 -5
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +2 -2
- data/lib/contrast/agent/patching/policy/method_policy_extend.rb +4 -4
- data/lib/contrast/agent/patching/policy/patch.rb +20 -19
- data/lib/contrast/agent/patching/policy/patch_status.rb +10 -3
- data/lib/contrast/agent/patching/policy/patcher.rb +1 -1
- data/lib/contrast/agent/patching/policy/policy.rb +13 -15
- data/lib/contrast/agent/patching/policy/policy_node.rb +19 -21
- data/lib/contrast/agent/patching/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/protect/input_analyzer/input_analyzer.rb +126 -122
- data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +2 -2
- data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_xxe_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/rule_applicator.rb +4 -4
- data/lib/contrast/agent/protect/rule/base.rb +30 -18
- data/lib/contrast/agent/protect/rule/base_service.rb +31 -14
- data/lib/contrast/agent/protect/rule/cmd_injection.rb +16 -9
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_input_classification.rb +3 -3
- data/lib/contrast/agent/protect/rule/default_scanner.rb +2 -1
- data/lib/contrast/agent/protect/rule/deserialization.rb +18 -7
- data/lib/contrast/agent/protect/rule/http_method_tampering/http_method_tampering_input_classification.rb +74 -74
- data/lib/contrast/agent/protect/rule/http_method_tampering.rb +71 -53
- data/lib/contrast/agent/protect/rule/no_sqli/no_sqli_input_classification.rb +3 -3
- data/lib/contrast/agent/protect/rule/no_sqli.rb +15 -16
- data/lib/contrast/agent/protect/rule/path_traversal.rb +13 -3
- data/lib/contrast/agent/protect/rule/sqli/sqli_input_classification.rb +2 -2
- data/lib/contrast/agent/protect/rule/sqli/sqli_worth_watching.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli.rb +16 -23
- data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_input_classification.rb +61 -61
- data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_matcher.rb +29 -29
- data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +32 -32
- data/lib/contrast/agent/protect/rule/xss.rb +17 -0
- data/lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb +14 -13
- data/lib/contrast/agent/protect/rule/xxe.rb +25 -3
- data/lib/contrast/agent/reaction_processor.rb +1 -1
- data/lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb +36 -36
- data/lib/contrast/agent/reporting/masker/masker.rb +18 -21
- data/lib/contrast/agent/reporting/masker/masker_utils.rb +10 -6
- data/lib/contrast/agent/reporting/reporter.rb +11 -16
- data/lib/contrast/agent/reporting/reporter_heartbeat.rb +49 -0
- data/lib/contrast/agent/reporting/reporting_events/agent_startup.rb +6 -2
- data/lib/contrast/agent/reporting/reporting_events/application_activity.rb +51 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_activity.rb +96 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_activity.rb +70 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample.rb +182 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb +56 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_stack.rb +22 -0
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attacker_activity.rb +70 -0
- data/lib/contrast/agent/reporting/reporting_events/application_inventory.rb +6 -2
- data/lib/contrast/agent/reporting/reporting_events/application_inventory_activity.rb +60 -0
- data/lib/contrast/agent/reporting/reporting_events/application_reporting_event.rb +27 -0
- data/lib/contrast/agent/reporting/reporting_events/application_startup.rb +15 -11
- data/lib/contrast/agent/reporting/reporting_events/application_update.rb +7 -12
- data/lib/contrast/agent/reporting/reporting_events/discovered_route.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/finding.rb +9 -3
- data/lib/contrast/agent/reporting/reporting_events/finding_event.rb +2 -4
- data/lib/contrast/agent/reporting/reporting_events/finding_event_object.rb +3 -3
- data/lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb +6 -2
- data/lib/contrast/agent/reporting/reporting_events/observed_route.rb +7 -3
- data/lib/contrast/agent/reporting/reporting_events/poll.rb +6 -2
- data/lib/contrast/agent/reporting/reporting_events/preflight.rb +10 -8
- data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +6 -10
- data/lib/contrast/agent/reporting/reporting_events/server_activity.rb +12 -20
- data/lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb +27 -0
- data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +17 -27
- data/lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb +38 -0
- data/lib/contrast/agent/reporting/reporting_utilities/dtm_message.rb +8 -0
- data/lib/contrast/agent/reporting/reporting_utilities/endpoints.rb +6 -0
- data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +1 -2
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +15 -10
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client_utils.rb +54 -67
- data/lib/contrast/agent/reporting/reporting_utilities/response.rb +17 -7
- data/lib/contrast/agent/reporting/reporting_utilities/response_extractor.rb +9 -6
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler.rb +17 -17
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler_utils.rb +47 -32
- data/lib/contrast/agent/reporting/settings/application_settings.rb +1 -1
- data/lib/contrast/agent/reporting/settings/assess.rb +5 -5
- data/lib/contrast/agent/reporting/settings/assess_server_feature.rb +3 -3
- data/lib/contrast/agent/reporting/settings/exclusions.rb +3 -3
- data/lib/contrast/agent/reporting/settings/protect.rb +21 -6
- data/lib/contrast/agent/reporting/settings/protect_server_feature.rb +6 -6
- data/lib/contrast/agent/reporting/settings/reaction.rb +3 -3
- data/lib/contrast/agent/reporting/settings/sensitive_data_masking.rb +2 -2
- data/lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb +2 -2
- data/lib/contrast/agent/reporting/settings/server_features.rb +2 -2
- data/lib/contrast/agent/request.rb +5 -5
- data/lib/contrast/agent/request_context.rb +23 -19
- data/lib/contrast/agent/request_context_extend.rb +11 -24
- data/lib/contrast/agent/request_handler.rb +4 -4
- data/lib/contrast/agent/response.rb +2 -0
- data/lib/contrast/agent/rule_set.rb +2 -2
- data/lib/contrast/agent/scope.rb +1 -1
- data/lib/contrast/agent/service_heartbeat.rb +6 -48
- data/lib/contrast/agent/static_analysis.rb +1 -1
- data/lib/contrast/agent/telemetry/base.rb +155 -0
- data/lib/contrast/agent/telemetry/events/event.rb +35 -0
- data/lib/contrast/agent/telemetry/events/exceptions/obfuscate.rb +119 -0
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exception_base.rb +44 -36
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exception_event.rb +29 -21
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exception_message.rb +91 -73
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exception_message_exception.rb +62 -44
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exception_stack_frame.rb +50 -33
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exceptions.rb +20 -0
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exceptions_report.rb +30 -0
- data/lib/contrast/agent/telemetry/events/metric_event.rb +28 -0
- data/lib/contrast/agent/telemetry/events/startup_metrics_event.rb +123 -0
- data/lib/contrast/agent/thread_watcher.rb +52 -68
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/agent/worker_thread.rb +8 -0
- data/lib/contrast/agent.rb +1 -3
- data/lib/contrast/api/communication/messaging_queue.rb +29 -12
- data/lib/contrast/api/communication/response_processor.rb +7 -10
- data/lib/contrast/api/communication/service_lifecycle.rb +1 -1
- data/lib/contrast/api/communication/socket.rb +1 -1
- data/lib/contrast/api/communication/socket_client.rb +1 -1
- data/lib/contrast/api/communication/speedracer.rb +3 -3
- data/lib/contrast/api/decorators/activity.rb +33 -0
- data/lib/contrast/api/decorators/agent_startup.rb +10 -9
- data/lib/contrast/api/decorators/application_settings.rb +1 -1
- data/lib/contrast/api/decorators/application_startup.rb +4 -4
- data/lib/contrast/api/decorators/http_request.rb +1 -1
- data/lib/contrast/api/decorators/response_type.rb +4 -17
- data/lib/contrast/components/agent.rb +1 -1
- data/lib/contrast/components/base.rb +1 -1
- data/lib/contrast/components/config.rb +19 -28
- data/lib/contrast/components/contrast_service.rb +13 -1
- data/lib/contrast/components/sampling.rb +1 -1
- data/lib/contrast/components/settings.rb +58 -24
- data/lib/contrast/config/agent_configuration.rb +21 -11
- data/lib/contrast/config/api_configuration.rb +12 -8
- data/lib/contrast/config/api_proxy_configuration.rb +7 -3
- data/lib/contrast/config/application_configuration.rb +15 -11
- data/lib/contrast/config/assess_configuration.rb +13 -9
- data/lib/contrast/config/assess_rules_configuration.rb +6 -2
- data/lib/contrast/config/base_configuration.rb +3 -35
- data/lib/contrast/config/certification_configuration.rb +9 -5
- data/lib/contrast/config/exception_configuration.rb +10 -7
- data/lib/contrast/config/heap_dump_configuration.rb +13 -9
- data/lib/contrast/config/inventory_configuration.rb +9 -6
- data/lib/contrast/config/logger_configuration.rb +9 -6
- data/lib/contrast/config/protect_configuration.rb +9 -6
- data/lib/contrast/config/protect_rule_configuration.rb +12 -8
- data/lib/contrast/config/protect_rules_configuration.rb +19 -18
- data/lib/contrast/config/request_audit_configuration.rb +10 -7
- data/lib/contrast/config/root_configuration.rb +29 -12
- data/lib/contrast/config/ruby_configuration.rb +14 -11
- data/lib/contrast/config/sampling_configuration.rb +11 -8
- data/lib/contrast/config/server_configuration.rb +13 -9
- data/lib/contrast/config/service_configuration.rb +14 -11
- data/lib/contrast/configuration.rb +23 -14
- data/lib/contrast/extension/assess/array.rb +1 -1
- data/lib/contrast/extension/assess/erb.rb +1 -1
- data/lib/contrast/extension/assess/marshal.rb +1 -1
- data/lib/contrast/extension/assess/string.rb +1 -1
- data/lib/contrast/extension/extension.rb +2 -2
- data/lib/contrast/framework/base_support.rb +8 -8
- data/lib/contrast/framework/grape/support.rb +3 -3
- data/lib/contrast/framework/manager.rb +5 -5
- data/lib/contrast/framework/manager_extend.rb +1 -1
- data/lib/contrast/framework/rack/patch/session_cookie.rb +1 -1
- data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +14 -3
- data/lib/contrast/framework/rails/patch/assess_configuration.rb +3 -3
- data/lib/contrast/framework/rails/patch/rails_application_configuration.rb +1 -1
- data/lib/contrast/framework/rails/patch/support.rb +14 -46
- data/lib/contrast/framework/rails/support.rb +2 -2
- data/lib/contrast/framework/sinatra/support.rb +1 -1
- data/lib/contrast/logger/aliased_logging.rb +94 -0
- data/lib/contrast/logger/application.rb +0 -4
- data/lib/contrast/logger/cef_log.rb +14 -14
- data/lib/contrast/logger/format.rb +1 -1
- data/lib/contrast/logger/log.rb +8 -8
- data/lib/contrast/tasks/config.rb +30 -21
- data/lib/contrast/tasks/service.rb +2 -2
- data/lib/contrast/utils/assess/tracking_util.rb +4 -4
- data/lib/contrast/utils/class_util.rb +6 -10
- data/lib/contrast/utils/findings.rb +3 -3
- data/lib/contrast/utils/hash_digest.rb +6 -7
- data/lib/contrast/utils/head_dump_utils_extend.rb +1 -1
- data/lib/contrast/utils/invalid_configuration_util.rb +2 -2
- data/lib/contrast/utils/log_utils.rb +6 -4
- data/lib/contrast/utils/lru_cache.rb +1 -1
- data/lib/contrast/utils/metrics_hash.rb +1 -1
- data/lib/contrast/utils/middleware_utils.rb +6 -6
- data/lib/contrast/utils/net_http_base.rb +4 -4
- data/lib/contrast/utils/object_share.rb +1 -1
- data/lib/contrast/utils/os.rb +1 -1
- data/lib/contrast/utils/patching/policy/patch_utils.rb +2 -2
- data/lib/contrast/utils/request_utils.rb +2 -2
- data/lib/contrast/utils/sha256_builder.rb +4 -4
- data/lib/contrast/utils/stack_trace_utils.rb +31 -13
- data/lib/contrast/utils/telemetry.rb +22 -7
- data/lib/contrast/utils/telemetry_client.rb +27 -15
- data/lib/contrast/utils/telemetry_hash.rb +41 -0
- data/lib/contrast/utils/telemetry_identifier.rb +18 -3
- data/lib/contrast/utils/timer.rb +1 -1
- data/lib/contrast.rb +9 -0
- data/resources/assess/policy.json +1 -1
- data/ruby-agent.gemspec +1 -1
- data/service_executables/VERSION +1 -1
- data/service_executables/linux/contrast-service +0 -0
- data/service_executables/mac/contrast-service +0 -0
- metadata +41 -16
- data/lib/contrast/agent/telemetry/events/metric_telemetry_event.rb +0 -26
- data/lib/contrast/agent/telemetry/events/startup_metrics_telemetry_event.rb +0 -121
- data/lib/contrast/agent/telemetry/events/telemetry_event.rb +0 -33
- data/lib/contrast/agent/telemetry/telemetry.rb +0 -150
- data/lib/contrast/utils/exclude_key.rb +0 -20
@@ -6,25 +6,12 @@ require 'protobuf/message'
|
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Api
|
9
|
-
module
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
::Protobuf::Enum.define(:SUSPICIOUS, 6)
|
14
|
-
|
15
|
-
def self.included klass
|
16
|
-
klass.extend(ClassMethods)
|
17
|
-
end
|
18
|
-
|
19
|
-
# Used to add class methods to the class on inclusion of the decorator
|
20
|
-
module ClassMethods
|
21
|
-
def build
|
22
|
-
new
|
23
|
-
end
|
9
|
+
module Dtm
|
10
|
+
class AttackResult < ::Protobuf::Message
|
11
|
+
class ResponseType < ::Protobuf::Enum
|
12
|
+
define :SUSPICIOUS, 6
|
24
13
|
end
|
25
14
|
end
|
26
15
|
end
|
27
16
|
end
|
28
17
|
end
|
29
|
-
|
30
|
-
Contrast::Api::Dtm::AttackResult::ResponseType.include(Contrast::Api::Decorators::ResponseType)
|
@@ -75,7 +75,7 @@ module Contrast
|
|
75
75
|
|
76
76
|
# Insert ourselves into the application, keeping our middleware at the outermost layer of the onion
|
77
77
|
def insert_middleware app
|
78
|
-
app.middleware.insert_before
|
78
|
+
app.middleware.insert_before(0, Contrast::Agent::Middleware)
|
79
79
|
end
|
80
80
|
|
81
81
|
def enable_tracepoint
|
@@ -28,6 +28,12 @@ module Contrast
|
|
28
28
|
CONTRAST_NAME = 'Contrast Agent'
|
29
29
|
|
30
30
|
class Interface # :nodoc:
|
31
|
+
SESSION_VARIABLES = 'Invalid configuration. '\
|
32
|
+
"Setting both application.session_id and application.session_metadata is not allowed.\n"
|
33
|
+
API_URL = "Invalid configuration. Missing a required connection value 'url' is not set."
|
34
|
+
API_KEY = "Invalid configuration. Missing a required connection value 'api_key' is not set."
|
35
|
+
API_SERVICE_KEY = "Invalid configuration. Missing a required connection value 'service_tag' is not set."
|
36
|
+
API_USERNAME = "Invalid configuration. Missing a required connection value 'user_name' is not set."
|
31
37
|
def initialize
|
32
38
|
build
|
33
39
|
end
|
@@ -72,14 +78,21 @@ module Contrast
|
|
72
78
|
@config.loggable
|
73
79
|
end
|
74
80
|
|
81
|
+
# Typically, this would be accessed through Contrast::SETTINGS, but we're specifically checking for the user
|
82
|
+
# provided value here rather than that echoed back by TeamServer.
|
83
|
+
#
|
84
|
+
# @return [String,nil] the value of the session id set in the configuration, or nil if unset
|
85
|
+
def session_id
|
86
|
+
root.application.session_id
|
87
|
+
end
|
88
|
+
|
89
|
+
# @return [String,nil] the value of the session metadata set in the configuration, or nil if unset
|
90
|
+
def session_metadata
|
91
|
+
root.application.session_metadata
|
92
|
+
end
|
93
|
+
|
75
94
|
private
|
76
95
|
|
77
|
-
SESSION_VARIABLES = 'Invalid configuration. '\
|
78
|
-
"Setting both application.session_id and application.session_metadata is not allowed.\n"
|
79
|
-
API_URL = "Invalid configuration. Missing a required connection value 'url' is not set."
|
80
|
-
API_KEY = "Invalid configuration. Missing a required connection value 'api_key' is not set."
|
81
|
-
API_SERVICE_KEY = "Invalid configuration. Missing a required connection value 'service_tag' is not set."
|
82
|
-
API_USERNAME = "Invalid configuration. Missing a required connection value 'user_name' is not set."
|
83
96
|
# The config has information about how to construct the logger. If the config is invalid, and you want to know
|
84
97
|
# about it, then you have a circular dependency if you try to log it, so we use basic proto_logger to do this
|
85
98
|
# job.
|
@@ -127,28 +140,6 @@ module Contrast
|
|
127
140
|
end
|
128
141
|
end
|
129
142
|
|
130
|
-
# Typically, this would be accessed through
|
131
|
-
# Contrast::Components::AppContext, but we're too early in the
|
132
|
-
# initialization of the Agent to use that mechanism, so we look it up
|
133
|
-
# directly for ourselves
|
134
|
-
#
|
135
|
-
# @return [String,nil] the value of the session id set in the
|
136
|
-
# configuration, or nil if unset
|
137
|
-
def session_id
|
138
|
-
root.application.session_id
|
139
|
-
end
|
140
|
-
|
141
|
-
# Typically, this would be accessed through
|
142
|
-
# Contrast::Components::AppContext, but we're too early in the
|
143
|
-
# initialization of the Agent to use that mechanism, so we look it up
|
144
|
-
# directly for ourselves
|
145
|
-
#
|
146
|
-
# @return [String,nil] the value of the session metadata set in the
|
147
|
-
# configuration, or nil if unset
|
148
|
-
def session_metadata
|
149
|
-
root.application.session_metadata
|
150
|
-
end
|
151
|
-
|
152
143
|
# Typically, the following values would be accessed through Contrast::Components::AppContext
|
153
144
|
# and Contrast::Components::API, but we're too early in the initialization of the Agent to use
|
154
145
|
# that mechanism, so we look it up directly for ourselves.
|
@@ -18,7 +18,10 @@ module Contrast
|
|
18
18
|
DEFAULT_SERVICE_LEVEL = :TRACE
|
19
19
|
# The Rails ActionDispatch regexp for localhost IP + literal localhost
|
20
20
|
# https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/request.rb#L32
|
21
|
-
LOCALHOST = Regexp.union
|
21
|
+
LOCALHOST = Regexp.union([
|
22
|
+
/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, /^::1$/, /^0:0:0:0:0:0:0:1(%.*)?$/,
|
23
|
+
/^localhost$/
|
24
|
+
])
|
22
25
|
|
23
26
|
def use_bundled_service?
|
24
27
|
# Validates the config to decide if it's suitable for starting
|
@@ -38,6 +41,15 @@ module Contrast
|
|
38
41
|
@_use_agent_communication = true?(::Contrast::CONFIG.root.agent.service.bypass)
|
39
42
|
end
|
40
43
|
|
44
|
+
# If we're using the agent directly and not using protect, then there is no need to start the service. Because
|
45
|
+
# we only know this at startup when hardcoded as such (b/c TS could turn protect on otherwise), we can only do
|
46
|
+
# so when bypass is on and protect is off in local config
|
47
|
+
#
|
48
|
+
# @return [Boolean]
|
49
|
+
def unnecessary?
|
50
|
+
::Contrast::CONTRAST_SERVICE.use_agent_communication? && ::Contrast::PROTECT.forcibly_disabled?
|
51
|
+
end
|
52
|
+
|
41
53
|
def host
|
42
54
|
@_host ||=
|
43
55
|
(::Contrast::CONFIG.root.agent.service.host || Contrast::Config::ServiceConfiguration::DEFAULT_HOST).to_s
|
@@ -25,7 +25,7 @@ module Contrast
|
|
25
25
|
def sampling_control
|
26
26
|
@_sampling_control ||= begin
|
27
27
|
config_settings = ::Contrast::CONFIG.root.assess&.sampling
|
28
|
-
settings = ::Contrast::SETTINGS&.assess_state&.
|
28
|
+
settings = ::Contrast::SETTINGS&.assess_state&.sampling_settings
|
29
29
|
{
|
30
30
|
enabled: enabled?(config_settings, settings),
|
31
31
|
baseline: baseline(config_settings, settings),
|
@@ -86,6 +86,10 @@ module Contrast
|
|
86
86
|
# Rules to follow when using the masking. Each rules contains Id [String]
|
87
87
|
# and Keywords [Array<String>].
|
88
88
|
attr_reader :sensitive_data_masking
|
89
|
+
# @return [Integer] the time, in ms, that application settings last changed
|
90
|
+
attr_reader :last_app_update_ms
|
91
|
+
# @return [Integer] the time, in ms, that server settings last changed
|
92
|
+
attr_reader :last_server_update_ms
|
89
93
|
|
90
94
|
def initialize
|
91
95
|
reset_state
|
@@ -95,39 +99,31 @@ module Contrast
|
|
95
99
|
@application_state.exclusion_matchers.select(&:code?)
|
96
100
|
end
|
97
101
|
|
98
|
-
# @param
|
99
|
-
def update_from_server_features
|
100
|
-
if
|
101
|
-
|
102
|
-
log_file = server_features.log_file
|
103
|
-
log_level = server_features.log_level
|
104
|
-
Contrast::Logger::Log.instance.update(log_file, log_level) if log_file || log_level
|
105
|
-
@protect_state.enabled = server_features.protect.enabled?
|
106
|
-
@assess_state.enabled = server_features.assess.enabled?
|
107
|
-
@assess_state.sampling_settings = server_features.assess.sampling
|
102
|
+
# @param features_response [Contrast::Api::Settings::ServerFeatures, Contrast::Agent::Reporting::Response]
|
103
|
+
def update_from_server_features features_response
|
104
|
+
if features_response.cs__is_a?(Contrast::Agent::Reporting::Response)
|
105
|
+
update_from_response(features_response)
|
108
106
|
else
|
109
|
-
@protect_state.enabled =
|
110
|
-
@assess_state.enabled =
|
111
|
-
@assess_state.sampling_settings =
|
107
|
+
@protect_state.enabled = features_response.protect_enabled?
|
108
|
+
@assess_state.enabled = features_response.assess_enabled?
|
109
|
+
@assess_state.sampling_settings = features_response.assess.sampling
|
110
|
+
@last_server_update_ms = Contrast::Utils::Timer.now_ms
|
112
111
|
end
|
112
|
+
@last_server_update_ms = Contrast::Utils::Timer.now_ms
|
113
113
|
end
|
114
114
|
|
115
|
-
# @param
|
116
|
-
def update_from_application_settings
|
117
|
-
if
|
118
|
-
|
119
|
-
@application_state.modes_by_id = settings.protect.protection_rules_to_settings_hash
|
120
|
-
# TODO: RUBY-1438 this needs to be translated
|
121
|
-
# @application_state.exclusion_matchers = new_vals[:exclusion_matchers]
|
122
|
-
update_sensitive_data_policy(settings.sensitive_data_masking)
|
123
|
-
@assess_state.disabled_assess_rules = settings.assess.disabled_rules
|
124
|
-
@assess_state.session_id = settings.assess.session_id if settings.assess.session_id
|
115
|
+
# @param settings_response [Contrast::Api::Settings::ApplicationSettings, Contrast::Agent::Reporting::Response]
|
116
|
+
def update_from_application_settings settings_response
|
117
|
+
if settings_response&.cs__class == Contrast::Agent::Reporting::Response
|
118
|
+
update_from_response(settings_response)
|
125
119
|
else
|
126
|
-
new_vals =
|
120
|
+
new_vals = settings_response.application_state_translation
|
127
121
|
@application_state.modes_by_id = new_vals[:modes_by_id]
|
128
122
|
@application_state.exclusion_matchers = new_vals[:exclusion_matchers]
|
129
123
|
@assess_state.disabled_assess_rules = new_vals[:disabled_assess_rules]
|
124
|
+
@last_app_update_ms = Contrast::Utils::Timer.now_ms
|
130
125
|
end
|
126
|
+
@last_app_update_ms = Contrast::Utils::Timer.now_ms
|
131
127
|
end
|
132
128
|
|
133
129
|
# Wipe state to zero.
|
@@ -174,6 +170,44 @@ module Contrast
|
|
174
170
|
|
175
171
|
private
|
176
172
|
|
173
|
+
# @param response [Contrast::Agent::Reporting::Response]
|
174
|
+
def update_from_response response
|
175
|
+
if (server_features = response.server_features)
|
176
|
+
update_server_features(server_features)
|
177
|
+
end
|
178
|
+
return unless (app_settings = response.application_settings)
|
179
|
+
|
180
|
+
update_application_settings(app_settings)
|
181
|
+
end
|
182
|
+
|
183
|
+
# @param server_features [Contrast::Agent::Reporting::Settings::FeatureSettings]
|
184
|
+
def update_server_features server_features
|
185
|
+
return unless server_features
|
186
|
+
|
187
|
+
log_file = server_features.log_file
|
188
|
+
log_level = server_features.log_level
|
189
|
+
Contrast::Logger::Log.instance.update(log_file, log_level) if log_file || log_level
|
190
|
+
@protect_state.enabled = server_features.protect.enabled?
|
191
|
+
@assess_state.enabled = server_features.assess.enabled?
|
192
|
+
@assess_state.sampling_settings = server_features.assess.sampling
|
193
|
+
@last_server_update_ms = Contrast::Utils::Timer.now_ms
|
194
|
+
end
|
195
|
+
|
196
|
+
# @param app_settings [Contrast::Agent::Reporting::Settings::ApplicationSettings]
|
197
|
+
def update_application_settings app_settings
|
198
|
+
return unless app_settings
|
199
|
+
|
200
|
+
@application_state.modes_by_id = app_settings.protect.protection_rules_to_settings_hash
|
201
|
+
# TODO: RUBY-1438 this needs to be translated
|
202
|
+
# @application_state.exclusion_matchers = new_vals[:exclusion_matchers]
|
203
|
+
update_sensitive_data_policy(app_settings.sensitive_data_masking)
|
204
|
+
@assess_state.disabled_assess_rules = app_settings.assess.disabled_rules
|
205
|
+
if app_settings.assess.session_id && !app_settings.assess.session_id.blank?
|
206
|
+
@assess_state.session_id = app_settings.assess.session_id
|
207
|
+
end
|
208
|
+
@last_app_update_ms = Contrast::Utils::Timer.now_ms
|
209
|
+
end
|
210
|
+
|
177
211
|
# check if settings are empty and return true if so.
|
178
212
|
#
|
179
213
|
# @param settings [String, Boolean, Array, Hash]
|
@@ -9,23 +9,33 @@ require 'contrast/config/api_configuration'
|
|
9
9
|
|
10
10
|
module Contrast
|
11
11
|
module Config
|
12
|
-
# Common Configuration settings. Those in this section pertain to the
|
13
|
-
|
14
|
-
|
12
|
+
# Common Configuration settings. Those in this section pertain to the core functionality of the Agent.
|
13
|
+
class AgentConfiguration
|
14
|
+
include Contrast::Config::BaseConfiguration
|
15
|
+
|
15
16
|
# @return [Boolean, nil]
|
16
17
|
attr_accessor :enable
|
17
18
|
# @return [Boolean, nil]
|
18
19
|
attr_accessor :omit_body
|
19
|
-
|
20
|
+
# @return [Contrast::Config::RubyConfiguration]
|
21
|
+
attr_writer :ruby
|
22
|
+
# @return [Contrast::Config::ServiceConfiguration]
|
23
|
+
attr_writer :service
|
24
|
+
# @return [ Contrast::Config::LoggerConfiguration]
|
25
|
+
attr_writer :logger
|
26
|
+
# @return [Contrast::Config::HeapDumpConfiguration]
|
27
|
+
attr_writer :heap_dump
|
20
28
|
|
21
29
|
def initialize hsh = {}
|
22
|
-
|
23
|
-
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
30
|
+
return unless hsh
|
31
|
+
|
32
|
+
@enable = hsh[:enable]
|
33
|
+
@start_bundled_service = hsh[:start_bundled_service]
|
34
|
+
@omit_body = hsh[:omit_body]
|
35
|
+
@service = Contrast::Config::ServiceConfiguration.new(hsh[:service])
|
36
|
+
@logger = Contrast::Config::LoggerConfiguration.new(hsh[:logger])
|
37
|
+
@ruby = Contrast::Config::RubyConfiguration.new(hsh[:ruby])
|
38
|
+
@heap_dump = Contrast::Config::HeapDumpConfiguration.new(hsh[:heap_dump])
|
29
39
|
end
|
30
40
|
|
31
41
|
# @return [Boolean, true]
|
@@ -8,7 +8,9 @@ require 'contrast/config/request_audit_configuration'
|
|
8
8
|
module Contrast
|
9
9
|
module Config
|
10
10
|
# Api keys configuration
|
11
|
-
class ApiConfiguration
|
11
|
+
class ApiConfiguration
|
12
|
+
include Contrast::Config::BaseConfiguration
|
13
|
+
|
12
14
|
# @return [String]
|
13
15
|
attr_accessor :api_key
|
14
16
|
# @return [String]
|
@@ -20,13 +22,15 @@ module Contrast
|
|
20
22
|
DEFAULT_URL = 'https://app.contrastsecurity.com/Contrast'
|
21
23
|
|
22
24
|
def initialize hsh = {}
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
25
|
+
return unless hsh
|
26
|
+
|
27
|
+
@api_key = hsh[:api_key]
|
28
|
+
@url = hsh[:url]
|
29
|
+
@user_name = hsh[:user_name]
|
30
|
+
@service_key = hsh[:service_key]
|
31
|
+
@proxy = Contrast::Config::ApiProxyConfiguration.new(hsh[:proxy])
|
32
|
+
@request_audit = Contrast::Config::RequestAuditConfiguration.new(hsh[:request_audit])
|
33
|
+
@certificate = Contrast::Config::CertificationConfiguration.new(hsh[:certificate])
|
30
34
|
end
|
31
35
|
|
32
36
|
def url
|
@@ -4,14 +4,18 @@
|
|
4
4
|
module Contrast
|
5
5
|
module Config
|
6
6
|
# Api Proxy keys configuration
|
7
|
-
class ApiProxyConfiguration
|
7
|
+
class ApiProxyConfiguration
|
8
|
+
include Contrast::Config::BaseConfiguration
|
9
|
+
|
8
10
|
# @return [String] proxy url
|
9
11
|
attr_accessor :url
|
10
12
|
attr_writer :enable
|
11
13
|
|
12
14
|
def initialize hsh = {}
|
13
|
-
|
14
|
-
|
15
|
+
return unless hsh
|
16
|
+
|
17
|
+
@enable = hsh[:enable]
|
18
|
+
@url = hsh[:url]
|
15
19
|
end
|
16
20
|
|
17
21
|
# @return [Boolean, false]
|
@@ -7,7 +7,9 @@ module Contrast
|
|
7
7
|
module Config
|
8
8
|
# Common Configuration settings. Those in this section pertain to the
|
9
9
|
# application identification functionality of the Agent.
|
10
|
-
class ApplicationConfiguration
|
10
|
+
class ApplicationConfiguration
|
11
|
+
include Contrast::Config::BaseConfiguration
|
12
|
+
|
11
13
|
# @return [String]
|
12
14
|
attr_accessor :name
|
13
15
|
# @return [String]
|
@@ -27,16 +29,18 @@ module Contrast
|
|
27
29
|
attr_writer :session_id, :session_metadata
|
28
30
|
|
29
31
|
def initialize hsh = {}
|
30
|
-
|
31
|
-
|
32
|
-
@
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@
|
32
|
+
return unless hsh
|
33
|
+
|
34
|
+
@name = hsh[:name]
|
35
|
+
@version = hsh[:version]
|
36
|
+
@language = hsh[:language]
|
37
|
+
@path = hsh[:path]
|
38
|
+
@group = hsh[:group]
|
39
|
+
@tags = hsh[:tags]
|
40
|
+
@code = hsh[:code]
|
41
|
+
@metadata = hsh[:metadata]
|
42
|
+
@session_id = hsh[:session_id]
|
43
|
+
@session_metadata = hsh[:session_metadata]
|
40
44
|
end
|
41
45
|
|
42
46
|
# @return [String, Contrast::Utils::ObjectShare::EMPTY_STRING]
|
@@ -5,7 +5,9 @@ module Contrast
|
|
5
5
|
module Config
|
6
6
|
# Common Configuration settings. Those in this section pertain to the
|
7
7
|
# assess functionality of the Agent.
|
8
|
-
class AssessConfiguration
|
8
|
+
class AssessConfiguration
|
9
|
+
include Contrast::Config::BaseConfiguration
|
10
|
+
|
9
11
|
# @return [String, nil]
|
10
12
|
attr_accessor :tags
|
11
13
|
# @return [Boolean, nil]
|
@@ -15,14 +17,16 @@ module Contrast
|
|
15
17
|
DEFAULT_STACKTRACES = 'ALL'
|
16
18
|
|
17
19
|
def initialize hsh = {}
|
18
|
-
|
19
|
-
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
20
|
+
return unless hsh
|
21
|
+
|
22
|
+
@enable = hsh[:enable]
|
23
|
+
@tags = hsh[:tags]
|
24
|
+
@enable_scan_response = hsh[:enable_scan_response]
|
25
|
+
@enable_dynamic_sources = hsh[:enable_dynamic_sources]
|
26
|
+
@enable_original_object = hsh[:enable_original_object]
|
27
|
+
@sampling = Contrast::Config::SamplingConfiguration.new(hsh[:sampling])
|
28
|
+
@rules = Contrast::Config::AssessRulesConfiguration.new(hsh[:rules])
|
29
|
+
@stacktraces = hsh[:stacktraces]
|
26
30
|
end
|
27
31
|
|
28
32
|
# @return [Boolean, true]
|
@@ -5,13 +5,17 @@ module Contrast
|
|
5
5
|
module Config
|
6
6
|
# Common Configuration settings. Those in this section pertain to the
|
7
7
|
# disabled assess rule functionality of the Agent.
|
8
|
-
class AssessRulesConfiguration
|
8
|
+
class AssessRulesConfiguration
|
9
|
+
include Contrast::Config::BaseConfiguration
|
10
|
+
|
9
11
|
SPEC_KEY = :disabled_rules.cs__freeze
|
10
12
|
# @return [Array, nil] list of disabled assess rules
|
11
13
|
attr_accessor :disabled_rules
|
12
14
|
|
13
15
|
def initialize hsh = {}
|
14
|
-
|
16
|
+
return unless hsh
|
17
|
+
|
18
|
+
@disabled_rules = cast_disabled_rules(hsh)
|
15
19
|
end
|
16
20
|
|
17
21
|
private
|
@@ -6,20 +6,11 @@ require 'contrast/utils/object_share'
|
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Config
|
9
|
-
# This is the base for our configuration classes. It is intended to
|
10
|
-
#
|
11
|
-
|
12
|
-
class BaseConfiguration
|
9
|
+
# This is the base for our configuration classes. It is intended to facilitate the translation of the Common
|
10
|
+
# Configuration settings to usable Ruby classes.
|
11
|
+
module BaseConfiguration
|
13
12
|
extend Forwardable
|
14
13
|
|
15
|
-
EMPTY_VALUE = :EMPTY_VALUE
|
16
|
-
|
17
|
-
def initialize hsh = {}, keys = {}
|
18
|
-
# holds configuration key value pairs
|
19
|
-
# each configuration class can contain nested BaseConfigurations
|
20
|
-
traverse_config(hsh, keys)
|
21
|
-
end
|
22
|
-
|
23
14
|
def to_hash
|
24
15
|
hsh = {}
|
25
16
|
instance_variables.each do |iv|
|
@@ -42,29 +33,6 @@ module Contrast
|
|
42
33
|
end
|
43
34
|
nil
|
44
35
|
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# Traverse the given entity to build out the configuration graph.
|
49
|
-
#
|
50
|
-
# The values will be either a hash, indicating internal nodes to
|
51
|
-
# traverse, or a value to set or the EMPTY_VALUE symbol, indicating a
|
52
|
-
# leaf node.
|
53
|
-
#
|
54
|
-
# The spec_key are the Contrast defined keys based on the instance variables of
|
55
|
-
# a given configuration.
|
56
|
-
def traverse_config values, spec_key
|
57
|
-
internal_nodes = values.cs__respond_to?(:has_key?)
|
58
|
-
val = internal_nodes ? value_from_key_config(spec_key, values) : nil
|
59
|
-
val == EMPTY_VALUE ? nil : val
|
60
|
-
end
|
61
|
-
|
62
|
-
def value_from_key_config key, config_hash
|
63
|
-
return config_hash[key] if config_hash.key?(key)
|
64
|
-
return config_hash.fetch(key.to_sym, nil) if key.is_a?(String)
|
65
|
-
|
66
|
-
config_hash.fetch(key.to_s, nil)
|
67
|
-
end
|
68
36
|
end
|
69
37
|
end
|
70
38
|
end
|
@@ -4,7 +4,9 @@
|
|
4
4
|
module Contrast
|
5
5
|
module Config
|
6
6
|
# Certificate Configuration
|
7
|
-
class CertificationConfiguration
|
7
|
+
class CertificationConfiguration
|
8
|
+
include Contrast::Config::BaseConfiguration
|
9
|
+
|
8
10
|
# @return [String] path to CA Cert file
|
9
11
|
attr_accessor :ca_file
|
10
12
|
# @return [String] path to Certification file
|
@@ -14,10 +16,12 @@ module Contrast
|
|
14
16
|
attr_writer :enable
|
15
17
|
|
16
18
|
def initialize hsh = {}
|
17
|
-
|
18
|
-
|
19
|
-
@
|
20
|
-
@
|
19
|
+
return unless hsh
|
20
|
+
|
21
|
+
@enable = hsh[:enable]
|
22
|
+
@ca_file = hsh[:ca_file]
|
23
|
+
@cert_file = hsh[:cert_file]
|
24
|
+
@key_file = hsh[:key_file]
|
21
25
|
end
|
22
26
|
|
23
27
|
# @return [Boolean, false]
|
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
module Contrast
|
5
5
|
module Config
|
6
|
-
# Common Configuration settings. Those in this section pertain to the
|
7
|
-
#
|
8
|
-
|
9
|
-
|
6
|
+
# Common Configuration settings. Those in this section pertain to the exception handling in Ruby, allowing for the
|
7
|
+
# override of Response Code and Message when Security Exceptions are raised.
|
8
|
+
class ExceptionConfiguration
|
9
|
+
include Contrast::Config::BaseConfiguration
|
10
|
+
|
10
11
|
# @return [Integer] the HTTP status code override
|
11
12
|
attr_accessor :override_status
|
12
13
|
# @return [String] the message text override
|
@@ -14,9 +15,11 @@ module Contrast
|
|
14
15
|
attr_writer :capture
|
15
16
|
|
16
17
|
def initialize hsh = {}
|
17
|
-
|
18
|
-
|
19
|
-
@
|
18
|
+
return unless hsh
|
19
|
+
|
20
|
+
@capture = hsh[:capture]
|
21
|
+
@override_status = hsh[:override_status]
|
22
|
+
@override_message = hsh[:override_message]
|
20
23
|
end
|
21
24
|
|
22
25
|
# @return [Boolean, false]
|
@@ -3,9 +3,11 @@
|
|
3
3
|
|
4
4
|
module Contrast
|
5
5
|
module Config
|
6
|
-
# Common Configuration settings. Those in this section pertain to the
|
7
|
-
#
|
8
|
-
class HeapDumpConfiguration
|
6
|
+
# Common Configuration settings. Those in this section pertain to the Heap Dump collection functionality of the
|
7
|
+
# Agent.
|
8
|
+
class HeapDumpConfiguration
|
9
|
+
include Contrast::Config::BaseConfiguration
|
10
|
+
|
9
11
|
DEFAULT_PATH = 'contrast_heap_dumps' # saved
|
10
12
|
DEFAULT_MS = 10_000
|
11
13
|
DEFAULT_COUNT = 5
|
@@ -13,12 +15,14 @@ module Contrast
|
|
13
15
|
attr_writer :enable, :path, :delay_ms, :window_ms, :count, :clean
|
14
16
|
|
15
17
|
def initialize hsh = {}
|
16
|
-
|
17
|
-
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
18
|
+
return unless hsh
|
19
|
+
|
20
|
+
@enable = hsh[:enable]
|
21
|
+
@path = hsh[:path]
|
22
|
+
@delay_ms = hsh[:delay_ms]
|
23
|
+
@window_ms = hsh[:window_ms]
|
24
|
+
@count = hsh[:count]
|
25
|
+
@clean = hsh[:clean]
|
22
26
|
end
|
23
27
|
|
24
28
|
# @return [Boolean, Contrast::Utils::ObjectShare::FALSE] should dumps be taken
|
@@ -3,17 +3,20 @@
|
|
3
3
|
|
4
4
|
module Contrast
|
5
5
|
module Config
|
6
|
-
# Common Configuration settings. Those in this section pertain to the
|
7
|
-
|
8
|
-
|
6
|
+
# Common Configuration settings. Those in this section pertain to the inventory functionality of the Agent.
|
7
|
+
class InventoryConfiguration
|
8
|
+
include Contrast::Config::BaseConfiguration
|
9
|
+
|
9
10
|
# @return [Array, nil] tags
|
10
11
|
attr_accessor :tags
|
11
12
|
attr_writer :enable, :analyze_libraries
|
12
13
|
|
13
14
|
def initialize hsh = {}
|
14
|
-
|
15
|
-
|
16
|
-
@
|
15
|
+
return unless hsh
|
16
|
+
|
17
|
+
@enable = hsh[:enable]
|
18
|
+
@analyze_libraries = hsh[:analyze_libraries]
|
19
|
+
@tags = hsh[:tags]
|
17
20
|
end
|
18
21
|
|
19
22
|
# @return [Boolean, true]
|