contrast-agent 6.11.0 → 6.12.0
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/Gemfile +1 -1
- data/Rakefile +1 -1
- data/ext/build_funchook.rb +1 -1
- data/ext/cs__assess_array/cs__assess_array.c +24 -18
- data/ext/cs__assess_array/extconf.rb +1 -1
- data/ext/cs__assess_basic_object/cs__assess_basic_object.c +1 -1
- data/ext/cs__assess_basic_object/extconf.rb +1 -1
- data/ext/cs__assess_fiber_track/cs__assess_fiber_track.c +1 -1
- data/ext/cs__assess_fiber_track/extconf.rb +1 -1
- data/ext/cs__assess_hash/cs__assess_hash.c +1 -1
- data/ext/cs__assess_hash/extconf.rb +1 -1
- data/ext/cs__assess_kernel/cs__assess_kernel.c +1 -1
- data/ext/cs__assess_kernel/extconf.rb +1 -1
- data/ext/cs__assess_marshal_module/cs__assess_marshal_module.c +7 -5
- data/ext/cs__assess_marshal_module/extconf.rb +1 -1
- data/ext/cs__assess_module/cs__assess_module.c +1 -1
- data/ext/cs__assess_module/extconf.rb +1 -1
- data/ext/cs__assess_regexp/cs__assess_regexp.c +1 -1
- data/ext/cs__assess_regexp/extconf.rb +1 -1
- data/ext/cs__assess_string/cs__assess_string.c +1 -1
- data/ext/cs__assess_string/extconf.rb +1 -1
- data/ext/cs__assess_string_interpolation/cs__assess_string_interpolation.c +1 -1
- data/ext/cs__assess_string_interpolation/extconf.rb +1 -1
- data/ext/cs__assess_test/extconf.rb +1 -1
- data/ext/cs__assess_yield_track/cs__assess_yield_track.c +1 -1
- data/ext/cs__assess_yield_track/extconf.rb +1 -1
- data/ext/cs__common/cs__common.c +1 -1
- data/ext/cs__common/extconf.rb +1 -1
- data/ext/cs__contrast_patch/cs__contrast_patch.c +12 -10
- data/ext/cs__contrast_patch/extconf.rb +1 -1
- data/ext/cs__os_information/cs__os_information.c +1 -1
- data/ext/cs__os_information/extconf.rb +1 -1
- data/ext/cs__scope/cs__scope.c +390 -207
- data/ext/cs__scope/cs__scope.h +3 -1
- data/ext/cs__scope/extconf.rb +1 -1
- data/ext/cs__tests/cs__tests.c +1 -1
- data/ext/cs__tests/extconf.rb +1 -1
- data/ext/extconf_common.rb +1 -1
- data/lib/contrast/agent/assess/contrast_object.rb +1 -1
- data/lib/contrast/agent/assess/events/event_data.rb +1 -1
- data/lib/contrast/agent/assess/finalizers/freeze.rb +1 -1
- data/lib/contrast/agent/assess/finalizers/hash.rb +1 -1
- data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +1 -1
- data/lib/contrast/agent/assess/policy/patcher.rb +1 -1
- data/lib/contrast/agent/assess/policy/policy.rb +1 -1
- data/lib/contrast/agent/assess/policy/policy_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/policy_node_utils.rb +1 -1
- data/lib/contrast/agent/assess/policy/policy_scanner.rb +1 -1
- data/lib/contrast/agent/assess/policy/preshift.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagation_method.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagation_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/append.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/base.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/buffer.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/center.rb +1 -1
- 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/insert.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/keep.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/match_data.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/next.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/prepend.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/rack_protection.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/remove.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/replace.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/reverse.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/select.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/splat.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/split.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/substitution.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/substitution_utils.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/trim.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_method.rb +1 -3
- data/lib/contrast/agent/assess/policy/source_node.rb +1 -1
- 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/reflected_xss.rb +2 -1
- data/lib/contrast/agent/assess/policy/trigger/xpath.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb +1 -1
- data/lib/contrast/agent/assess/properties.rb +1 -1
- data/lib/contrast/agent/assess/property/evented.rb +1 -1
- data/lib/contrast/agent/assess/property/tagged.rb +1 -1
- data/lib/contrast/agent/assess/property/updated.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_key.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_password.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/auto_complete_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/base_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/body_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/click_jacking_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/csp_header_missing_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/parameters_pollution_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/x_content_type_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/tag.rb +1 -1
- data/lib/contrast/agent/assess/tracker.rb +1 -1
- data/lib/contrast/agent/assess.rb +1 -1
- data/lib/contrast/agent/at_exit_hook.rb +1 -1
- data/lib/contrast/agent/deadzone/policy/deadzone_node.rb +1 -1
- data/lib/contrast/agent/deadzone/policy/policy.rb +1 -1
- data/lib/contrast/agent/disable_reaction.rb +1 -1
- data/lib/contrast/agent/excluder.rb +125 -43
- data/lib/contrast/agent/exclusion_matcher.rb +11 -55
- data/lib/contrast/agent/inventory/database_config.rb +1 -1
- data/lib/contrast/agent/inventory/dependencies.rb +1 -1
- data/lib/contrast/agent/inventory/dependency_analysis.rb +1 -1
- data/lib/contrast/agent/inventory/dependency_usage_analysis.rb +1 -1
- data/lib/contrast/agent/inventory/policy/datastores.rb +1 -1
- data/lib/contrast/agent/inventory/policy/policy.rb +1 -1
- data/lib/contrast/agent/inventory/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/inventory.rb +1 -1
- data/lib/contrast/agent/middleware.rb +21 -8
- data/lib/contrast/agent/module_data.rb +1 -1
- data/lib/contrast/agent/patching/policy/after_load_patch.rb +1 -1
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +1 -1
- data/lib/contrast/agent/patching/policy/method_policy.rb +1 -1
- data/lib/contrast/agent/patching/policy/method_policy_extend.rb +1 -1
- data/lib/contrast/agent/patching/policy/module_policy.rb +1 -1
- data/lib/contrast/agent/patching/policy/patch.rb +1 -1
- data/lib/contrast/agent/patching/policy/patch_status.rb +1 -1
- data/lib/contrast/agent/patching/policy/patcher.rb +1 -1
- data/lib/contrast/agent/patching/policy/policy.rb +1 -1
- data/lib/contrast/agent/patching/policy/policy_node.rb +1 -1
- data/lib/contrast/agent/patching/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/protect/exploitable_collection.rb +1 -1
- data/lib/contrast/agent/protect/input_analyzer/input_analyzer.rb +4 -2
- data/lib/contrast/agent/protect/input_analyzer/worth_watching_analyzer.rb +12 -11
- data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_deserialization_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/applies_xxe_rule.rb +1 -1
- data/lib/contrast/agent/protect/policy/policy.rb +1 -1
- data/lib/contrast/agent/protect/policy/rule_applicator.rb +6 -1
- data/lib/contrast/agent/protect/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/protect/rule/base.rb +9 -19
- data/lib/contrast/agent/protect/rule/base_service.rb +33 -10
- data/lib/contrast/agent/protect/rule/bot_blocker/bot_blocker_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/bot_blocker.rb +1 -1
- data/lib/contrast/agent/protect/rule/cmd_injection.rb +1 -1
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_backdoors.rb +8 -50
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb +11 -18
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb +10 -11
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_dangerous_path.rb +10 -11
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/default_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/deserialization.rb +2 -3
- data/lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/no_sqli/no_sqli_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/no_sqli.rb +1 -13
- data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_semantic_security_bypass.rb +34 -9
- data/lib/contrast/agent/protect/rule/path_traversal.rb +1 -47
- data/lib/contrast/agent/protect/rule/sql_sample_builder.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli/default_sql_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli/mysql_sql_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli/postgres_sql_scanner.rb +2 -2
- data/lib/contrast/agent/protect/rule/sqli/sqli_base_rule.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli/sqli_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli/sqli_semantic/sqli_dangerous_functions.rb +5 -5
- data/lib/contrast/agent/protect/rule/sqli/sqlite_sql_scanner.rb +1 -1
- data/lib/contrast/agent/protect/rule/sqli.rb +1 -13
- data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +1 -2
- data/lib/contrast/agent/protect/rule/xss/reflected_xss_input_classification.rb +1 -1
- data/lib/contrast/agent/protect/rule/xss.rb +1 -1
- data/lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb +1 -1
- data/lib/contrast/agent/protect/rule/xxe.rb +2 -3
- data/lib/contrast/agent/protect/rule.rb +1 -1
- data/lib/contrast/agent/reporting/attack_result/attack_result.rb +1 -1
- data/lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb +1 -1
- data/lib/contrast/agent/reporting/attack_result/response_type.rb +1 -1
- data/lib/contrast/agent/reporting/attack_result/user_input.rb +1 -1
- data/lib/contrast/{api/communication → agent/reporting}/connection_status.rb +3 -17
- data/lib/contrast/agent/reporting/details/bot_blocker_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/cmd_injection_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/details.rb +1 -1
- data/lib/contrast/agent/reporting/details/ip_denylist_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/no_sqli_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/path_traversal_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/path_traversal_semantic_analysis_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/protect_rule_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/sqli_dangerous_functions.rb +1 -1
- data/lib/contrast/agent/reporting/details/sqli_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/untrusted_deserialization_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/virtual_patch_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/xss_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/xss_match.rb +1 -1
- data/lib/contrast/agent/reporting/details/xxe_details.rb +1 -1
- data/lib/contrast/agent/reporting/details/xxe_match.rb +1 -1
- data/lib/contrast/agent/reporting/details/xxe_wrapper.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/details/bot_blocker_details.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/details/protect_rule_details.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/input_analysis.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/input_analysis_result.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/input_type.rb +1 -1
- data/lib/contrast/agent/reporting/input_analysis/score_level.rb +1 -1
- data/lib/contrast/agent/reporting/masker/masker.rb +1 -1
- data/lib/contrast/agent/reporting/masker/masker_utils.rb +1 -1
- data/lib/contrast/agent/reporting/report.rb +1 -1
- data/lib/contrast/agent/reporting/reporter.rb +10 -9
- data/lib/contrast/agent/reporting/reporting_events/agent_startup.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_activity.rb +5 -4
- data/lib/contrast/agent/reporting/reporting_events/application_defend_activity.rb +13 -9
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_activity.rb +5 -6
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb +4 -3
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_stack.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/application_defend_attacker_activity.rb +19 -12
- data/lib/contrast/agent/reporting/reporting_events/application_inventory.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_inventory_activity.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_reporting_event.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/application_settings.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_startup.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/application_startup_instrumentation.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/application_update.rb +2 -3
- data/lib/contrast/agent/reporting/reporting_events/architecture_component.rb +4 -10
- data/lib/contrast/agent/reporting/reporting_events/discovered_route.rb +3 -11
- data/lib/contrast/agent/reporting/reporting_events/finding.rb +2 -11
- data/lib/contrast/agent/reporting/reporting_events/finding_event.rb +5 -12
- data/lib/contrast/agent/reporting/reporting_events/finding_event_object.rb +4 -12
- data/lib/contrast/agent/reporting/reporting_events/finding_event_parent_object.rb +9 -13
- data/lib/contrast/agent/reporting/reporting_events/finding_event_property.rb +9 -13
- data/lib/contrast/agent/reporting/reporting_events/finding_event_signature.rb +5 -12
- data/lib/contrast/agent/reporting/reporting_events/finding_event_source.rb +10 -21
- data/lib/contrast/agent/reporting/reporting_events/finding_event_stack.rb +9 -12
- data/lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb +10 -14
- data/lib/contrast/agent/reporting/reporting_events/finding_event_taint_range_tags.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/finding_request.rb +4 -12
- data/lib/contrast/agent/reporting/reporting_events/library_discovery.rb +14 -14
- data/lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb +14 -14
- data/lib/contrast/agent/reporting/reporting_events/observed_library_usage.rb +3 -11
- data/lib/contrast/agent/reporting/reporting_events/observed_route.rb +2 -11
- data/lib/contrast/agent/reporting/reporting_events/poll.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_events/preflight.rb +13 -2
- data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +5 -13
- data/lib/contrast/agent/reporting/reporting_events/reportable_hash.rb +47 -0
- data/lib/contrast/agent/reporting/reporting_events/reporting_event.rb +4 -35
- data/lib/contrast/agent/reporting/reporting_events/route_coverage.rb +1 -3
- data/lib/contrast/agent/reporting/reporting_events/route_discovery.rb +9 -13
- data/lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb +9 -13
- data/lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_events/server_settings.rb +2 -2
- data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +5 -2
- data/lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb +5 -2
- data/lib/contrast/agent/reporting/reporting_utilities/endpoints.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +6 -3
- data/lib/contrast/agent/reporting/reporting_utilities/ng_response_extractor.rb +4 -4
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +6 -19
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client_utils.rb +20 -3
- data/lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response_extractor.rb +2 -22
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler_utils.rb +22 -5
- data/lib/contrast/agent/reporting/reporting_workers/application_server_worker.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_workers/reporter_heartbeat.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_workers/reporting_workers.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_workers/server_settings_worker.rb +1 -1
- data/lib/contrast/agent/reporting/settings/application_settings.rb +1 -1
- data/lib/contrast/agent/reporting/settings/assess.rb +1 -1
- data/lib/contrast/agent/reporting/settings/assess_rule.rb +1 -1
- data/lib/contrast/agent/reporting/settings/assess_server_feature.rb +1 -1
- data/lib/contrast/agent/reporting/settings/bot_blocker.rb +1 -1
- data/lib/contrast/agent/reporting/settings/exclusion_base.rb +90 -12
- data/lib/contrast/agent/reporting/settings/exclusions.rb +11 -31
- data/lib/contrast/agent/reporting/settings/helpers.rb +41 -5
- data/lib/contrast/agent/reporting/settings/input_exclusion.rb +54 -10
- data/lib/contrast/agent/reporting/settings/ip_filter.rb +1 -1
- data/lib/contrast/agent/reporting/settings/keyword.rb +1 -1
- data/lib/contrast/agent/reporting/settings/log_enhancer.rb +1 -1
- data/lib/contrast/agent/reporting/settings/protect.rb +1 -1
- data/lib/contrast/agent/reporting/settings/protect_rule.rb +1 -1
- data/lib/contrast/agent/reporting/settings/protect_server_feature.rb +1 -1
- data/lib/contrast/agent/reporting/settings/reaction.rb +1 -1
- data/lib/contrast/agent/reporting/settings/rule_definition.rb +1 -1
- data/lib/contrast/agent/reporting/settings/sampling.rb +1 -1
- data/lib/contrast/agent/reporting/settings/sanitizer.rb +1 -1
- data/lib/contrast/agent/reporting/settings/security_logger.rb +1 -1
- data/lib/contrast/agent/reporting/settings/sensitive_data_masking.rb +1 -1
- data/lib/contrast/agent/reporting/settings/sensitive_data_masking_rule.rb +1 -1
- data/lib/contrast/agent/reporting/settings/server_features.rb +1 -1
- data/lib/contrast/agent/reporting/settings/syslog.rb +1 -1
- data/lib/contrast/agent/reporting/settings/url_exclusion.rb +2 -26
- data/lib/contrast/agent/reporting/settings/validator.rb +1 -1
- data/lib/contrast/agent/reporting/settings/virtual_patch.rb +1 -1
- data/lib/contrast/agent/reporting/settings/virtual_patch_condition.rb +1 -1
- data/lib/contrast/agent/request.rb +1 -1
- data/lib/contrast/agent/request_context.rb +1 -1
- data/lib/contrast/agent/request_context_extend.rb +1 -1
- data/lib/contrast/agent/request_handler.rb +1 -1
- data/lib/contrast/agent/response.rb +1 -1
- data/lib/contrast/agent/rule_set.rb +1 -1
- data/lib/contrast/agent/scope.rb +9 -1
- data/lib/contrast/agent/static_analysis.rb +1 -1
- data/lib/contrast/agent/telemetry/base.rb +21 -12
- data/lib/contrast/agent/telemetry/client.rb +109 -0
- data/lib/contrast/agent/telemetry/{events/event.rb → event.rb} +1 -1
- data/lib/contrast/agent/telemetry/{events/exceptions/telemetry_exception_base.rb → exception/base.rb} +2 -2
- data/lib/contrast/agent/telemetry/{events/exceptions/telemetry_exception_event.rb → exception/event.rb} +10 -10
- data/lib/contrast/agent/telemetry/{events/exceptions/telemetry_exception_message.rb → exception/message.rb} +9 -9
- data/lib/contrast/agent/telemetry/{events/exceptions/telemetry_exception_message_exception.rb → exception/message_exception.rb} +9 -9
- data/lib/contrast/agent/telemetry/{events/exceptions/telemetry_exception_stack_frame.rb → exception/stack_frame.rb} +4 -4
- data/lib/contrast/agent/telemetry/exception.rb +19 -0
- data/lib/contrast/agent/telemetry/hash.rb +71 -0
- data/lib/contrast/{utils/telemetry_identifier.rb → agent/telemetry/identifier.rb} +5 -5
- data/lib/contrast/agent/telemetry/{events/metric_event.rb → metric_event.rb} +2 -2
- data/lib/contrast/agent/telemetry/{events/startup_metrics_event.rb → startup_metrics_event.rb} +2 -2
- data/lib/contrast/{utils → agent}/telemetry.rb +3 -3
- data/lib/contrast/agent/thread.rb +1 -1
- data/lib/contrast/agent/thread_watcher.rb +28 -31
- data/lib/contrast/agent/tracepoint_hook.rb +1 -1
- data/lib/contrast/agent/version.rb +2 -2
- data/lib/contrast/agent/worker_thread.rb +1 -1
- data/lib/contrast/agent.rb +6 -2
- data/lib/contrast/agent_lib/api/command_injection.rb +1 -1
- data/lib/contrast/agent_lib/api/init.rb +1 -1
- data/lib/contrast/agent_lib/api/input_tracing.rb +1 -1
- data/lib/contrast/agent_lib/api/panic.rb +1 -1
- data/lib/contrast/agent_lib/api/path_semantic_file_security_bypass.rb +1 -1
- data/lib/contrast/agent_lib/interface.rb +1 -1
- data/lib/contrast/agent_lib/interface_base.rb +2 -2
- data/lib/contrast/agent_lib/return_types/eval_result.rb +1 -1
- data/lib/contrast/agent_lib/test.rb +1 -1
- data/lib/contrast/components/agent.rb +1 -1
- data/lib/contrast/components/api.rb +1 -1
- data/lib/contrast/components/app_context.rb +1 -1
- data/lib/contrast/components/app_context_extend.rb +1 -1
- data/lib/contrast/components/assess.rb +1 -1
- data/lib/contrast/components/assess_rules.rb +1 -1
- data/lib/contrast/components/base.rb +1 -1
- data/lib/contrast/components/config/sources.rb +1 -1
- data/lib/contrast/components/config.rb +1 -1
- data/lib/contrast/components/heap_dump.rb +1 -1
- data/lib/contrast/components/inventory.rb +1 -1
- data/lib/contrast/components/logger.rb +1 -1
- data/lib/contrast/components/polling.rb +4 -4
- data/lib/contrast/components/protect.rb +1 -1
- data/lib/contrast/components/ruby_component.rb +45 -6
- data/lib/contrast/components/sampling.rb +6 -6
- data/lib/contrast/components/scope.rb +9 -1
- data/lib/contrast/components/security_logger.rb +1 -1
- data/lib/contrast/components/settings.rb +13 -12
- data/lib/contrast/config/api_proxy_configuration.rb +1 -1
- data/lib/contrast/config/base_configuration.rb +1 -1
- data/lib/contrast/config/certification_configuration.rb +1 -1
- data/lib/contrast/config/config.rb +14 -12
- data/lib/contrast/config/diagnostics.rb +12 -3
- data/lib/contrast/config/diagnostics_tools.rb +2 -1
- data/lib/contrast/config/effective_config.rb +81 -15
- data/lib/contrast/config/effective_config_value.rb +4 -4
- data/lib/contrast/config/env_variables.rb +1 -1
- data/lib/contrast/config/exception_configuration.rb +1 -1
- data/lib/contrast/config/protect_rule_configuration.rb +1 -1
- data/lib/contrast/config/protect_rules_configuration.rb +1 -1
- data/lib/contrast/config/request_audit_configuration.rb +1 -1
- data/lib/contrast/config/server_configuration.rb +2 -2
- data/lib/contrast/config.rb +1 -1
- data/lib/contrast/configuration.rb +1 -1
- data/lib/contrast/extension/assess/array.rb +1 -1
- data/lib/contrast/extension/assess/erb.rb +1 -1
- data/lib/contrast/extension/assess/eval_trigger.rb +1 -1
- data/lib/contrast/extension/assess/exec_trigger.rb +1 -1
- data/lib/contrast/extension/assess/fiber.rb +1 -1
- data/lib/contrast/extension/assess/hash.rb +1 -1
- data/lib/contrast/extension/assess/kernel.rb +1 -1
- data/lib/contrast/extension/assess/marshal.rb +1 -1
- data/lib/contrast/extension/assess/regexp.rb +1 -1
- data/lib/contrast/extension/assess/string.rb +1 -1
- data/lib/contrast/extension/assess.rb +1 -1
- data/lib/contrast/extension/delegator.rb +1 -1
- data/lib/contrast/extension/extension.rb +1 -1
- data/lib/contrast/extension/inventory.rb +1 -1
- data/lib/contrast/extension/module.rb +1 -1
- data/lib/contrast/extension/object.rb +1 -1
- data/lib/contrast/extension/protect/psych.rb +1 -1
- data/lib/contrast/extension/protect.rb +1 -1
- data/lib/contrast/extension/thread.rb +1 -1
- data/lib/contrast/framework/base_support.rb +1 -1
- data/lib/contrast/framework/grape/support.rb +1 -1
- data/lib/contrast/framework/manager.rb +1 -1
- data/lib/contrast/framework/manager_extend.rb +1 -1
- 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 +1 -1
- data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +1 -1
- data/lib/contrast/framework/rails/patch/assess_configuration.rb +1 -1
- data/lib/contrast/framework/rails/patch/rails_application_configuration.rb +1 -1
- data/lib/contrast/framework/rails/patch/support.rb +1 -1
- data/lib/contrast/framework/rails/railtie.rb +1 -1
- data/lib/contrast/framework/rails/support.rb +1 -1
- data/lib/contrast/framework/sinatra/patch/encrypted_session_cookie.rb +39 -0
- data/lib/contrast/framework/sinatra/support.rb +14 -1
- data/lib/contrast/funchook/funchook.rb +1 -1
- data/lib/contrast/logger/aliased_logging.rb +12 -14
- data/lib/contrast/logger/application.rb +1 -1
- data/lib/contrast/logger/cef_log.rb +1 -1
- data/lib/contrast/logger/format.rb +1 -1
- data/lib/contrast/logger/log.rb +1 -1
- data/lib/contrast/logger/request.rb +1 -1
- data/lib/contrast/logger/time.rb +1 -1
- data/lib/contrast/security_exception.rb +1 -1
- data/lib/contrast/tasks/config.rb +1 -1
- data/lib/contrast/utils/assess/event_limit_utils.rb +1 -1
- data/lib/contrast/utils/assess/object_store.rb +1 -1
- data/lib/contrast/utils/assess/propagation_method_utils.rb +1 -1
- data/lib/contrast/utils/assess/property/tagged_utils.rb +1 -1
- data/lib/contrast/utils/assess/sampling_util.rb +1 -1
- data/lib/contrast/utils/assess/source_method_utils.rb +1 -1
- data/lib/contrast/utils/assess/split_utils.rb +1 -1
- data/lib/contrast/utils/assess/tracking_util.rb +1 -1
- data/lib/contrast/utils/assess/trigger_method_utils.rb +1 -1
- data/lib/contrast/utils/class_util.rb +1 -1
- data/lib/contrast/utils/duck_utils.rb +1 -1
- data/lib/contrast/utils/env_configuration_item.rb +1 -1
- data/lib/contrast/utils/findings.rb +1 -1
- data/lib/contrast/utils/hash_digest.rb +1 -1
- data/lib/contrast/utils/hash_digest_extend.rb +1 -1
- data/lib/contrast/utils/head_dump_utils_extend.rb +1 -1
- data/lib/contrast/utils/heap_dump_util.rb +1 -1
- data/lib/contrast/utils/input_classification_base.rb +2 -5
- data/lib/contrast/utils/invalid_configuration_util.rb +1 -1
- data/lib/contrast/utils/io_util.rb +1 -1
- data/lib/contrast/utils/job_servers_running.rb +1 -1
- data/lib/contrast/utils/log_utils.rb +2 -2
- 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 +4 -4
- data/lib/contrast/utils/net_http_base.rb +3 -3
- data/lib/contrast/utils/object_share.rb +2 -1
- data/lib/contrast/utils/os.rb +1 -1
- data/lib/contrast/utils/patching/policy/patch_utils.rb +1 -1
- data/lib/contrast/utils/patching/policy/patcher_utils.rb +1 -1
- data/lib/contrast/utils/reporting/application_activity_batch_utils.rb +12 -4
- data/lib/contrast/utils/request_utils.rb +1 -1
- data/lib/contrast/utils/resource_loader.rb +1 -1
- data/lib/contrast/utils/response_utils.rb +1 -1
- data/lib/contrast/utils/routes_sent.rb +1 -2
- data/lib/contrast/utils/sha256_builder.rb +1 -1
- data/lib/contrast/utils/silence_maker.rb +16 -0
- data/lib/contrast/utils/stack_trace_utils.rb +1 -1
- data/lib/contrast/utils/string_utils.rb +1 -1
- data/lib/contrast/utils/tag_util.rb +1 -1
- data/lib/contrast/utils/thread_tracker.rb +1 -1
- data/lib/contrast/utils/timer.rb +1 -1
- data/lib/contrast-agent.rb +1 -1
- data/lib/contrast.rb +7 -6
- data/ruby-agent.gemspec +1 -1
- metadata +29 -28
- data/lib/contrast/agent/reporting/settings/code_exclusion.rb +0 -32
- data/lib/contrast/agent/telemetry/events/exceptions/obfuscate.rb +0 -124
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exceptions.rb +0 -19
- data/lib/contrast/utils/telemetry_client.rb +0 -107
- data/lib/contrast/utils/telemetry_hash.rb +0 -65
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/logger'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/reporting/input_analysis/input_type'
|
@@ -96,10 +96,12 @@ module Contrast
|
|
96
96
|
input_analysis.inputs.each do |input_type, value|
|
97
97
|
next if value.nil? || value.empty?
|
98
98
|
|
99
|
-
# append to results.
|
100
99
|
protect_rule.classification.classify(rule_id, input_type, value, input_analysis)
|
101
100
|
end
|
101
|
+
|
102
102
|
input_analysis
|
103
|
+
rescue StandardError => e
|
104
|
+
logger.error('[INPUT_ANALYZER] Error', error: e)
|
103
105
|
end
|
104
106
|
|
105
107
|
# classify input by array of rules. There is a timeout for the AgentLib analysis if not set it
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/worker_thread'
|
@@ -36,17 +36,19 @@ module Contrast
|
|
36
36
|
|
37
37
|
report = false
|
38
38
|
# build attack_results for all infilter active protect rules.
|
39
|
-
|
40
|
-
|
39
|
+
stored_ia = queue.pop
|
40
|
+
results = build_results(stored_ia)
|
41
|
+
activity = Contrast::Agent::Reporting::ApplicationActivity.new(ia_request: stored_ia.request)
|
41
42
|
results.each do |result|
|
42
43
|
next unless (attack_result = eval_input(result))
|
43
44
|
|
44
45
|
activity.attach_defend(attack_result)
|
45
46
|
report = true
|
46
47
|
end
|
47
|
-
Contrast::Agent.
|
48
|
+
Contrast::Agent::Reporting::Masker.mask(activity)
|
49
|
+
Contrast::Agent.reporter.send_event(activity) if report
|
48
50
|
rescue StandardError => e
|
49
|
-
logger.
|
51
|
+
logger.error('[WorthWatchingAnalyzer] thread could not process result because of:', e)
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
@@ -63,7 +65,7 @@ module Contrast
|
|
63
65
|
# we need to save the ia which contains the request and saved extracted user inputs to
|
64
66
|
# be evaluated on the thread rather than building results here. This way we allow the
|
65
67
|
# request to continue and will build the attack results later.
|
66
|
-
queue << input_analysis
|
68
|
+
queue << input_analysis.dup
|
67
69
|
end
|
68
70
|
|
69
71
|
private
|
@@ -79,13 +81,12 @@ module Contrast
|
|
79
81
|
# sure that if a rule is already triggered during the infilter phase it will not be analyzed
|
80
82
|
# now, making sure we don't report same rule twice.
|
81
83
|
Contrast::Agent::Protect::InputAnalyzer.input_classification(input_analysis, infilter: true)
|
82
|
-
results =
|
83
|
-
|
84
|
-
each do |ia_result|
|
85
|
-
results << ia_result
|
84
|
+
results = input_analysis.results.reject do |val|
|
85
|
+
val.score_level == Contrast::Agent::Reporting::InputAnalysisResult::SCORE_LEVEL::IGNORE
|
86
86
|
end
|
87
|
+
return results if results
|
87
88
|
|
88
|
-
|
89
|
+
[]
|
89
90
|
end
|
90
91
|
|
91
92
|
# @param ia_result Contrast::Agent::Reporting::InputAnalysisResult the WorthWatching InputAnalysisResult
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/cmd_injection'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/deserialization'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/no_sqli'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/path_traversal'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/sqli'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/xxe'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/logger'
|
@@ -49,11 +49,16 @@ module Contrast
|
|
49
49
|
#
|
50
50
|
# @param rule_id [String] name of the rule
|
51
51
|
# @param context [Contrast::Agent::RequestContext] current request contest
|
52
|
+
# @return [Contrast::Agent::Reporting::InputAnalysis, nil]
|
52
53
|
def apply_classification rule_id, context
|
53
54
|
return unless context
|
54
55
|
return unless (ia = context.agent_input_analysis)
|
55
56
|
|
56
57
|
Contrast::Agent::Protect::InputAnalyzer.input_classification_for(rule_id, ia)
|
58
|
+
# We add the triggered rule to the list. After request analysis will skip this rule
|
59
|
+
# as already it's input applicable types has been analysed.
|
60
|
+
ia.triggered_rules << rule_name
|
61
|
+
ia
|
57
62
|
end
|
58
63
|
|
59
64
|
protected
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/logger'
|
@@ -221,26 +221,16 @@ module Contrast
|
|
221
221
|
enabled? && BLOCKING_MODES.include?(mode)
|
222
222
|
end
|
223
223
|
|
224
|
-
#
|
225
|
-
#
|
226
|
-
|
227
|
-
|
228
|
-
# for this rule
|
229
|
-
def protect_excluded_by_code?
|
230
|
-
exclusions = ::Contrast::SETTINGS.code_exclusions
|
231
|
-
return false unless exclusions
|
232
|
-
|
233
|
-
for_rule = exclusions.select { |ex| ex.protection_rule?(rule_name) }
|
234
|
-
return false if for_rule.empty?
|
235
|
-
|
236
|
-
stack = caller_locations
|
237
|
-
for_rule.any? { |ex| ex.match_code?(stack) }
|
224
|
+
# @param rule_id [String]
|
225
|
+
# @param request_path [String] Current request path
|
226
|
+
def protect_excluded_by_url? rule_id, request_path
|
227
|
+
Contrast::SETTINGS.excluder.protect_excluded_by_url?(rule_id, request_path)
|
238
228
|
end
|
239
229
|
|
240
|
-
# @param
|
241
|
-
#
|
242
|
-
def
|
243
|
-
Contrast::SETTINGS.excluder.
|
230
|
+
# @param results [Array<Contrast::Agent::Reporting::InputAnalysis>]
|
231
|
+
# @param request_path [String] Current request path
|
232
|
+
def protect_excluded_by_input? results, request_path
|
233
|
+
Contrast::SETTINGS.excluder.protect_excluded_by_input?(results, request_path)
|
244
234
|
end
|
245
235
|
|
246
236
|
# By default, rules do not have to find attackers as they do not have
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base'
|
@@ -39,9 +39,9 @@ module Contrast
|
|
39
39
|
# @return [Boolean]
|
40
40
|
def infilter? context
|
41
41
|
return false unless enabled?
|
42
|
-
return false unless gather_ia_results(context).any?
|
43
|
-
return false if
|
44
|
-
return false if
|
42
|
+
return false unless (results = gather_ia_results(context)) && results.any?
|
43
|
+
return false if protect_excluded_by_url?(rule_name, context.request.path)
|
44
|
+
return false if protect_excluded_by_input?(results, context.request.path)
|
45
45
|
|
46
46
|
true
|
47
47
|
end
|
@@ -54,12 +54,9 @@ module Contrast
|
|
54
54
|
def prefilter? context
|
55
55
|
return false unless context
|
56
56
|
return false unless enabled?
|
57
|
-
return false unless context.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
return false if protect_excluded_by_code?
|
62
|
-
return false if protect_excluded_by_url?(context)
|
57
|
+
return false unless (results = gather_ia_results(context)) && results.any?
|
58
|
+
return false if protect_excluded_by_url?(rule_name, context.request.path)
|
59
|
+
return false if protect_excluded_by_input?(results, context.request.path)
|
63
60
|
|
64
61
|
true
|
65
62
|
end
|
@@ -71,6 +68,9 @@ module Contrast
|
|
71
68
|
# @raise [Contrast::SecurityException]
|
72
69
|
def postfilter context
|
73
70
|
return unless enabled? && POSTFILTER_MODES.include?(mode)
|
71
|
+
return false if protect_excluded_by_url?(rule_name, context.request.path)
|
72
|
+
return if protect_excluded_by_input?(gather_ia_results(context), context.request.path)
|
73
|
+
|
74
74
|
return if mode == :NO_ACTION || mode == :PERMIT
|
75
75
|
|
76
76
|
result = find_postfilter_attacker(context, nil)
|
@@ -85,6 +85,29 @@ module Contrast
|
|
85
85
|
|
86
86
|
protected
|
87
87
|
|
88
|
+
# Used to build and report semantic rules.
|
89
|
+
#
|
90
|
+
# @param context [Contrast::Agent::RequestContext] current request contest
|
91
|
+
# @param potential_attack_string [String]
|
92
|
+
def build_violation context, potential_attack_string
|
93
|
+
result = build_attack_result(context)
|
94
|
+
update_successful_attack_response(context, nil, result, potential_attack_string)
|
95
|
+
return unless result
|
96
|
+
|
97
|
+
append_sample(context, nil, result, potential_attack_string)
|
98
|
+
cef_logging(result, :successful_attack)
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to if result is blocked. Used for raise check.
|
103
|
+
#
|
104
|
+
# @param result [Contrast::Agent::Reporting::AttackResult]
|
105
|
+
def blocked_violation? result
|
106
|
+
return false unless result
|
107
|
+
|
108
|
+
result.response == Contrast::Agent::Reporting::ResponseType::BLOCKED
|
109
|
+
end
|
110
|
+
|
88
111
|
# @param context [Contrast::Agent::RequestContext]
|
89
112
|
# @return [Array<Contrast::Agent::Reporting::InputAnalysis>]
|
90
113
|
def gather_ia_results context
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/reporting/input_analysis/input_type'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -21,6 +21,10 @@ module Contrast
|
|
21
21
|
NAME
|
22
22
|
end
|
23
23
|
|
24
|
+
def sub_rules
|
25
|
+
Contrast::Utils::ObjectShare::EMPTY_ARRAY
|
26
|
+
end
|
27
|
+
|
24
28
|
# CMDI Backdoors infilter:
|
25
29
|
# This rule does not have input classification.
|
26
30
|
# If a value matches the CMDI applicable input types and it's length is > 2
|
@@ -33,11 +37,9 @@ module Contrast
|
|
33
37
|
# @raise [Contrast::SecurityException] if the rule mode ise set
|
34
38
|
# to BLOCK and valid cdmi is detected.
|
35
39
|
def infilter context, classname, method, command
|
36
|
-
return
|
40
|
+
return if protect_excluded_by_url?(rule_name, context.request.path)
|
37
41
|
return unless backdoors_match?(command)
|
38
|
-
return unless (
|
39
|
-
return if protect_excluded_by_code?
|
40
|
-
return unless (result = build_attack_with_match(context, likely_attacker, nil, command,
|
42
|
+
return unless (result = build_attack_with_match(context, nil, nil, command,
|
41
43
|
**{ classname: classname, method: method }))
|
42
44
|
|
43
45
|
append_to_activity(context, result)
|
@@ -47,21 +49,7 @@ module Contrast
|
|
47
49
|
raise_error(classname, method)
|
48
50
|
end
|
49
51
|
|
50
|
-
|
51
|
-
def infilter? context
|
52
|
-
return false unless enabled?
|
53
|
-
# This rule does not have input tracing stage so we need to check the results of
|
54
|
-
# the main rule instead.
|
55
|
-
return false unless context&.agent_input_analysis&.results&.any? do |result|
|
56
|
-
result.rule_id == Contrast::Agent::Protect::Rule::CmdInjection::NAME
|
57
|
-
end
|
58
|
-
|
59
|
-
return false if protect_excluded_by_code?
|
60
|
-
|
61
|
-
true
|
62
|
-
end
|
63
|
-
|
64
|
-
protected
|
52
|
+
private
|
65
53
|
|
66
54
|
# Used to customize the raised error message.
|
67
55
|
#
|
@@ -74,8 +62,6 @@ module Contrast
|
|
74
62
|
"Call to #{ classname }.#{ method } blocked."))
|
75
63
|
end
|
76
64
|
|
77
|
-
private
|
78
|
-
|
79
65
|
# Check to see if value is backdoor match
|
80
66
|
#
|
81
67
|
# @param potential_attack_string [String]
|
@@ -97,34 +83,6 @@ module Contrast
|
|
97
83
|
end
|
98
84
|
false
|
99
85
|
end
|
100
|
-
|
101
|
-
# Check to see if the user input is one of the applicable types.
|
102
|
-
# With Agent_ia if we are here and CMDI is being analyzed then
|
103
|
-
# the applicable input type is already checked before input
|
104
|
-
# classification. Only thing left is the match check.
|
105
|
-
#
|
106
|
-
# @param ia_results [Contrast::Agent::Reporting::Settings::InputAnalysisResult] gathered results
|
107
|
-
# @param cmd [String] potential attack vector
|
108
|
-
# @return [Contrast::Agent::Reporting::Settings::InputAnalysisResult, nil] matched input_type
|
109
|
-
def match_applicable_input_type ia_results, cmd
|
110
|
-
ia_results.each do |ia_result|
|
111
|
-
return ia_result if ia_result.value == cmd
|
112
|
-
end
|
113
|
-
nil
|
114
|
-
end
|
115
|
-
|
116
|
-
# Backdoors does not have input classification so we check for match within the
|
117
|
-
# result for the main rule - CMDI.
|
118
|
-
#
|
119
|
-
# @param context [Contrast::Agent::RequestContext]
|
120
|
-
def gather_ia_results context
|
121
|
-
return Contrast::Utils::ObjectShare::EMPTY_ARRAY unless context&.agent_input_analysis&.results
|
122
|
-
|
123
|
-
context.agent_input_analysis.results.select do |ia_result|
|
124
|
-
ia_result.rule_id == Contrast::Agent::Protect::Rule::CmdInjection::NAME &&
|
125
|
-
ia_result.score_level != Contrast::Agent::Reporting::ScoreLevel::IGNORE
|
126
|
-
end
|
127
|
-
end
|
128
86
|
end
|
129
87
|
end
|
130
88
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/reporting/details/cmd_injection_details'
|
5
5
|
require 'contrast/agent/reporting/attack_result/user_input'
|
6
6
|
require 'contrast/agent/protect/rule/cmdi/cmdi_input_classification'
|
7
|
+
require 'contrast/agent/reporting/attack_result/response_type'
|
7
8
|
|
8
9
|
module Contrast
|
9
10
|
module Agent
|
@@ -29,7 +30,10 @@ module Contrast
|
|
29
30
|
@_classification ||= Contrast::Agent::Protect::Rule::CmdiInputClassification.cs__freeze
|
30
31
|
end
|
31
32
|
|
32
|
-
# CMDI infilter:
|
33
|
+
# CMDI Semantic infilter:
|
34
|
+
# This rule does not have input classification.
|
35
|
+
# If a value matches the CMDI applicable input types and it's length is > 2
|
36
|
+
# we can check if it's used as command backdoors.
|
33
37
|
#
|
34
38
|
# @param context [Contrast::Agent::RequestContext] current request contest
|
35
39
|
# @param classname [String] Name of the class
|
@@ -38,22 +42,12 @@ module Contrast
|
|
38
42
|
# @raise [Contrast::SecurityException] if the rule mode ise set
|
39
43
|
# to BLOCK and valid cdmi is detected.
|
40
44
|
def infilter context, classname, method, command
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Contrast::Agent::REQUEST_TRACKER.update_current_context(context)
|
45
|
-
end
|
46
|
-
return unless infilter?(context)
|
47
|
-
|
48
|
-
result = find_attacker_with_results(context, command, nil, **{ classname: classname, method: method })
|
49
|
-
result ||= report_command_execution(context, command, **{ classname: classname, method: method })
|
50
|
-
return unless result
|
45
|
+
return unless infilter?(command)
|
46
|
+
return if protect_excluded_by_url?(rule_name, context.request.path)
|
47
|
+
return unless (result = build_violation(context, command))
|
51
48
|
|
52
49
|
append_to_activity(context, result)
|
53
|
-
|
54
|
-
return unless blocked?
|
55
|
-
|
56
|
-
raise_error(classname, method)
|
50
|
+
raise_error(classname, method) if blocked_violation?(result)
|
57
51
|
end
|
58
52
|
|
59
53
|
def build_attack_with_match(context,
|
@@ -113,7 +107,7 @@ module Contrast
|
|
113
107
|
handle_with_agent_lib(sample, agent_lib_result_struct, command)
|
114
108
|
|
115
109
|
# This is a special case where the user input is UNKNOWN_USER_INPUT but
|
116
|
-
# we want to send the attack value
|
110
|
+
# we want to send the attack value. Usually we do this for semantic rules.
|
117
111
|
if input_analysis_result.nil?
|
118
112
|
ui = Contrast::Agent::Reporting::UserInput.new
|
119
113
|
ui.input_type = :UNKNOWN
|
@@ -128,7 +122,6 @@ module Contrast
|
|
128
122
|
|
129
123
|
def report_command_execution context, command, **kwargs
|
130
124
|
return unless report_any_command_execution?
|
131
|
-
return if protect_excluded_by_code?
|
132
125
|
|
133
126
|
build_attack_with_match(context, nil, nil, command, **kwargs)
|
134
127
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -23,7 +23,15 @@ module Contrast
|
|
23
23
|
Contrast::Utils::ObjectShare::EMPTY_ARRAY
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
# @param command [String] potential dangerous command executed.
|
27
|
+
def infilter? command
|
28
|
+
return unless enabled?
|
29
|
+
return unless chained_command?(command)
|
30
|
+
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
27
35
|
|
28
36
|
# Used to customize the raised error message.
|
29
37
|
#
|
@@ -36,15 +44,6 @@ module Contrast
|
|
36
44
|
"Call to #{ classname }.#{ method } blocked."))
|
37
45
|
end
|
38
46
|
|
39
|
-
private
|
40
|
-
|
41
|
-
def find_probable_attacker context, potential_attack_string, _ia_results, **kwargs
|
42
|
-
chained = chained_command?(potential_attack_string)
|
43
|
-
return unless chained
|
44
|
-
|
45
|
-
build_attack_with_match(context, nil, nil, potential_attack_string, **kwargs)
|
46
|
-
end
|
47
|
-
|
48
47
|
# Check if potential chained attack is detected in user input.
|
49
48
|
#
|
50
49
|
# @param command [String] command to check.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -23,7 +23,15 @@ module Contrast
|
|
23
23
|
Contrast::Utils::ObjectShare::EMPTY_ARRAY
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
# @param path [String] potential dangerous path executed.
|
27
|
+
def infilter? path
|
28
|
+
return unless enabled?
|
29
|
+
return unless dangerous_path?(path)
|
30
|
+
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
27
35
|
|
28
36
|
# Used to customize the raised error message.
|
29
37
|
#
|
@@ -36,15 +44,6 @@ module Contrast
|
|
36
44
|
"Call to #{ classname }.#{ method } blocked."))
|
37
45
|
end
|
38
46
|
|
39
|
-
private
|
40
|
-
|
41
|
-
def find_probable_attacker context, potential_attack_string, _ia_results, **kwargs
|
42
|
-
dangerous_path = dangerous_path?(potential_attack_string)
|
43
|
-
return unless dangerous_path
|
44
|
-
|
45
|
-
build_attack_with_match(context, nil, nil, potential_attack_string, **kwargs)
|
46
|
-
end
|
47
|
-
|
48
47
|
# Checks if a given shell command is trying to access a dangerous path.
|
49
48
|
# This is used for the cmd-injection-semantic-dangerous-paths rule.
|
50
49
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/cmd_injection'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
# The base class used to determine if a user input crosses a token boundary or
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -60,8 +60,7 @@ module Contrast
|
|
60
60
|
# @return [Boolean] should the rule apply to this call.
|
61
61
|
def infilter? context
|
62
62
|
return false unless enabled?
|
63
|
-
return false if
|
64
|
-
return false if protect_excluded_by_url?(context)
|
63
|
+
return false if protect_excluded_by_url?(rule_name, context.request.path)
|
65
64
|
|
66
65
|
true
|
67
66
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Contrast
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/utils/object_share'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/protect/rule/base_service'
|
@@ -70,18 +70,6 @@ module Contrast
|
|
70
70
|
result
|
71
71
|
end
|
72
72
|
|
73
|
-
# @param context [Contrast::Agent::RequestContext]
|
74
|
-
def infilter? context
|
75
|
-
return false unless enabled?
|
76
|
-
return false unless context&.agent_input_analysis&.results&.any? do |result|
|
77
|
-
result.rule_id == rule_name
|
78
|
-
end
|
79
|
-
|
80
|
-
return false if protect_excluded_by_code?
|
81
|
-
|
82
|
-
true
|
83
|
-
end
|
84
|
-
|
85
73
|
protected
|
86
74
|
|
87
75
|
def find_attacker context, potential_attack_string, **kwargs
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 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/utils/input_classification_base'
|