contrast-agent 3.13.2 → 3.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/contrast_service +1 -7
- data/ext/cs__assess_active_record_named/cs__active_record_named.c +8 -7
- data/ext/cs__assess_array/cs__assess_array.c +6 -5
- data/ext/cs__assess_basic_object/cs__assess_basic_object.c +5 -5
- data/ext/cs__assess_fiber_track/cs__assess_fiber_track.c +2 -1
- data/ext/cs__assess_hash/cs__assess_hash.c +18 -17
- data/ext/cs__assess_hash/cs__assess_hash.h +2 -1
- data/ext/cs__assess_kernel/cs__assess_kernel.c +7 -8
- data/ext/cs__assess_marshal_module/cs__assess_marshal_module.c +4 -5
- data/ext/cs__assess_module/cs__assess_module.c +6 -6
- data/ext/cs__assess_regexp/cs__assess_regexp.c +4 -4
- data/ext/cs__assess_string/cs__assess_string.c +20 -4
- data/ext/cs__assess_string/cs__assess_string.h +4 -1
- data/ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c +4 -2
- data/ext/cs__assess_yield_track/cs__assess_yield_track.c +2 -2
- data/ext/cs__common/cs__common.c +44 -37
- data/ext/cs__common/cs__common.h +15 -20
- data/ext/cs__contrast_patch/cs__contrast_patch.c +27 -25
- data/ext/cs__contrast_patch/cs__contrast_patch.h +5 -7
- data/ext/cs__protect_kernel/cs__protect_kernel.c +11 -12
- data/ext/cs__protect_kernel/cs__protect_kernel.h +2 -2
- data/lib/contrast-agent.rb +1 -1
- data/lib/contrast.rb +13 -23
- data/lib/contrast/agent.rb +39 -39
- data/lib/contrast/agent/assess.rb +11 -12
- data/lib/contrast/agent/assess/contrast_event.rb +11 -9
- data/lib/contrast/agent/assess/events/event_factory.rb +2 -2
- data/lib/contrast/agent/assess/events/source_event.rb +2 -2
- data/lib/contrast/agent/assess/finalizers/finalize.rb +21 -0
- data/lib/contrast/agent/assess/finalizers/freeze.rb +13 -0
- data/lib/contrast/agent/assess/finalizers/hash.rb +53 -0
- data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +1 -1
- data/lib/contrast/agent/assess/policy/patcher.rb +5 -5
- data/lib/contrast/agent/assess/policy/policy.rb +9 -9
- data/lib/contrast/agent/assess/policy/policy_node.rb +2 -2
- data/lib/contrast/agent/assess/policy/policy_scanner.rb +3 -3
- data/lib/contrast/agent/assess/policy/preshift.rb +15 -5
- data/lib/contrast/agent/assess/policy/propagation_method.rb +25 -22
- data/lib/contrast/agent/assess/policy/propagation_node.rb +2 -2
- data/lib/contrast/agent/assess/policy/propagator.rb +18 -18
- data/lib/contrast/agent/assess/policy/propagator/custom.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/database_write.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/match_data.rb +3 -2
- data/lib/contrast/agent/assess/policy/propagator/prepend.rb +5 -0
- data/lib/contrast/agent/assess/policy/propagator/split.rb +4 -4
- data/lib/contrast/agent/assess/policy/propagator/substitution.rb +5 -4
- data/lib/contrast/agent/assess/policy/rewriter_patch.rb +5 -5
- data/lib/contrast/agent/assess/policy/source_method.rb +5 -14
- data/lib/contrast/agent/assess/policy/source_validation/cross_site_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_validation/source_validation.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger/xpath.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +5 -5
- data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -3
- data/lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb +2 -2
- data/lib/contrast/agent/assess/properties.rb +13 -5
- data/lib/contrast/agent/assess/property/evented.rb +2 -2
- data/lib/contrast/agent/assess/property/tagged.rb +4 -4
- data/lib/contrast/agent/assess/rule.rb +2 -2
- data/lib/contrast/agent/assess/rule/base.rb +3 -4
- data/lib/contrast/agent/assess/rule/provider.rb +3 -3
- data/lib/contrast/agent/assess/rule/provider/hardcoded_password.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +2 -2
- data/lib/contrast/agent/at_exit_hook.rb +1 -1
- data/lib/contrast/agent/class_reopener.rb +7 -6
- data/lib/contrast/agent/deadzone/policy/deadzone_node.rb +1 -1
- data/lib/contrast/agent/deadzone/policy/policy.rb +2 -2
- data/lib/contrast/agent/disable_reaction.rb +1 -1
- data/lib/contrast/agent/exclusion_matcher.rb +1 -1
- data/lib/contrast/agent/inventory/policy/datastores.rb +2 -2
- data/lib/contrast/agent/inventory/policy/policy.rb +3 -3
- data/lib/contrast/agent/inventory/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/middleware.rb +33 -32
- data/lib/contrast/agent/patching/policy/after_load_patch.rb +4 -4
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +6 -5
- data/lib/contrast/agent/patching/policy/module_policy.rb +1 -1
- data/lib/contrast/agent/patching/policy/patch.rb +15 -15
- data/lib/contrast/agent/patching/policy/patcher.rb +30 -22
- data/lib/contrast/agent/patching/policy/policy.rb +6 -6
- data/lib/contrast/agent/patching/policy/policy_node.rb +1 -1
- data/lib/contrast/agent/patching/policy/trigger_node.rb +2 -2
- data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +3 -3
- data/lib/contrast/agent/protect/policy/applies_deserialization_rule.rb +2 -2
- data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +2 -2
- data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +3 -3
- data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +2 -2
- data/lib/contrast/agent/protect/policy/applies_xxe_rule.rb +3 -3
- data/lib/contrast/agent/protect/policy/policy.rb +8 -8
- data/lib/contrast/agent/protect/policy/rule_applicator.rb +1 -1
- data/lib/contrast/agent/protect/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/protect/rule.rb +18 -18
- data/lib/contrast/agent/protect/rule/base.rb +4 -3
- data/lib/contrast/agent/protect/rule/base_service.rb +1 -1
- data/lib/contrast/agent/protect/rule/cmd_injection.rb +5 -5
- data/lib/contrast/agent/protect/rule/deserialization.rb +1 -1
- data/lib/contrast/agent/protect/rule/http_method_tampering.rb +1 -1
- data/lib/contrast/agent/protect/rule/no_sqli.rb +1 -1
- data/lib/contrast/agent/protect/rule/path_traversal.rb +4 -5
- data/lib/contrast/agent/protect/rule/sqli.rb +2 -2
- data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +1 -1
- data/lib/contrast/agent/protect/rule/xss.rb +1 -1
- data/lib/contrast/agent/protect/rule/xxe.rb +3 -5
- data/lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb +2 -2
- data/lib/contrast/agent/railtie.rb +1 -1
- data/lib/contrast/agent/reaction_processor.rb +2 -2
- data/lib/contrast/agent/request.rb +11 -9
- data/lib/contrast/agent/request_context.rb +10 -6
- data/lib/contrast/agent/response.rb +6 -6
- data/lib/contrast/agent/rewriter.rb +5 -6
- data/lib/contrast/agent/service_heartbeat.rb +2 -2
- data/lib/contrast/agent/static_analysis.rb +3 -3
- data/lib/contrast/agent/thread.rb +1 -1
- data/lib/contrast/agent/thread_watcher.rb +2 -2
- data/lib/contrast/agent/tracepoint_hook.rb +1 -1
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/api.rb +4 -4
- data/lib/contrast/api/communication.rb +9 -9
- data/lib/contrast/api/communication/messaging_queue.rb +2 -2
- data/lib/contrast/api/communication/response_processor.rb +1 -1
- data/lib/contrast/api/communication/socket_client.rb +5 -5
- data/lib/contrast/api/communication/speedracer.rb +1 -1
- data/lib/contrast/api/communication/tcp_socket.rb +1 -1
- data/lib/contrast/api/communication/unix_socket.rb +1 -1
- data/lib/contrast/api/decorators.rb +14 -14
- data/lib/contrast/api/decorators/address.rb +7 -6
- data/lib/contrast/api/decorators/application_settings.rb +3 -2
- data/lib/contrast/api/decorators/application_update.rb +5 -4
- data/lib/contrast/api/decorators/http_request.rb +13 -12
- data/lib/contrast/api/decorators/input_analysis.rb +3 -2
- data/lib/contrast/api/decorators/message.rb +3 -2
- data/lib/contrast/api/decorators/rasp_rule_sample.rb +2 -1
- data/lib/contrast/api/decorators/route_coverage.rb +3 -2
- data/lib/contrast/api/decorators/server_features.rb +3 -2
- data/lib/contrast/api/decorators/trace_event.rb +3 -2
- data/lib/contrast/api/decorators/trace_event_object.rb +6 -5
- data/lib/contrast/api/decorators/trace_event_signature.rb +5 -4
- data/lib/contrast/api/decorators/trace_taint_range.rb +4 -3
- data/lib/contrast/api/decorators/user_input.rb +4 -4
- data/lib/contrast/common_agent_configuration.rb +2 -2
- data/lib/contrast/components/agent.rb +2 -2
- data/lib/contrast/components/app_context.rb +1 -1
- data/lib/contrast/components/config.rb +4 -4
- data/lib/contrast/components/contrast_service.rb +1 -1
- data/lib/contrast/components/interface.rb +15 -15
- data/lib/contrast/components/logger.rb +1 -1
- data/lib/contrast/components/scope.rb +3 -3
- data/lib/contrast/config.rb +18 -18
- data/lib/contrast/config/base_configuration.rb +2 -2
- data/lib/contrast/config/protect_rule_configuration.rb +1 -1
- data/lib/contrast/configuration.rb +5 -5
- data/lib/contrast/extension/assess.rb +22 -21
- data/lib/contrast/extension/assess/array.rb +4 -4
- data/lib/contrast/extension/assess/assess_extension.rb +27 -29
- data/lib/contrast/extension/assess/eval_trigger.rb +3 -3
- data/lib/contrast/extension/assess/exec_trigger.rb +1 -1
- data/lib/contrast/extension/assess/fiber.rb +3 -3
- data/lib/contrast/extension/assess/hash.rb +5 -3
- data/lib/contrast/extension/assess/kernel.rb +7 -6
- data/lib/contrast/extension/assess/marshal.rb +62 -0
- data/lib/contrast/extension/assess/regexp.rb +3 -3
- data/lib/contrast/extension/assess/string.rb +5 -5
- data/lib/contrast/extension/inventory.rb +4 -4
- data/lib/contrast/extension/kernel.rb +1 -1
- data/lib/contrast/extension/module.rb +1 -1
- data/lib/contrast/extension/protect.rb +3 -3
- data/lib/contrast/extension/protect/kernel.rb +2 -2
- data/lib/contrast/extension/protect/psych.rb +2 -2
- data/lib/contrast/framework/manager.rb +7 -8
- data/lib/contrast/framework/rack/patch/session_cookie.rb +1 -1
- data/lib/contrast/framework/rack/patch/support.rb +1 -1
- data/lib/contrast/framework/rack/support.rb +2 -2
- data/lib/contrast/framework/rails/patch/assess_configuration.rb +2 -2
- data/lib/contrast/framework/rails/patch/rails_application_configuration.rb +1 -1
- data/lib/contrast/framework/rails/patch/support.rb +3 -3
- data/lib/contrast/framework/rails/rewrite/action_controller_railties_helper_inherited.rb +2 -2
- data/lib/contrast/framework/rails/rewrite/active_record_named.rb +2 -2
- data/lib/contrast/framework/rails/rewrite/active_record_time_zone_inherited.rb +2 -2
- data/lib/contrast/framework/rails/support.rb +62 -14
- data/lib/contrast/framework/sinatra/patch/base.rb +1 -1
- data/lib/contrast/framework/sinatra/patch/support.rb +1 -1
- data/lib/contrast/framework/sinatra/support.rb +2 -2
- data/lib/contrast/funchook/funchook.rb +1 -1
- data/lib/contrast/logger/application.rb +2 -2
- data/lib/contrast/logger/format.rb +22 -9
- data/lib/contrast/logger/log.rb +10 -8
- data/lib/contrast/logger/request.rb +30 -0
- data/lib/contrast/tasks/config.rb +1 -1
- data/lib/contrast/tasks/service.rb +2 -2
- data/lib/contrast/utils/assess/sampling_util.rb +2 -2
- data/lib/contrast/utils/assess/tracking_util.rb +1 -1
- data/lib/contrast/utils/boolean_util.rb +1 -1
- data/lib/contrast/utils/class_util.rb +2 -2
- data/lib/contrast/utils/freeze_util.rb +1 -1
- data/lib/contrast/utils/gemfile_reader.rb +5 -5
- data/lib/contrast/utils/hash_digest.rb +2 -1
- data/lib/contrast/utils/heap_dump_util.rb +2 -2
- data/lib/contrast/utils/invalid_configuration_util.rb +1 -1
- data/lib/contrast/utils/inventory_util.rb +4 -4
- data/lib/contrast/utils/io_util.rb +1 -1
- data/lib/contrast/utils/os.rb +1 -1
- data/lib/contrast/utils/ruby_ast_rewriter.rb +1 -1
- data/lib/contrast/utils/sha256_builder.rb +2 -2
- data/lib/contrast/utils/stack_trace_utils.rb +2 -2
- data/lib/contrast/utils/string_utils.rb +1 -1
- data/ruby-agent.gemspec +5 -5
- data/service_executables/VERSION +1 -1
- data/service_executables/linux/contrast-service +0 -0
- data/service_executables/mac/contrast-service +0 -0
- metadata +22 -19
- data/lib/contrast/agent/assess/insulator.rb +0 -49
- data/lib/contrast/agent/require_state.rb +0 -61
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require 'contrast/components/interface'
|
5
|
+
require 'contrast/extension/module'
|
6
|
+
require 'contrast/utils/class_util'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -59,7 +59,7 @@ module Contrast
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def instrument!
|
62
|
-
|
62
|
+
require instrumentation_file_path
|
63
63
|
if instrumenting_module
|
64
64
|
mod = Module.cs__const_get(instrumenting_module)
|
65
65
|
with_contrast_scope { mod.instrument } if mod
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require 'contrast/agent/patching/policy/after_load_patch'
|
5
|
+
require 'contrast/components/interface'
|
6
|
+
require 'contrast/framework/manager'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -36,6 +36,7 @@ module Contrast
|
|
36
36
|
Contrast::Extension::Assess::FiberPropagator.instrument_fiber_track
|
37
37
|
Contrast::Extension::Assess::HashPropagator.instrument_hash_track
|
38
38
|
Contrast::Extension::Assess::KernelPropagator.instrument_kernel_track
|
39
|
+
Contrast::Extension::Assess::MarshalPropagator.instrument_marshal_load
|
39
40
|
Contrast::Extension::Assess::RegexpPropagator.instrument_regexp_track
|
40
41
|
Contrast::Extension::Assess::StringPropagator.instrument_string
|
41
42
|
Contrast::Extension::Assess::StringPropagator.instrument_string_interpolation
|
@@ -64,8 +65,8 @@ module Contrast
|
|
64
65
|
# handling
|
65
66
|
def apply_require_patches!
|
66
67
|
@_apply_require_patches ||= begin
|
67
|
-
|
68
|
-
|
68
|
+
require 'contrast/extension/thread'
|
69
|
+
require 'contrast/extension/kernel'
|
69
70
|
true
|
70
71
|
rescue LoadError, StandardError => e
|
71
72
|
logger.error('failed instrumenting apply_require_patches!', e)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/agent/patching/policy/method_policy'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -1,26 +1,26 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'monitor'
|
5
|
+
require 'contrast/components/interface'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
require 'contrast/agent'
|
8
|
+
require 'contrast/logger/log'
|
9
|
+
require 'contrast/agent/patching/policy/method_policy'
|
10
|
+
require 'contrast/agent/patching/policy/patch_status'
|
11
|
+
require 'contrast/agent/patching/policy/trigger_node'
|
12
12
|
|
13
13
|
# assess
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
require 'contrast/agent/assess/policy/policy'
|
15
|
+
require 'contrast/agent/assess/policy/propagation_method'
|
16
|
+
require 'contrast/agent/assess/policy/source_method'
|
17
|
+
require 'contrast/agent/assess/policy/trigger_method'
|
18
18
|
|
19
19
|
# protect
|
20
|
-
|
20
|
+
require 'contrast/agent/protect/policy/policy'
|
21
21
|
|
22
22
|
# inventory
|
23
|
-
|
23
|
+
require 'contrast/agent/inventory/policy/policy'
|
24
24
|
|
25
25
|
module Contrast
|
26
26
|
module Agent
|
@@ -371,7 +371,7 @@ module Contrast
|
|
371
371
|
when :prepend
|
372
372
|
prepending_module = Module.new
|
373
373
|
prepending_module.send(:define_method, method_name, unbound_method.bind(target_module))
|
374
|
-
prepending_module.send(visibility,
|
374
|
+
prepending_module.send(visibility, method_name)
|
375
375
|
# This prepends to the singleton class (it patches a class method)
|
376
376
|
target_module.prepend prepending_module
|
377
377
|
end
|
@@ -414,4 +414,4 @@ module Contrast
|
|
414
414
|
end
|
415
415
|
end
|
416
416
|
|
417
|
-
|
417
|
+
require 'cs__contrast_patch/cs__contrast_patch'
|
@@ -1,36 +1,36 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'monitor'
|
5
5
|
|
6
6
|
# base
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
require 'contrast/agent/patching/policy/patch_status'
|
8
|
+
require 'contrast/agent/patching/policy/method_policy'
|
9
|
+
require 'contrast/agent/patching/policy/module_policy'
|
10
|
+
require 'contrast/components/interface'
|
11
|
+
require 'contrast/utils/class_util'
|
12
12
|
|
13
13
|
# assess
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
require 'contrast/agent/assess/policy/policy'
|
15
|
+
require 'contrast/agent/assess/policy/policy_scanner'
|
16
|
+
require 'contrast/agent/assess/policy/rewriter_patch'
|
17
|
+
require 'contrast/agent/assess/policy/source_method'
|
18
|
+
require 'contrast/agent/assess/policy/trigger_method'
|
19
19
|
|
20
20
|
# deadzone
|
21
|
-
|
21
|
+
require 'contrast/agent/deadzone/policy/policy'
|
22
22
|
|
23
23
|
# inventory
|
24
|
-
|
24
|
+
require 'contrast/agent/inventory/policy/policy'
|
25
25
|
|
26
26
|
# protect
|
27
|
-
|
27
|
+
require 'contrast/agent/protect/policy/policy'
|
28
28
|
|
29
29
|
# patch
|
30
|
-
|
30
|
+
require 'contrast/agent/patching/policy/patch'
|
31
31
|
|
32
32
|
# after load patched
|
33
|
-
|
33
|
+
require 'contrast/agent/patching/policy/after_load_patcher'
|
34
34
|
|
35
35
|
module Contrast
|
36
36
|
module Agent
|
@@ -247,6 +247,14 @@ module Contrast
|
|
247
247
|
instance_methods.concat(mod.private_instance_methods(false)) if private
|
248
248
|
# initialize is an exception to the inheritance rule.
|
249
249
|
instance_methods << :initialize unless instance_methods.include?(:initialize)
|
250
|
+
# Object owns these, but we don't want to patch every :dup or
|
251
|
+
# :clone, just the ones on String, so we'll special case this.
|
252
|
+
# This breaks the norm, where we usually instrument the lowest
|
253
|
+
# method possible.
|
254
|
+
if mod == String
|
255
|
+
instance_methods << :clone
|
256
|
+
instance_methods << :dup
|
257
|
+
end
|
250
258
|
instance_methods
|
251
259
|
end
|
252
260
|
|
@@ -298,10 +306,10 @@ module Contrast
|
|
298
306
|
end
|
299
307
|
|
300
308
|
# core extensions
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
309
|
+
require 'contrast/extension/module'
|
310
|
+
require 'contrast/extension/assess'
|
311
|
+
require 'contrast/extension/inventory'
|
312
|
+
require 'contrast/extension/protect'
|
313
|
+
require 'contrast/extension/protect/kernel'
|
306
314
|
|
307
|
-
|
315
|
+
require 'cs__contrast_patch/cs__contrast_patch'
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'json'
|
5
|
+
require 'singleton'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
require 'contrast'
|
8
|
+
require 'contrast/components/interface'
|
9
|
+
require 'contrast/agent/patching/policy/module_policy'
|
10
|
+
require 'contrast/agent/patching/policy/method_policy'
|
11
11
|
|
12
12
|
module Contrast
|
13
13
|
module Agent
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/components/interface'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'contrast/extension/module'
|
5
|
+
require 'contrast/agent/patching/policy/policy_node'
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Agent
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require 'contrast/agent/protect/rule/cmd_injection'
|
5
|
+
require 'contrast/agent/protect/policy/applies_deserialization_rule'
|
6
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'contrast/agent/protect/rule/deserialization'
|
5
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Agent
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'contrast/agent/protect/rule/no_sqli'
|
5
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Agent
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require 'contrast/agent/protect/rule/path_traversal'
|
5
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
6
|
+
require 'contrast/utils/object_share'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'contrast/agent/protect/rule/sqli'
|
5
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
6
6
|
|
7
7
|
module Contrast
|
8
8
|
module Agent
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require 'contrast/agent/protect/rule/xxe'
|
5
|
+
require 'contrast/agent/protect/policy/rule_applicator'
|
6
|
+
require 'contrast/utils/object_share'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/agent/patching/policy/policy'
|
5
5
|
|
6
6
|
# classes required by patches in the policy
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
require 'contrast/agent/protect/policy/applies_command_injection_rule'
|
8
|
+
require 'contrast/agent/protect/policy/applies_deserialization_rule'
|
9
|
+
require 'contrast/agent/protect/policy/applies_no_sqli_rule'
|
10
|
+
require 'contrast/agent/protect/policy/applies_path_traversal_rule'
|
11
|
+
require 'contrast/agent/protect/policy/applies_sqli_rule'
|
12
|
+
require 'contrast/agent/protect/policy/applies_xxe_rule'
|
13
|
+
require 'contrast/agent/protect/policy/trigger_node'
|
14
14
|
|
15
15
|
module Contrast
|
16
16
|
module Agent
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/components/interface'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/agent/patching/policy/trigger_node'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -15,39 +15,39 @@ module Contrast
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# The classes required for All Rasp Rules
|
18
|
-
|
19
|
-
|
18
|
+
require 'contrast/agent/protect/rule/base'
|
19
|
+
require 'contrast/agent/protect/rule/base_service'
|
20
20
|
|
21
21
|
# The classes required for the XSS Rasp Rule
|
22
|
-
|
22
|
+
require 'contrast/agent/protect/rule/xss'
|
23
23
|
|
24
24
|
# The classes required for the SQLI
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
require 'contrast/agent/protect/rule/default_scanner'
|
26
|
+
require 'contrast/agent/protect/rule/sqli'
|
27
|
+
require 'contrast/agent/protect/rule/sqli/default_sql_scanner'
|
28
|
+
require 'contrast/agent/protect/rule/sqli/mysql_sql_scanner'
|
29
|
+
require 'contrast/agent/protect/rule/sqli/postgres_sql_scanner'
|
30
|
+
require 'contrast/agent/protect/rule/sqli/sqlite_sql_scanner'
|
31
31
|
|
32
32
|
# The classes required for Path Traversal
|
33
|
-
|
33
|
+
require 'contrast/agent/protect/rule/path_traversal'
|
34
34
|
|
35
35
|
# The classes required for Command Injection
|
36
|
-
|
36
|
+
require 'contrast/agent/protect/rule/cmd_injection'
|
37
37
|
|
38
38
|
# The classes required for XXE
|
39
|
-
|
40
|
-
|
39
|
+
require 'contrast/agent/protect/rule/xxe'
|
40
|
+
require 'contrast/agent/protect/rule/xxe/entity_wrapper'
|
41
41
|
|
42
42
|
# The classes required for Untrusted Deserialization
|
43
|
-
|
43
|
+
require 'contrast/agent/protect/rule/deserialization'
|
44
44
|
|
45
45
|
# The classes required for the NoSQLi
|
46
|
-
|
47
|
-
|
46
|
+
require 'contrast/agent/protect/rule/no_sqli'
|
47
|
+
require 'contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner'
|
48
48
|
|
49
49
|
# The classes required for Http Method Tampering
|
50
|
-
|
50
|
+
require 'contrast/agent/protect/rule/http_method_tampering'
|
51
51
|
|
52
52
|
# The classes required for Unsafe File Upload
|
53
|
-
|
53
|
+
require 'contrast/agent/protect/rule/unsafe_file_upload'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'contrast/components/interface'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -184,9 +184,10 @@ module Contrast
|
|
184
184
|
end
|
185
185
|
|
186
186
|
def update_successful_attack_response context, ia_result, result, attack_string = nil
|
187
|
-
|
187
|
+
case mode
|
188
|
+
when Contrast::Api::Settings::ProtectionRule::Mode::MONITOR
|
188
189
|
result.response = Contrast::Api::Dtm::AttackResult::ResponseType::MONITORED
|
189
|
-
|
190
|
+
when Contrast::Api::Settings::ProtectionRule::Mode::BLOCK
|
190
191
|
result.response = Contrast::Api::Dtm::AttackResult::ResponseType::BLOCKED
|
191
192
|
end
|
192
193
|
|