contrast-agent 6.11.0 → 6.13.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 +39 -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/resources/assess/policy.json +26 -0
- data/ruby-agent.gemspec +2 -2
- metadata +31 -30
- 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/agent/assess/rule/response/base_rule'
|
@@ -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/assess/rule/response/header_rule'
|
@@ -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/assess/rule/response/framework/rails_support'
|
@@ -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/assess/finalizers/hash'
|
@@ -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/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/patching/policy/policy_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/agent/deadzone/policy/deadzone_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'
|
@@ -1,13 +1,16 @@
|
|
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/settings/url_exclusion'
|
5
|
+
require 'contrast/agent/reporting/input_analysis/input_type'
|
5
6
|
|
6
7
|
module Contrast
|
7
8
|
module Agent
|
8
9
|
# Given an array of exclusion matcher instances provides methods to
|
9
10
|
# determine if the exclusions apply to particular urls.
|
10
11
|
class Excluder # rubocop:disable Metrics/ClassLength
|
12
|
+
include Contrast::Agent::Reporting::InputType
|
13
|
+
|
11
14
|
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
12
15
|
attr_reader :exclusions
|
13
16
|
|
@@ -16,16 +19,40 @@ module Contrast
|
|
16
19
|
@exclusions = exclusions
|
17
20
|
end
|
18
21
|
|
22
|
+
# Determine if an input is excluded for protect rule.
|
23
|
+
#
|
24
|
+
# @param results [Array<Contrast::Agent::Reporting::InputAnalysisResult>]
|
25
|
+
# @param request_path [String] Current request path
|
26
|
+
def protect_excluded_by_input? results, request_path
|
27
|
+
return false unless results.any?
|
28
|
+
|
29
|
+
exclusion_matched = 0
|
30
|
+
protect_input_exclusions.any? do |exclusion_match|
|
31
|
+
# each exclusion against each input result
|
32
|
+
results.each do |rule_result|
|
33
|
+
# check and see the rule_id match first or if this applicable for all protect rules.
|
34
|
+
next unless exclusion_match.protection_rule?(rule_result.rule_id)
|
35
|
+
|
36
|
+
# Based on strategy:
|
37
|
+
match = input_match_strategy(exclusion_match,
|
38
|
+
input_match?(exclusion_match, rule_result.input_type, rule_result.key),
|
39
|
+
request_path)
|
40
|
+
exclusion_matched += 1 if match
|
41
|
+
end
|
42
|
+
end
|
43
|
+
return false if exclusion_matched.zero?
|
44
|
+
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
19
48
|
# If an assess URL exclusion rule applies to the current url, *and* is defined as "All Rules"
|
20
49
|
# then we can avoid any tracking for the request.
|
21
50
|
#
|
22
51
|
# @param request [Contrast::Agent::Request] a wrapper around the Rack::Request for the current request
|
23
52
|
# @return [Boolean]
|
24
53
|
def assess_excluded_by_url? request
|
25
|
-
request_path = request.path
|
26
|
-
|
27
54
|
assess_url_exclusions_for_all_rules.any? do |exclusion_matcher|
|
28
|
-
path_match?(exclusion_matcher,
|
55
|
+
path_match?(exclusion_matcher, request.path)
|
29
56
|
end
|
30
57
|
end
|
31
58
|
|
@@ -74,7 +101,7 @@ module Contrast
|
|
74
101
|
# any INPUT exclusions that apply to the current url and the supplied rule.
|
75
102
|
path = request.path
|
76
103
|
rule_input_exclusions = assess_input_exclusions.select do |exclusion_matcher|
|
77
|
-
(exclusion_matcher.
|
104
|
+
(exclusion_matcher.protect_rules.empty? || exclusion_matcher.protect_rules.include?(rule)) &&
|
78
105
|
path_match?(exclusion_matcher, path)
|
79
106
|
end
|
80
107
|
return false if rule_input_exclusions.empty?
|
@@ -94,18 +121,35 @@ module Contrast
|
|
94
121
|
# If a protect URL exclusion rule applies to the current url, *and* is defined as "All Rules"
|
95
122
|
# then we can avoid using the rule for the request.
|
96
123
|
#
|
97
|
-
# @param
|
124
|
+
# @param rule_id [String]
|
125
|
+
# @param path [String]
|
98
126
|
# return [Boolean]
|
99
|
-
def protect_excluded_by_url?
|
100
|
-
|
127
|
+
def protect_excluded_by_url? rule_id, path
|
128
|
+
protect_url_exclusions.any? do |exclusion_matcher|
|
129
|
+
next unless exclusion_matcher.protection_rule?(rule_id)
|
101
130
|
|
102
|
-
|
103
|
-
path_match?(exclusion_matcher, request_path)
|
131
|
+
return true if path_match?(exclusion_matcher, path)
|
104
132
|
end
|
105
133
|
end
|
106
134
|
|
107
135
|
private
|
108
136
|
|
137
|
+
# Here we check to see the matching strategy. If ALL is set we need to exclude any input matching
|
138
|
+
# the exclusion. If ONLY is set, that means that we have a set if urls to match and apply the
|
139
|
+
# input exclusion only to those matching urls.
|
140
|
+
#
|
141
|
+
# @param exclusion_match [Contrast::Agent::ExclusionMatcher]
|
142
|
+
# @param input_match [Boolean] does the input match the exclusion
|
143
|
+
# @param request_path [String] Current request path
|
144
|
+
# @return [Boolean]
|
145
|
+
def input_match_strategy exclusion_match, input_match, request_path
|
146
|
+
# for ALL urls
|
147
|
+
return input_match if exclusion_match.match_all?
|
148
|
+
|
149
|
+
# for ONLY match we need to check if there is an input and url match.
|
150
|
+
input_match && path_match?(exclusion_match, request_path)
|
151
|
+
end
|
152
|
+
|
109
153
|
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
110
154
|
def assess_url_exclusions_for_all_rules
|
111
155
|
@_assess_url_exclusions_for_all_rules ||= assess_url_exclusions.select do |exclusion_matcher|
|
@@ -116,7 +160,7 @@ module Contrast
|
|
116
160
|
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
117
161
|
def assess_url_exclusions
|
118
162
|
@_assess_url_exclusions ||= assess_exclusions.select do |exclusion_matcher|
|
119
|
-
exclusion_matcher.
|
163
|
+
exclusion_matcher.exclusion_type == :URL
|
120
164
|
end
|
121
165
|
end
|
122
166
|
|
@@ -130,7 +174,7 @@ module Contrast
|
|
130
174
|
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
131
175
|
def assess_input_exclusions
|
132
176
|
@_assess_input_exclusions ||= assess_exclusions.select do |exclusion_matcher|
|
133
|
-
exclusion_matcher.
|
177
|
+
exclusion_matcher.exclusion_type == :INPUT
|
134
178
|
end
|
135
179
|
end
|
136
180
|
|
@@ -139,17 +183,10 @@ module Contrast
|
|
139
183
|
@_assess_exclusions ||= @exclusions.select(&:assess)
|
140
184
|
end
|
141
185
|
|
142
|
-
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
143
|
-
def protect_url_exclusions_for_all_rules
|
144
|
-
@_protect_url_exclusions_for_all_rules ||= protect_url_exclusions.select do |exclusion_matcher|
|
145
|
-
exclusion_matcher.protect_rules.empty?
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
186
|
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
150
187
|
def protect_url_exclusions
|
151
188
|
@_protect_url_exclusions ||= protect_exclusions.select do |exclusion_matcher|
|
152
|
-
exclusion_matcher.
|
189
|
+
exclusion_matcher.exclusion_type == :URL
|
153
190
|
end
|
154
191
|
end
|
155
192
|
|
@@ -158,9 +195,19 @@ module Contrast
|
|
158
195
|
@_protect_exclusions ||= @exclusions.select(&:protect)
|
159
196
|
end
|
160
197
|
|
198
|
+
# @return [Array<Contrast::Agent::ExclusionMatcher>]
|
199
|
+
def protect_input_exclusions
|
200
|
+
@_protect_input_exclusions ||= protect_exclusions.select do |exclusion_matcher|
|
201
|
+
exclusion_matcher.exclusion_type == :INPUT
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
161
205
|
# @return [Boolean]
|
162
206
|
def path_match? exclusion_matcher, path
|
163
|
-
|
207
|
+
return false unless path
|
208
|
+
|
209
|
+
exclusion_matcher.wildcard_url ||
|
210
|
+
exclusion_matcher.urls.any? { |url| url.match?(path) || regexp_match?(url, path) }
|
164
211
|
end
|
165
212
|
|
166
213
|
# @param exclusion [Contrast::Agent::ExclusionMatcher]
|
@@ -168,7 +215,7 @@ module Contrast
|
|
168
215
|
# @param source_name [String]
|
169
216
|
# @return [Boolean]
|
170
217
|
def input_match? exclusion, source_type, source_name
|
171
|
-
case exclusion.
|
218
|
+
case exclusion.type
|
172
219
|
when 'PARAMETER'
|
173
220
|
input_match_parameter?(exclusion, source_type, source_name)
|
174
221
|
when 'COOKIE'
|
@@ -176,49 +223,84 @@ module Contrast
|
|
176
223
|
when 'HEADER'
|
177
224
|
input_match_header?(exclusion, source_type, source_name)
|
178
225
|
when 'BODY'
|
179
|
-
|
226
|
+
BODY == source_type
|
180
227
|
when 'QUERYSTRING'
|
181
|
-
|
228
|
+
QUERYSTRING == source_type
|
182
229
|
else
|
183
230
|
false
|
184
231
|
end
|
185
232
|
end
|
186
233
|
|
234
|
+
# Returns true if parameter exclusion is found.
|
235
|
+
#
|
236
|
+
# @param exclusion [Contrast::Agent::ExclusionMatcher]
|
237
|
+
# @param source_type [Contrast::Agent::Reporting::InputType<Symbol>]
|
238
|
+
# @param source_name [String] value to match
|
239
|
+
# @return [Boolean]
|
187
240
|
def input_match_parameter? exclusion, source_type, source_name
|
188
|
-
return false unless
|
189
|
-
Contrast::Agent::Assess::Policy::SourceMethod::PARAMETER_TYPE,
|
190
|
-
Contrast::Agent::Assess::Policy::SourceMethod::PARAMETER_KEY_TYPE
|
191
|
-
].include?(source_type)
|
241
|
+
return false unless params_types.include?(source_type)
|
192
242
|
|
193
|
-
|
194
|
-
source_name)
|
243
|
+
input_value_match?(exclusion, source_name)
|
195
244
|
end
|
196
245
|
|
246
|
+
# Returns true if cookie exclusion is found.
|
247
|
+
#
|
248
|
+
# @param exclusion [Contrast::Agent::ExclusionMatcher]
|
249
|
+
# @param source_type [Contrast::Agent::Reporting::InputType<Symbol>]
|
250
|
+
# @param source_name [String] value to match
|
251
|
+
# @return [Boolean]
|
197
252
|
def input_match_cookie? exclusion, source_type, source_name
|
198
|
-
return false unless
|
199
|
-
Contrast::Agent::Assess::Policy::SourceMethod::COOKIE_TYPE,
|
200
|
-
Contrast::Agent::Assess::Policy::SourceMethod::COOKIE_KEY_TYPE
|
201
|
-
].include?(source_type)
|
253
|
+
return false unless cookie_types.include?(source_type)
|
202
254
|
|
203
|
-
|
204
|
-
source_name)
|
255
|
+
input_value_match?(exclusion, source_name)
|
205
256
|
end
|
206
257
|
|
258
|
+
# Returns true if header exclusion is found.
|
259
|
+
#
|
260
|
+
# @param exclusion [Contrast::Agent::ExclusionMatcher]
|
261
|
+
# @param source_type [Contrast::Agent::Reporting::InputType<Symbol>]
|
262
|
+
# @param source_name [String] value to match
|
263
|
+
# @return [Boolean]
|
207
264
|
def input_match_header? exclusion, source_type, source_name
|
208
|
-
return false unless
|
209
|
-
Contrast::Agent::Assess::Policy::SourceMethod::HEADER_TYPE,
|
210
|
-
Contrast::Agent::Assess::Policy::SourceMethod::HEADER_KEY_TYPE
|
211
|
-
].include?(source_type)
|
265
|
+
return false unless source_type == HEADER
|
212
266
|
|
213
|
-
exclusion
|
214
|
-
exclusion.input_name, source_name)
|
267
|
+
input_value_match?(exclusion, source_name, header: true)
|
215
268
|
end
|
216
269
|
|
270
|
+
# regexp check for input name match
|
271
|
+
#
|
272
|
+
# @return [Boolean]
|
217
273
|
def regexp_match? possible_pattern, source_name
|
218
|
-
Regexp.new("^#{ possible_pattern }$").match?(source_name)
|
274
|
+
Regexp.new("^#{ possible_pattern }$").match?(source_name) || Regexp.new(possible_pattern).match?(source_name)
|
219
275
|
rescue RegexpError
|
220
276
|
false
|
221
277
|
end
|
278
|
+
|
279
|
+
# Returns true if ia input matches exclusion input name, or it's a all input type - wildcard [*, .*]
|
280
|
+
#
|
281
|
+
# @param exclusion [Contrast::Agent::ExclusionMatcher]
|
282
|
+
# @param source_name [String] value to match
|
283
|
+
# @param header [Boolean]
|
284
|
+
# @return [Boolean]
|
285
|
+
def input_value_match? exclusion, source_name, header: nil
|
286
|
+
exclusion.wildcard_input ||
|
287
|
+
(header.nil? ? (exclusion.name == source_name) : exclusion.name.casecmp(source_name).zero?) || # rubocop:disable Security/Module/Name
|
288
|
+
regexp_match?(exclusion.name, source_name) || exclusion.input_name == source_name # rubocop:disable Security/Module/Name
|
289
|
+
end
|
290
|
+
|
291
|
+
# Input types to match against exclusions parameter type.
|
292
|
+
#
|
293
|
+
# @return [Array<Symbol>]
|
294
|
+
def params_types
|
295
|
+
@_params_types ||= [PARAMETER_VALUE, PARAMETER_NAME].cs__freeze
|
296
|
+
end
|
297
|
+
|
298
|
+
# Input types to match against exclusions cookie type.
|
299
|
+
#
|
300
|
+
# @return [Array<Symbol>]
|
301
|
+
def cookie_types
|
302
|
+
@_cookie_types ||= [COOKIE_NAME, COOKIE_VALUE].cs__freeze
|
303
|
+
end
|
222
304
|
end
|
223
305
|
end
|
224
306
|
end
|
@@ -1,9 +1,8 @@
|
|
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'
|
5
5
|
require 'contrast/agent/reporting/settings/exclusion_base'
|
6
|
-
require 'contrast/agent/reporting/settings/code_exclusion'
|
7
6
|
require 'contrast/agent/reporting/settings/input_exclusion'
|
8
7
|
require 'contrast/agent/reporting/settings/url_exclusion'
|
9
8
|
|
@@ -14,12 +13,13 @@ module Contrast
|
|
14
13
|
# functions of the Agent are suppressed for that request or event.
|
15
14
|
class ExclusionMatcher
|
16
15
|
include Contrast::Components::Logger::InstanceMethods
|
17
|
-
|
18
16
|
extend Forwardable
|
19
17
|
|
20
|
-
attr_reader :protect, :assess, :
|
18
|
+
attr_reader :protect, :assess, :exclusion_type, :wildcard_url, :wildcard_input
|
19
|
+
|
20
|
+
def_delegators :@exclusion, :protect_rules, :assess_rules, :type, :name, :input_name, :urls, :match_strategy
|
21
21
|
|
22
|
-
|
22
|
+
MATCH_ALL = 'ALL'.cs__freeze
|
23
23
|
|
24
24
|
# Create a matcher around an exclusion sent from TeamServer.
|
25
25
|
#
|
@@ -31,15 +31,12 @@ module Contrast
|
|
31
31
|
@assess = @exclusion.assess
|
32
32
|
|
33
33
|
case excl
|
34
|
-
when Contrast::Agent::Reporting::Settings::CodeExclusion
|
35
|
-
handle_wildcard_code
|
36
|
-
@type = :CODE
|
37
34
|
when Contrast::Agent::Reporting::Settings::InputExclusion
|
38
35
|
handle_wildcard_input
|
39
|
-
@
|
36
|
+
@exclusion_type = :INPUT
|
40
37
|
when Contrast::Agent::Reporting::Settings::UrlExclusion
|
41
38
|
handle_wildcard_url
|
42
|
-
@
|
39
|
+
@exclusion_type = :URL
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
@@ -48,10 +45,9 @@ module Contrast
|
|
48
45
|
# regexp beyond this.
|
49
46
|
# https://docs.contrastsecurity.com/admin-policymgmt.html#exclude
|
50
47
|
def handle_wildcard_input
|
51
|
-
return unless @exclusion.
|
48
|
+
return unless @exclusion.name # rubocop:disable Security/Module/Name
|
52
49
|
|
53
|
-
@wildcard_input = @exclusion.
|
54
|
-
@exclusion.input_name == Contrast::Utils::ObjectShare::ASTERISK
|
50
|
+
@wildcard_input = @exclusion.name == '.*' || @exclusion.name == Contrast::Utils::ObjectShare::ASTERISK # rubocop:disable Security/Module/Name
|
55
51
|
end
|
56
52
|
|
57
53
|
# According to the docs for exclusions, urls apply to all urls if the url
|
@@ -74,24 +70,6 @@ module Contrast
|
|
74
70
|
end
|
75
71
|
end
|
76
72
|
|
77
|
-
# According to the docs for exclusions, code applies to the entire stacktrace
|
78
|
-
# of the caller, and can act as a regexp. Per our user instructions in the
|
79
|
-
# Contrast UI, these comparisons must be done at the end of the input.
|
80
|
-
# https://docs.contrastsecurity.com/admin-policymgmt.html#exclude
|
81
|
-
def handle_wildcard_code
|
82
|
-
return unless @exclusion.denylist&.any?
|
83
|
-
|
84
|
-
@wildcard_exclusions = []
|
85
|
-
@exclusion.denylist.each do |code|
|
86
|
-
class_name, method_name = code.split(Contrast::Utils::ObjectShare::COLON)
|
87
|
-
class_pattern = build_regexp(class_name, start_anchor: false, end_anchor: true)
|
88
|
-
method_pattern = build_regexp(method_name)
|
89
|
-
next unless class_pattern && method_pattern
|
90
|
-
|
91
|
-
@wildcard_exclusions << [class_pattern, method_pattern]
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
73
|
def build_regexp pattern, start_anchor: false, end_anchor: false
|
96
74
|
pattern = Contrast::Utils::ObjectShare::CARROT + pattern if start_anchor
|
97
75
|
pattern += Contrast::Utils::ObjectShare::DOLLAR_SIGN if end_anchor
|
@@ -108,12 +86,8 @@ module Contrast
|
|
108
86
|
@assess
|
109
87
|
end
|
110
88
|
|
111
|
-
def code?
|
112
|
-
@type == :CODE
|
113
|
-
end
|
114
|
-
|
115
89
|
def match_all?
|
116
|
-
@exclusion.urls.nil? || @exclusion.urls.empty?
|
90
|
+
(@exclusion.urls.nil? || @exclusion.urls.empty?) && @exclusion.match_strategy == MATCH_ALL
|
117
91
|
end
|
118
92
|
|
119
93
|
# Determine if the given rule is excluded by this exclusion.
|
@@ -131,25 +105,7 @@ module Contrast
|
|
131
105
|
#
|
132
106
|
# @param rule - the id of the rule which we're checking for exclusion
|
133
107
|
def assess_rule? rule
|
134
|
-
assess? && (@exclusion.
|
135
|
-
end
|
136
|
-
|
137
|
-
def match_code? stack_trace
|
138
|
-
return false unless code?
|
139
|
-
return false if @wildcard_exclusions&.empty?
|
140
|
-
|
141
|
-
@wildcard_exclusions.each do |code|
|
142
|
-
class_name = code[0]
|
143
|
-
method_name = code[1]
|
144
|
-
stack_trace.each do |location|
|
145
|
-
next unless location.base_label.match?(method_name)
|
146
|
-
next unless location.path.match?(class_name)
|
147
|
-
|
148
|
-
return true
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
false
|
108
|
+
assess? && (@exclusion.assess_rules.empty? || @exclusion.assess_rules.include?(rule))
|
153
109
|
end
|
154
110
|
end
|
155
111
|
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/reporting/reporting_events/architecture_component'
|
@@ -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/agent/reporting/reporting_events/library_discovery'
|
@@ -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/reporting_events/library_usage_observation'
|
@@ -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/inventory/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/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
|
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 'ipaddr'
|
@@ -10,10 +10,10 @@ require 'contrast/utils/object_share'
|
|
10
10
|
require 'contrast/components/logger'
|
11
11
|
require 'contrast/components/scope'
|
12
12
|
require 'contrast/utils/heap_dump_util'
|
13
|
-
require 'contrast/
|
13
|
+
require 'contrast/agent/telemetry'
|
14
14
|
require 'contrast/agent/request_handler'
|
15
15
|
require 'contrast/agent/static_analysis'
|
16
|
-
require 'contrast/agent/telemetry/
|
16
|
+
require 'contrast/agent/telemetry/startup_metrics_event'
|
17
17
|
require 'contrast/agent/protect/input_analyzer/input_analyzer'
|
18
18
|
require 'contrast/utils/middleware_utils'
|
19
19
|
require 'contrast/utils/reporting/application_activity_batch_utils'
|
@@ -57,14 +57,29 @@ module Contrast
|
|
57
57
|
|
58
58
|
# This is where we're hooked into the middleware stack. If the agent is enabled, we're ready to do some
|
59
59
|
# processing on a per request basis. If not, we just pass the request along to the next middleware in the stack.
|
60
|
+
# If Application Scope feature is enabled we execute the env call with that scope, enabling only analysis for
|
61
|
+
# the current application, and nothing outside that.
|
60
62
|
#
|
61
63
|
# @param env [Hash] the various variables stored by this and other Middlewares to know the state and values of
|
62
64
|
# this Request
|
63
65
|
# @return [Array,Rack::Response] the Response of this and subsequent Middlewares to be passed back to the user up
|
64
66
|
# the Rack framework.
|
65
67
|
def call env
|
68
|
+
return with_app_scope { call_routine(env) } if Contrast::RUBY_INTERFACE.start_with_application_scope?
|
69
|
+
|
70
|
+
call_routine(env)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# This is the call routine we do when we are hooked to the middleware stack.
|
76
|
+
#
|
77
|
+
# @param env [Hash] the various variables stored by this and other Middlewares to know the state and values of
|
78
|
+
# this Request
|
79
|
+
# @return [Array,Rack::Response] the Response of this and subsequent Middlewares to be passed back to the user up
|
80
|
+
# the Rack framework.
|
81
|
+
def call_routine env
|
66
82
|
logger.trace_with_time('Elapsed time for Contrast::Agent::Middleware#call') do
|
67
|
-
::Contrast::Agent::ThreadWatcher.check_before_start
|
68
83
|
return app.call(env) unless ::Contrast::AGENT.enabled?
|
69
84
|
|
70
85
|
Contrast::Agent.heapdump_util.start_thread!
|
@@ -73,8 +88,6 @@ module Contrast
|
|
73
88
|
end
|
74
89
|
end
|
75
90
|
|
76
|
-
private
|
77
|
-
|
78
91
|
# Startup the Agent as part of the initialization process:
|
79
92
|
# - start the TeamServer sending thread, responsible for sending and processing messages
|
80
93
|
# - start the heartbeat thread, which handles periodic messages to TeamServer
|
@@ -175,10 +188,10 @@ module Contrast
|
|
175
188
|
Contrast::Agent::FINDINGS.report_collected_findings unless Contrast::Agent::FINDINGS.collection.empty?
|
176
189
|
# All protect rules, which are trigger but require response to be reported
|
177
190
|
Contrast::Agent::EXPLOITS.report_recorded_exploits(context) unless Contrast::Agent::EXPLOITS.collection.empty?
|
178
|
-
# Process Worth Watching Inputs for v2 rules
|
179
|
-
Contrast::Agent.worth_watching_analyzer&.add_to_queue(context.agent_input_analysis)
|
180
191
|
# Now we can build the ia_results only for postfilter rules.
|
181
192
|
context.protect_postfilter_ia
|
193
|
+
# Process Worth Watching Inputs for v2 rules
|
194
|
+
Contrast::Agent.worth_watching_analyzer&.add_to_queue(context.agent_input_analysis)
|
182
195
|
|
183
196
|
if Contrast::Agent.framework_manager.streaming?(env)
|
184
197
|
context.reset_activity
|
@@ -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/components/scope'
|
@@ -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/after_load_patch'
|
@@ -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/method_policy_extend'
|
@@ -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/agent/patching/policy/method_policy'
|