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
|
module Contrast
|
@@ -1,12 +1,11 @@
|
|
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'
|
5
5
|
require 'contrast/agent/reporting/report'
|
6
6
|
require 'contrast/components/logger'
|
7
7
|
require 'contrast/agent/reporting/reporting_events/agent_startup'
|
8
|
-
require 'contrast/agent/telemetry/
|
9
|
-
require 'contrast/agent/telemetry/events/exceptions/obfuscate'
|
8
|
+
require 'contrast/agent/telemetry/exception'
|
10
9
|
|
11
10
|
module Contrast
|
12
11
|
module Agent
|
@@ -81,7 +80,9 @@ module Contrast
|
|
81
80
|
queue << event
|
82
81
|
end
|
83
82
|
|
84
|
-
# Use this to bypass the messaging queue and leave response processing to the caller
|
83
|
+
# Use this to bypass the messaging queue and leave response processing to the caller.
|
84
|
+
# Do not use this in separate threads since this will create a race condition, when
|
85
|
+
# two threads need to use the same OpenSSL::SSL::SSLSocket raising frozen error.
|
85
86
|
#
|
86
87
|
# @param event [Contrast::Agent::Reporting::ReportingEvent]
|
87
88
|
# @return [Net::HTTPResponse, nil]
|
@@ -138,13 +139,13 @@ module Contrast
|
|
138
139
|
logger.error('[Reporter] Could not send message to TeamServer from reporting queue.', e)
|
139
140
|
end
|
140
141
|
|
141
|
-
# @return [Contrast::Agent::Telemetry::
|
142
|
+
# @return [Contrast::Agent::Telemetry::Exception::Event]
|
142
143
|
def queue_limit_telemetry_event
|
143
|
-
message_exception = Contrast::Agent::Telemetry::
|
144
|
+
message_exception = Contrast::Agent::Telemetry::Exception::MessageException.build(
|
144
145
|
'String',
|
145
146
|
"[Reporter] Maximum queue size (#{ MAX_QUEUE_SIZE }) reached for reporting events", nil, stack_frame)
|
146
|
-
message = Contrast::Agent::Telemetry::
|
147
|
-
Contrast::Agent::Telemetry::
|
147
|
+
message = Contrast::Agent::Telemetry::Exception::Message.build({}, [message_exception])
|
148
|
+
Contrast::Agent::Telemetry::Exception::Event.new(message)
|
148
149
|
end
|
149
150
|
|
150
151
|
def stack_frame
|
@@ -155,7 +156,7 @@ module Contrast
|
|
155
156
|
stack_trace[1].path.delete_prefix(Dir.pwd)
|
156
157
|
end
|
157
158
|
stack_frame_function = stack_trace.nil? || stack_trace[1].nil? ? 'none' : stack_trace[1].label
|
158
|
-
Contrast::Agent::Telemetry::
|
159
|
+
Contrast::Agent::Telemetry::Exception::StackFrame.build(stack_frame_function, stack_frame_type, nil)
|
159
160
|
end
|
160
161
|
end
|
161
162
|
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/server_reporting_event'
|
@@ -14,7 +14,7 @@ module Contrast
|
|
14
14
|
@event_method = :PUT
|
15
15
|
@event_endpoint = Contrast::Agent::Reporting::Endpoints::NG_ENDPOINTS[:agent_startup]
|
16
16
|
@event_type = :agent_startup
|
17
|
-
super
|
17
|
+
super()
|
18
18
|
end
|
19
19
|
|
20
20
|
def file_name
|
@@ -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'
|
@@ -23,13 +23,14 @@ module Contrast
|
|
23
23
|
# @return [Contrast::Agent::Response]
|
24
24
|
attr_accessor :response
|
25
25
|
|
26
|
-
def initialize
|
26
|
+
def initialize ia_request: nil
|
27
27
|
@routes = []
|
28
28
|
@query_count = 0
|
29
29
|
@event_method = :PUT
|
30
30
|
@event_type = :application_activity
|
31
31
|
@event_endpoint = Contrast::Agent::Reporting::Endpoints.application_activity
|
32
|
-
|
32
|
+
@_request = FindingRequest.convert(ia_request) if ia_request
|
33
|
+
super()
|
33
34
|
end
|
34
35
|
|
35
36
|
# @return [Contrast::Agent::Reporting::FindingRequest] Current context's request
|
@@ -40,7 +41,7 @@ module Contrast
|
|
40
41
|
# @return [Contrast::Agent::Reporting::ApplicationDefendActivity] main
|
41
42
|
# activity for all protect rules.
|
42
43
|
def defend
|
43
|
-
@_defend ||= Contrast::Agent::Reporting::ApplicationDefendActivity.new
|
44
|
+
@_defend ||= Contrast::Agent::Reporting::ApplicationDefendActivity.new(ia_request: request)
|
44
45
|
end
|
45
46
|
|
46
47
|
# @return [Contrast::Agent::Reporting::ApplicationInventoryActivity] main
|
@@ -1,25 +1,27 @@
|
|
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/reporting_events/application_defend_attacker_activity'
|
6
|
+
require 'contrast/utils/duck_utils'
|
7
|
+
require 'contrast/agent/reporting/reporting_events/reporting_event'
|
6
8
|
|
7
9
|
module Contrast
|
8
10
|
module Agent
|
9
11
|
module Reporting
|
10
12
|
# This is the new ApplicationDefendActivity class which includes information about the defense of the application
|
11
13
|
# which was discovered during exercise of the application during this activity period.
|
12
|
-
class ApplicationDefendActivity
|
14
|
+
class ApplicationDefendActivity < Contrast::Agent::Reporting::ReportingEvent
|
15
|
+
include Contrast::Components::Logger::InstanceMethods
|
16
|
+
|
13
17
|
# @return [Array<Contrast::Agent::Reporting::ApplicationDefendAttackerActivity>]
|
14
18
|
attr_reader :attackers
|
15
19
|
|
16
|
-
|
17
|
-
attr_reader :existing_attacker_activity
|
18
|
-
|
19
|
-
def initialize
|
20
|
+
def initialize ia_request: nil
|
20
21
|
@attackers = []
|
21
|
-
@existing_attacker_activity = false
|
22
22
|
@event_type = :application_defend_activity
|
23
|
+
@request = ia_request
|
24
|
+
super()
|
23
25
|
end
|
24
26
|
|
25
27
|
def to_controlled_hash
|
@@ -30,14 +32,16 @@ module Contrast
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def validate
|
33
|
-
|
35
|
+
return unless Contrast::Utils::DuckUtils.empty_duck?(attackers)
|
36
|
+
|
37
|
+
raise(ArgumentError, 'Attackers data must be populated')
|
34
38
|
end
|
35
39
|
|
36
40
|
# @param attack_result [Contrast::Agent::Reporting::AttackResult]
|
37
41
|
def attach_data attack_result
|
38
42
|
return unless attack_result&.cs__is_a?(Contrast::Agent::Reporting::AttackResult)
|
39
43
|
|
40
|
-
attacker_activity = Contrast::Agent::Reporting::ApplicationDefendAttackerActivity.new
|
44
|
+
attacker_activity = Contrast::Agent::Reporting::ApplicationDefendAttackerActivity.new(ia_request: @request)
|
41
45
|
attacker_activity.attach_data(attack_result)
|
42
46
|
|
43
47
|
@existing_attacker_activity = true
|
@@ -1,15 +1,15 @@
|
|
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/reporting_events/application_defend_attack_sample_activity'
|
6
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
6
7
|
|
7
8
|
module Contrast
|
8
9
|
module Agent
|
9
10
|
module Reporting
|
10
11
|
# This is the new ApplicationDefendAttackActivity class which will include the attacks sent by the source.
|
11
|
-
class ApplicationDefendAttackActivity
|
12
|
-
include Contrast::Components::Logger::InstanceMethods
|
12
|
+
class ApplicationDefendAttackActivity < Contrast::Agent::Reporting::ReportableHash
|
13
13
|
# @return [Contrast::Agent::Reporting::ApplicationDefendAttackSampleActivity]
|
14
14
|
attr_accessor :blocked
|
15
15
|
# @return [Contrast::Agent::Reporting::ApplicationDefendAttackSampleActivity]
|
@@ -25,6 +25,7 @@ module Contrast
|
|
25
25
|
|
26
26
|
def initialize
|
27
27
|
@start_time = start_time
|
28
|
+
super()
|
28
29
|
end
|
29
30
|
|
30
31
|
def to_controlled_hash
|
@@ -33,7 +34,6 @@ module Contrast
|
|
33
34
|
ineffective_hash = ineffective&.to_controlled_hash || Contrast::Utils::ObjectShare::EMPTY_HASH
|
34
35
|
suspicious_hash = suspicious&.to_controlled_hash || Contrast::Utils::ObjectShare::EMPTY_HASH
|
35
36
|
validate(blocked_hash, exploited_hash, ineffective_hash, suspicious_hash)
|
36
|
-
|
37
37
|
{
|
38
38
|
startTime: @start_time,
|
39
39
|
blocked: blocked_hash,
|
@@ -44,10 +44,9 @@ module Contrast
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def validate blocked_hash, exploited_hash, ineffective_hash, suspicious_hash
|
47
|
+
raise(ArgumentError, 'Start Time for is not presented') unless @start_time
|
47
48
|
return unless [blocked_hash, exploited_hash, ineffective_hash, suspicious_hash].all?(&:empty?)
|
48
49
|
|
49
|
-
raise(ArgumentError, 'Start Time for is not presented') unless start_time
|
50
|
-
|
51
50
|
raise(ArgumentError, 'At least one of the samples must be populated')
|
52
51
|
end
|
53
52
|
|
@@ -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'
|
data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb
CHANGED
@@ -1,16 +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
|
-
require 'contrast/components/logger'
|
5
4
|
require 'contrast/utils/timer'
|
6
5
|
require 'contrast/agent/reporting/reporting_events/application_defend_attack_sample'
|
6
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
10
10
|
module Reporting
|
11
11
|
# This is the new AttackerSampleActivity class which will include Sample of the given attacks in the activity
|
12
12
|
# period.
|
13
|
-
class ApplicationDefendAttackSampleActivity
|
13
|
+
class ApplicationDefendAttackSampleActivity < Contrast::Agent::Reporting::ReportableHash
|
14
14
|
# @return [Array<Contrast::Agent::Reporting::ApplicationDefendAttackSample>]
|
15
15
|
attr_reader :samples
|
16
16
|
# @return [Hash<Integer,Integer>] map of time from start in seconds to number of attacks in that second
|
@@ -21,6 +21,7 @@ module Contrast
|
|
21
21
|
@start_time = Contrast::Agent::REQUEST_TRACKER.current&.timer&.start_ms || 0 # in ms
|
22
22
|
@event_type = :application_defend_attack_sample_activity
|
23
23
|
@time_map = Hash.new { |h, k| h[k] = 0 }
|
24
|
+
super()
|
24
25
|
end
|
25
26
|
|
26
27
|
def to_controlled_hash
|
data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_stack.rb
CHANGED
@@ -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,8 +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/components/logger'
|
5
5
|
require 'contrast/utils/object_share'
|
6
|
+
require 'contrast/utils/duck_utils'
|
7
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
6
8
|
require 'contrast/agent/reporting/reporting_events/application_defend_attack_activity'
|
7
9
|
|
8
10
|
module Contrast
|
@@ -10,8 +12,7 @@ module Contrast
|
|
10
12
|
module Reporting
|
11
13
|
# This is the new AttackerActivity class which will includes the attacker information discovered during this
|
12
14
|
# activity period.
|
13
|
-
class ApplicationDefendAttackerActivity
|
14
|
-
include Contrast::Components::Logger::InstanceMethods
|
15
|
+
class ApplicationDefendAttackerActivity < Contrast::Agent::Reporting::ReportableHash
|
15
16
|
# @return [Hash<String,Contrast::Agent::Reporting::ApplicationDefendAttackActivity>] map of rule-id to violated
|
16
17
|
# samples for that rule
|
17
18
|
attr_accessor :protection_rules
|
@@ -22,22 +23,23 @@ module Contrast
|
|
22
23
|
# identify unique attackers
|
23
24
|
attr_reader :source_forwarded_for
|
24
25
|
|
25
|
-
|
26
|
+
# @param ia_request [Contrast::Agent::Reporting::FindingRequest, nil] Worthwatching worker input_analysis
|
27
|
+
# saved request.
|
28
|
+
def initialize ia_request: nil
|
26
29
|
@protection_rules = {}
|
27
|
-
req = Contrast::Agent::REQUEST_TRACKER.current&.request
|
30
|
+
req = ia_request || Contrast::Agent::REQUEST_TRACKER.current&.request
|
28
31
|
if req
|
29
32
|
@source_ip = req.ip || Contrast::Utils::ObjectShare::EMPTY_STRING
|
30
33
|
@source_forwarded_for = req.headers['X-Forwarded-For']
|
31
34
|
end
|
32
35
|
@event_type = :application_defend_attacker_activity
|
36
|
+
super()
|
33
37
|
end
|
34
38
|
|
35
39
|
def to_controlled_hash
|
36
|
-
|
37
|
-
validate(processed_rules)
|
38
|
-
|
40
|
+
validate
|
39
41
|
{
|
40
|
-
protectionRules:
|
42
|
+
protectionRules: process_protection_rules,
|
41
43
|
source: {
|
42
44
|
ip: source_ip,
|
43
45
|
xForwardedFor: source_forwarded_for
|
@@ -45,9 +47,14 @@ module Contrast
|
|
45
47
|
}
|
46
48
|
end
|
47
49
|
|
48
|
-
def validate
|
49
|
-
|
50
|
-
|
50
|
+
def validate
|
51
|
+
if Contrast::Utils::DuckUtils.empty_duck?(protection_rules) # rubocop:disable Style/GuardClause
|
52
|
+
raise(ArgumentError, 'Protection Rules are not presented')
|
53
|
+
elsif Contrast::Utils::DuckUtils.empty_duck?(source_ip)
|
54
|
+
raise(ArgumentError, 'Source is not presented')
|
55
|
+
end
|
56
|
+
|
57
|
+
nil
|
51
58
|
end
|
52
59
|
|
53
60
|
# @param attack_result [Contrast::Agent::Reporting::AttackResult]
|
@@ -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'
|
@@ -23,7 +23,7 @@ module Contrast
|
|
23
23
|
@event_endpoint = Contrast::Agent::Reporting::Endpoints.application_inventory
|
24
24
|
# The API spec limits us to 500 routes, so we'll enforce that here to not hold on to superfulous data.
|
25
25
|
@routes = Contrast::Agent.framework_manager.find_route_discovery_data&.take(500)
|
26
|
-
super
|
26
|
+
super()
|
27
27
|
end
|
28
28
|
|
29
29
|
def file_name
|
@@ -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'
|
@@ -22,7 +22,7 @@ module Contrast
|
|
22
22
|
@event_type = :application_inventory_activity
|
23
23
|
@browsers = []
|
24
24
|
@components = []
|
25
|
-
super
|
25
|
+
super()
|
26
26
|
end
|
27
27
|
|
28
28
|
def to_controlled_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
|
require 'contrast/agent/reporting/reporting_events/reporting_event'
|
@@ -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/application_reporting_event'
|
@@ -14,7 +14,7 @@ module Contrast
|
|
14
14
|
def initialize
|
15
15
|
@event_method = :GET
|
16
16
|
@event_endpoint = Contrast::Agent::Reporting::Endpoints.application_settings
|
17
|
-
super
|
17
|
+
super()
|
18
18
|
end
|
19
19
|
|
20
20
|
def file_name
|
@@ -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/application_reporting_event'
|
@@ -15,7 +15,7 @@ module Contrast
|
|
15
15
|
def initialize
|
16
16
|
@event_method = :PUT
|
17
17
|
@event_endpoint = Contrast::Agent::Reporting::Endpoints::NG_ENDPOINTS[:application_create]
|
18
|
-
super
|
18
|
+
super()
|
19
19
|
end
|
20
20
|
|
21
21
|
def file_name
|
@@ -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/protect'
|
@@ -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'
|
@@ -6,7 +6,6 @@ require 'contrast/agent/reporting/reporting_events/application_reporting_event'
|
|
6
6
|
require 'contrast/agent/reporting/reporting_events/library_discovery'
|
7
7
|
require 'contrast/agent/reporting/reporting_events/reporting_event'
|
8
8
|
require 'contrast/agent/reporting/reporting_events/route_discovery'
|
9
|
-
require 'contrast/components/logger'
|
10
9
|
|
11
10
|
module Contrast
|
12
11
|
module Agent
|
@@ -25,7 +24,7 @@ module Contrast
|
|
25
24
|
@event_endpoint = "#{ Contrast::API.api_url }/api/ng/update/application"
|
26
25
|
@components = []
|
27
26
|
@libraries = []
|
28
|
-
super
|
27
|
+
super()
|
29
28
|
end
|
30
29
|
|
31
30
|
def file_name
|
@@ -1,7 +1,7 @@
|
|
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
|
-
require 'contrast/
|
4
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
5
5
|
|
6
6
|
module Contrast
|
7
7
|
module Agent
|
@@ -16,8 +16,7 @@ module Contrast
|
|
16
16
|
# @attr_reader type [String] the type of the component. Only ::VALID_TYPES can be used. Required for reporting.
|
17
17
|
# @attr_reader url [String] the url used to connect to the component. Required for reporting.
|
18
18
|
# @attr_reader vendor [String] the publisher of the component, like MySQL.
|
19
|
-
class ArchitectureComponent
|
20
|
-
include Contrast::Components::Logger::InstanceMethods
|
19
|
+
class ArchitectureComponent < Contrast::Agent::Reporting::ReportableHash
|
21
20
|
# required attributes
|
22
21
|
attr_accessor :type, :url
|
23
22
|
# optional attributes
|
@@ -42,12 +41,7 @@ module Contrast
|
|
42
41
|
# @return [Hash]
|
43
42
|
# @raise [ArgumentError]
|
44
43
|
def to_controlled_hash
|
45
|
-
|
46
|
-
validate
|
47
|
-
rescue ArgumentError => e
|
48
|
-
logger.error('ArchitectureComponent validation failed with: ', e)
|
49
|
-
return
|
50
|
-
end
|
44
|
+
validate
|
51
45
|
{
|
52
46
|
remoteHost: remote_host,
|
53
47
|
remotePort: remote_port,
|
@@ -1,8 +1,7 @@
|
|
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 'json'
|
5
|
-
require 'contrast/components/logger'
|
6
5
|
require 'contrast/agent/reporting/reporting_events/reporting_event'
|
7
6
|
require 'contrast/utils/object_share'
|
8
7
|
require 'contrast/utils/duck_utils'
|
@@ -18,8 +17,6 @@ module Contrast
|
|
18
17
|
# recorded.
|
19
18
|
class DiscoveredRoute < Contrast::Agent::Reporting::ObservedRoute
|
20
19
|
class << self
|
21
|
-
include Contrast::Components::Logger::InstanceMethods
|
22
|
-
|
23
20
|
# @param obj [Regexp, Object]
|
24
21
|
# @return [String]
|
25
22
|
def source_or_string obj
|
@@ -99,18 +96,13 @@ module Contrast
|
|
99
96
|
attr_accessor :verb
|
100
97
|
|
101
98
|
def initialize
|
102
|
-
super
|
103
99
|
@event_type = :discovered_route
|
104
100
|
@verb = Contrast::Utils::ObjectShare::EMPTY_STRING
|
101
|
+
super()
|
105
102
|
end
|
106
103
|
|
107
104
|
def to_controlled_hash
|
108
|
-
|
109
|
-
validate
|
110
|
-
rescue ArgumentError => e
|
111
|
-
logger.error('DiscoveredRoute validation failed with: ', e)
|
112
|
-
return
|
113
|
-
end
|
105
|
+
validate
|
114
106
|
{ session_id: ::Contrast::ASSESS.session_id, signature: @signature, verb: @verb, url: @url }.compact
|
115
107
|
end
|
116
108
|
|
@@ -1,8 +1,7 @@
|
|
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 'json'
|
5
|
-
require 'contrast/components/logger'
|
6
5
|
require 'contrast/agent/reporting/reporting_events/application_reporting_event'
|
7
6
|
require 'contrast/agent/reporting/reporting_events/finding_event'
|
8
7
|
require 'contrast/agent/reporting/reporting_events/finding_request'
|
@@ -17,8 +16,6 @@ module Contrast
|
|
17
16
|
# vulnerability information for the assess feature. They represent those parts of the application, either through
|
18
17
|
# configuration, method invocation, or dataflow, which are determined to be insecure.
|
19
18
|
class Finding < Contrast::Agent::Reporting::ApplicationReportingEvent
|
20
|
-
include Contrast::Components::Logger::InstanceMethods
|
21
|
-
|
22
19
|
# @return [Integer] the time, in ms, that this object was initialized
|
23
20
|
attr_reader :created
|
24
21
|
# @return [String] the ID of the rule associated with this finding
|
@@ -102,13 +99,7 @@ module Contrast
|
|
102
99
|
# @return [Hash]
|
103
100
|
# @raise [ArgumentError]
|
104
101
|
def to_controlled_hash
|
105
|
-
|
106
|
-
validate
|
107
|
-
rescue ArgumentError => e
|
108
|
-
logger.error('Finding event validation failed with: ', e)
|
109
|
-
return
|
110
|
-
end
|
111
|
-
|
102
|
+
validate
|
112
103
|
hsh = base_hash
|
113
104
|
hsh[:events] = events.map(&:to_controlled_hash) if events.any?
|
114
105
|
hsh[:properties] = properties if properties.any?
|
@@ -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/finding_event_object'
|
@@ -16,7 +16,7 @@ require 'contrast/utils/object_share'
|
|
16
16
|
require 'contrast/utils/stack_trace_utils'
|
17
17
|
require 'contrast/utils/string_utils'
|
18
18
|
require 'contrast/utils/timer'
|
19
|
-
require 'contrast/
|
19
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
20
20
|
|
21
21
|
module Contrast
|
22
22
|
module Agent
|
@@ -25,9 +25,7 @@ module Contrast
|
|
25
25
|
# to relay this information in the Finding/Trace messages. These FindingEvents are used by TeamServer to
|
26
26
|
# construct the vulnerability information for the assess feature. They represent the operation the application
|
27
27
|
# underwent that transformed data during the dataflow.
|
28
|
-
class FindingEvent
|
29
|
-
include Contrast::Components::Logger::InstanceMethods
|
30
|
-
|
28
|
+
class FindingEvent < Contrast::Agent::Reporting::ReportableHash
|
31
29
|
# @return [Symbol] what the event did; CREATION, A2O, A2P, A2A, A2R, O2A, O2O, O2P, O2R, P2A, P2O, P2P, P2R,
|
32
30
|
# TAG, TRIGGER.
|
33
31
|
attr_reader :action
|
@@ -105,6 +103,7 @@ module Contrast
|
|
105
103
|
@thread = Thread.current.object_id.to_s
|
106
104
|
@event_id = Contrast::Agent::Reporting::FindingEvent.next_atomic_id
|
107
105
|
initialize_routine(event_data, source_type, source_name)
|
106
|
+
super()
|
108
107
|
end
|
109
108
|
|
110
109
|
# Init routine to find parents events, capture stack trace and retrieve object, args, ret and properties.
|
@@ -188,13 +187,7 @@ module Contrast
|
|
188
187
|
# @return [Hash]
|
189
188
|
# @raise [ArgumentError]
|
190
189
|
def to_controlled_hash # rubocop:disable Metrics/AbcSize
|
191
|
-
|
192
|
-
validate
|
193
|
-
rescue ArgumentError => e
|
194
|
-
logger.error('FindingEvent validation failed with: ', e)
|
195
|
-
return
|
196
|
-
end
|
197
|
-
|
190
|
+
validate
|
198
191
|
{
|
199
192
|
action: action,
|
200
193
|
args: reportable_args.map(&:to_controlled_hash),
|
@@ -1,9 +1,9 @@
|
|
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 'base64'
|
5
5
|
require 'contrast/agent/assess/contrast_object'
|
6
|
-
require 'contrast/
|
6
|
+
require 'contrast/agent/reporting/reporting_events/reportable_hash'
|
7
7
|
|
8
8
|
module Contrast
|
9
9
|
module Agent
|
@@ -12,9 +12,7 @@ module Contrast
|
|
12
12
|
# system to relay this information in the Finding/Trace messages. These FindingEventObjects are used by
|
13
13
|
# TeamServer to construct the vulnerability information for the assess feature. They represent those parts of the
|
14
14
|
# objects that were acted on in a Dataflow Finding.
|
15
|
-
class FindingEventObject
|
16
|
-
include Contrast::Components::Logger::InstanceMethods
|
17
|
-
|
15
|
+
class FindingEventObject < Contrast::Agent::Reporting::ReportableHash
|
18
16
|
# @return [Integer] the id of the Object this represents.
|
19
17
|
attr_reader :hash
|
20
18
|
# @return [Boolean] if the Object is tracked or not
|
@@ -55,13 +53,7 @@ module Contrast
|
|
55
53
|
# @return [Hash]
|
56
54
|
# @raise [ArgumentError]
|
57
55
|
def to_controlled_hash
|
58
|
-
|
59
|
-
validate
|
60
|
-
rescue ArgumentError => e
|
61
|
-
logger.error('FindingEventObject validation failed with: ', e)
|
62
|
-
return
|
63
|
-
end
|
64
|
-
|
56
|
+
validate
|
65
57
|
{
|
66
58
|
hash: hash,
|
67
59
|
tracked: tracked,
|