contrast-agent 6.10.0 → 6.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +1 -1
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/ext/build_funchook.rb +2 -2
- 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 +2 -5
- data/lib/contrast/agent/assess/policy/propagator/substitution.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/substitution_utils.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator/trim.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagator.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_method.rb +1 -3
- data/lib/contrast/agent/assess/policy/source_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_validation/cross_site_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/source_validation/source_validation.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger/reflected_xss.rb +2 -1
- data/lib/contrast/agent/assess/policy/trigger/xpath.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_method.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb +1 -1
- data/lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb +1 -1
- data/lib/contrast/agent/assess/properties.rb +1 -1
- data/lib/contrast/agent/assess/property/evented.rb +1 -1
- data/lib/contrast/agent/assess/property/tagged.rb +1 -1
- data/lib/contrast/agent/assess/property/updated.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_key.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_password.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/provider.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/auto_complete_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/base_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/body_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/click_jacking_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/csp_header_missing_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/parameters_pollution_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/x_content_type_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -1
- data/lib/contrast/agent/assess/tag.rb +1 -1
- data/lib/contrast/agent/assess/tracker.rb +1 -1
- data/lib/contrast/agent/assess.rb +1 -1
- data/lib/contrast/agent/at_exit_hook.rb +1 -1
- data/lib/contrast/agent/deadzone/policy/deadzone_node.rb +1 -1
- data/lib/contrast/agent/deadzone/policy/policy.rb +1 -1
- data/lib/contrast/agent/disable_reaction.rb +1 -1
- data/lib/contrast/agent/excluder.rb +125 -43
- data/lib/contrast/agent/exclusion_matcher.rb +11 -55
- data/lib/contrast/agent/inventory/database_config.rb +1 -1
- data/lib/contrast/agent/inventory/dependencies.rb +1 -1
- data/lib/contrast/agent/inventory/dependency_analysis.rb +1 -1
- data/lib/contrast/agent/inventory/dependency_usage_analysis.rb +1 -1
- data/lib/contrast/agent/inventory/policy/datastores.rb +1 -1
- data/lib/contrast/agent/inventory/policy/policy.rb +1 -1
- data/lib/contrast/agent/inventory/policy/trigger_node.rb +1 -1
- data/lib/contrast/agent/inventory.rb +1 -1
- data/lib/contrast/agent/middleware.rb +22 -9
- 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 +7 -3
- 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 +2 -2
- 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 +3 -3
- 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 +34 -12
- 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 +9 -51
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb +12 -19
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb +11 -12
- data/lib/contrast/agent/protect/rule/cmdi/cmdi_dangerous_path.rb +11 -12
- 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 -3
- 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 +14 -17
- 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 +10 -14
- 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 +10 -16
- 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 +8 -8
- 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 +26 -9
- 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 +23 -17
- 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 +4 -4
- 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 +2 -2
- 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 +3 -2
- 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 +19 -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 +2 -2
- 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 +3 -3
- 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 +5 -5
- 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 +3 -3
- 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 +5 -2
- data/lib/contrast/utils/sha256_builder.rb +1 -1
- data/lib/contrast/utils/silence_maker.rb +16 -0
- data/lib/contrast/utils/stack_trace_utils.rb +1 -1
- data/lib/contrast/utils/string_utils.rb +1 -1
- data/lib/contrast/utils/tag_util.rb +1 -1
- data/lib/contrast/utils/thread_tracker.rb +1 -1
- data/lib/contrast/utils/timer.rb +1 -1
- data/lib/contrast-agent.rb +1 -1
- data/lib/contrast.rb +7 -6
- data/ruby-agent.gemspec +6 -6
- metadata +41 -40
- data/lib/contrast/agent/reporting/settings/code_exclusion.rb +0 -32
- data/lib/contrast/agent/telemetry/events/exceptions/obfuscate.rb +0 -124
- data/lib/contrast/agent/telemetry/events/exceptions/telemetry_exceptions.rb +0 -19
- data/lib/contrast/utils/telemetry_client.rb +0 -107
- data/lib/contrast/utils/telemetry_hash.rb +0 -65
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'contrast/components/base'
|
@@ -11,15 +11,15 @@ module Contrast
|
|
11
11
|
include Contrast::Components::ComponentBase
|
12
12
|
|
13
13
|
# @return [Integer, nil]
|
14
|
-
|
14
|
+
attr_accessor :server_settings_ms
|
15
15
|
# @return [Integer, nil]
|
16
|
-
|
16
|
+
attr_accessor :app_settings_ms
|
17
17
|
# @return [String]
|
18
18
|
attr_reader :canon_name
|
19
19
|
# @return [Array]
|
20
20
|
attr_reader :config_values
|
21
21
|
# @return [Integer, nil]
|
22
|
-
|
22
|
+
attr_accessor :batch_reporting_interval_ms
|
23
23
|
|
24
24
|
CANON_NAME = 'agent.polling'
|
25
25
|
CONFIG_VALUES = %w[server_settings_ms app_settings_ms batch_reporting_interval_ms].cs__freeze
|
@@ -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/base'
|
@@ -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/base'
|
5
|
+
require 'contrast/components/scope'
|
5
6
|
|
6
7
|
module Contrast
|
7
8
|
module Components
|
8
9
|
module Ruby
|
9
10
|
# A wrapper build around the Common Agent Configuration project to allow
|
10
|
-
# for access of the values contained in its
|
11
|
-
#
|
12
|
-
# Those in this section pertain to the specific settings that apply to Ruby
|
11
|
+
# for access of the values contained in its parent_configuration_spec.yaml.
|
12
|
+
# Those in this section pertain to the specific settings that apply to Ruby.
|
13
13
|
class Interface
|
14
14
|
include Contrast::Components::ComponentBase
|
15
15
|
|
@@ -31,10 +31,36 @@ module Contrast
|
|
31
31
|
propagate_yield require_scan
|
32
32
|
non_request_tracking
|
33
33
|
uninstrument_namespace
|
34
|
+
application_scope
|
34
35
|
].cs__freeze
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
# Set a comma-separated string of rake tasks in which to disable agent operation.
|
38
|
+
#
|
39
|
+
# @return [Array]
|
40
|
+
attr_writer :disabled_agent_rake_tasks
|
41
|
+
# @return [ExceptionConfiguration]
|
42
|
+
attr_writer :exceptions
|
43
|
+
# Controls whether or not we patch the rb_yield block to track split propagation
|
44
|
+
#
|
45
|
+
# @return [Boolean]
|
46
|
+
attr_writer :propagate_yield
|
47
|
+
# Controls the scan of the given trace_point, built from an :end event, to determine
|
48
|
+
# where the loaded code lives and scanning that code for policy any violations.
|
49
|
+
# @return [Boolean]
|
50
|
+
attr_writer :require_scan
|
51
|
+
# Controls whether the agent should track outside request
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
attr_writer :non_request_tracking
|
55
|
+
# listed module names for skipping instrumentation.
|
56
|
+
#
|
57
|
+
# @return [Array]
|
58
|
+
attr_writer :uninstrument_namespace
|
59
|
+
# Controls if the agent should instrument only the application code
|
60
|
+
#
|
61
|
+
# @return[Boolean]
|
62
|
+
attr_accessor :application_scope
|
63
|
+
|
38
64
|
# @return [String]
|
39
65
|
attr_reader :canon_name
|
40
66
|
# @return [Array]
|
@@ -51,6 +77,9 @@ module Contrast
|
|
51
77
|
@require_scan = hsh[:require_scan]
|
52
78
|
@non_request_tracking = hsh[:non_request_tracking]
|
53
79
|
@uninstrument_namespace = hsh[:uninstrument_namespace]
|
80
|
+
# This value must only be read form ENV. The cs__with_app_scope? method handles the
|
81
|
+
# validation of the set Application Scope Flag.
|
82
|
+
@application_scope = Contrast::Components::Scope.cs__with_app_scope? == 1
|
54
83
|
end
|
55
84
|
|
56
85
|
# These commands being detected will result the agent disabling instrumentation, generally any command
|
@@ -90,6 +119,16 @@ module Contrast
|
|
90
119
|
def uninstrument_namespace
|
91
120
|
@uninstrument_namespace.nil? ? DEFAULT_UNINSTRUMENTED_NAMESPACES : @uninstrument_namespace
|
92
121
|
end
|
122
|
+
|
123
|
+
# Checks to see if we support with_app_scope for the current Agent Startup.
|
124
|
+
# Defaults to false if configuration is not set.
|
125
|
+
#
|
126
|
+
# @return [Boolean]
|
127
|
+
def start_with_application_scope?
|
128
|
+
return application_scope if application_scope
|
129
|
+
|
130
|
+
false
|
131
|
+
end
|
93
132
|
end
|
94
133
|
end
|
95
134
|
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/components/base'
|
@@ -107,15 +107,15 @@ module Contrast
|
|
107
107
|
CONFIG_VALUES = %w[enable baseline request_frequency response_frequency window_ms].cs__freeze
|
108
108
|
|
109
109
|
# @return [Integer, nil]
|
110
|
-
|
110
|
+
attr_accessor :baseline
|
111
111
|
# @return [Integer, nil]
|
112
|
-
|
112
|
+
attr_accessor :request_frequency
|
113
113
|
# @return [Integer, nil]
|
114
|
-
|
114
|
+
attr_accessor :response_frequency
|
115
115
|
# @return [Integer, nil]
|
116
|
-
|
116
|
+
attr_accessor :window_ms
|
117
117
|
# @return [String]
|
118
|
-
|
118
|
+
attr_accessor :canon_name
|
119
119
|
|
120
120
|
def initialize hsh = {}
|
121
121
|
@canon_name = CANON_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 'fiber'
|
@@ -129,6 +129,14 @@ module Contrast
|
|
129
129
|
ensure
|
130
130
|
scope_for_current_ec.exit_split_scope!
|
131
131
|
end
|
132
|
+
|
133
|
+
# Enter app scope
|
134
|
+
def with_app_scope
|
135
|
+
scope_for_current_ec.exit_contrast_scope!
|
136
|
+
yield
|
137
|
+
ensure
|
138
|
+
scope_for_current_ec.enter_contrast_scope!
|
139
|
+
end
|
132
140
|
end
|
133
141
|
|
134
142
|
ClassMethods = InstanceMethods
|
@@ -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/base'
|
@@ -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/excluder'
|
@@ -85,10 +85,6 @@ module Contrast
|
|
85
85
|
reset_state
|
86
86
|
end
|
87
87
|
|
88
|
-
def code_exclusions
|
89
|
-
excluder&.exclusions&.select(&:code?)
|
90
|
-
end
|
91
|
-
|
92
88
|
# @param features_response [Contrast::Agent::Reporting::Response]
|
93
89
|
def update_from_server_features features_response # rubocop:disable Metrics/AbcSize
|
94
90
|
return unless (server_features = features_response&.server_features)
|
@@ -116,7 +112,7 @@ module Contrast
|
|
116
112
|
# update via response header. We receive header from TS with last update info, setting the
|
117
113
|
# next request's header with the same time will save needless update of settings if there
|
118
114
|
# are no new server features updates after the said time.
|
119
|
-
@server_settings_last_httpdate =
|
115
|
+
@server_settings_last_httpdate = header_server_last_update
|
120
116
|
rescue StandardError => e
|
121
117
|
logger.warn('The following error occurred from server update: ', e: e)
|
122
118
|
end
|
@@ -168,7 +164,7 @@ module Contrast
|
|
168
164
|
new_session_id = app_settings.assess.session_id
|
169
165
|
@assess_state.session_id = new_session_id if new_session_id && !new_session_id.blank?
|
170
166
|
@last_app_update_ms = Contrast::Utils::Timer.now_ms
|
171
|
-
@app_settings_last_httpdate =
|
167
|
+
@app_settings_last_httpdate = header_application_last_update
|
172
168
|
end
|
173
169
|
|
174
170
|
# Wipe state to zero.
|
@@ -223,9 +219,6 @@ module Contrast
|
|
223
219
|
exclusions.input_exclusions.each do |exclusion|
|
224
220
|
matchers << Contrast::Agent::ExclusionMatcher.new(exclusion)
|
225
221
|
end
|
226
|
-
exclusions.code_exclusions.each do |exclusion|
|
227
|
-
matchers << Contrast::Agent::ExclusionMatcher.new(exclusion)
|
228
|
-
end
|
229
222
|
@excluder = Contrast::Agent::Excluder.new(matchers)
|
230
223
|
end
|
231
224
|
|
@@ -260,14 +253,22 @@ module Contrast
|
|
260
253
|
false
|
261
254
|
end
|
262
255
|
|
263
|
-
# update via response header.
|
256
|
+
# update server last updated via response header.
|
264
257
|
# Used to build the next request header.
|
265
258
|
#
|
266
259
|
# @return [String]
|
267
|
-
def
|
260
|
+
def header_server_last_update
|
268
261
|
Contrast::Agent.reporter.client.response_handler.last_server_modified
|
269
262
|
end
|
270
263
|
|
264
|
+
# update application last updated via response header.
|
265
|
+
# Used to build the next request header.
|
266
|
+
#
|
267
|
+
# @return [String]
|
268
|
+
def header_application_last_update
|
269
|
+
Contrast::Agent.reporter.client.response_handler.last_application_modified
|
270
|
+
end
|
271
|
+
|
271
272
|
# Update the stored config values to ensure that we know about the correct values,
|
272
273
|
# and that the sources are correct for entries updated from the UI.
|
273
274
|
#
|
@@ -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 'forwardable'
|
@@ -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/base'
|
@@ -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/config/effective_config'
|
@@ -9,9 +9,11 @@ module Contrast
|
|
9
9
|
# This class is responsible for logging to file the effective Agent configurations after startup.
|
10
10
|
class Config
|
11
11
|
attr_reader :effective_config
|
12
|
+
# @return [String] Status message of the connection with TS.
|
13
|
+
attr_accessor :config_status
|
12
14
|
|
13
15
|
MESSAGE_FAIL = 'Unable to connect to Contrast, configuration details from the Contrast UI will not be included.'
|
14
|
-
MESSAGE_SUCCESSFUL = '
|
16
|
+
MESSAGE_SUCCESSFUL = 'Success'
|
15
17
|
CONN_STATUS_MSG_FAILURE = 'Unable to connect to Contrast, insufficient connection properties provided.'
|
16
18
|
|
17
19
|
def initialize
|
@@ -21,15 +23,15 @@ module Contrast
|
|
21
23
|
|
22
24
|
# This method will set the status from the request/response cycles
|
23
25
|
#
|
24
|
-
# @param
|
25
|
-
def determine_config_status
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
# @param response_code [string]
|
27
|
+
def determine_config_status response_code
|
28
|
+
@config_status = case response_code
|
29
|
+
when '200', '304'
|
30
|
+
MESSAGE_SUCCESSFUL
|
31
|
+
else
|
32
|
+
MESSAGE_FAIL
|
33
|
+
end
|
34
|
+
true
|
33
35
|
end
|
34
36
|
|
35
37
|
# This method will set the status message from the config validation
|
@@ -38,7 +40,7 @@ module Contrast
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def to_controlled_hash
|
41
|
-
@effective_config.to_controlled_hash.merge({
|
43
|
+
@effective_config.to_controlled_hash.merge({ status: @config_status })
|
42
44
|
end
|
43
45
|
end
|
44
46
|
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 'json'
|
@@ -10,6 +10,7 @@ require 'contrast/utils/object_share'
|
|
10
10
|
require 'contrast/config/config'
|
11
11
|
require 'contrast/config/effective_config'
|
12
12
|
require 'contrast/config/effective_config_value'
|
13
|
+
require 'contrast/utils/duck_utils'
|
13
14
|
|
14
15
|
module Contrast
|
15
16
|
module Agent
|
@@ -77,13 +78,21 @@ module Contrast
|
|
77
78
|
|
78
79
|
# Reset the state of the current effective config.
|
79
80
|
def reset_config
|
81
|
+
# salvage status if status:
|
82
|
+
status = if Contrast::Utils::DuckUtils.empty_duck?(@_config.config_status)
|
83
|
+
nil
|
84
|
+
else
|
85
|
+
@_config.config_status
|
86
|
+
end
|
80
87
|
@_config = Contrast::Agent::DiagnosticsConfig::Config.new
|
88
|
+
@_config.config_status = status if status
|
89
|
+
@_config
|
81
90
|
end
|
82
91
|
|
83
92
|
def to_controlled_hash
|
84
93
|
{
|
85
|
-
|
86
|
-
|
94
|
+
report_create: report_create_time,
|
95
|
+
config: config.to_controlled_hash
|
87
96
|
}
|
88
97
|
end
|
89
98
|
|
@@ -1,7 +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/utils/object_share'
|
5
|
+
require 'contrast/config/effective_config_value'
|
5
6
|
|
6
7
|
module Contrast
|
7
8
|
module Agent
|
@@ -1,13 +1,17 @@
|
|
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/config/effective_config_value'
|
5
|
+
require 'contrast/config/diagnostics_tools'
|
6
|
+
require 'contrast/utils/object_share'
|
5
7
|
|
6
8
|
module Contrast
|
7
9
|
module Agent
|
8
10
|
module DiagnosticsConfig
|
9
11
|
# The current effective config received from all authorized configuration channels.
|
10
12
|
class EffectiveConfig
|
13
|
+
NON_COMMON_ENV = %w[CONTRAST_CONFIG_PATH CONTRAST_AGENT_TELEMETRY_OPTOUT].cs__freeze
|
14
|
+
|
11
15
|
# Value of effective agent configurations
|
12
16
|
#
|
13
17
|
# @return [Array]
|
@@ -19,11 +23,11 @@ module Contrast
|
|
19
23
|
|
20
24
|
def to_controlled_hash
|
21
25
|
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
effective_config: { values: @values&.map(&:to_controlled_hash) },
|
27
|
+
user_configuration_file: yaml_config_settings,
|
28
|
+
environment_variable: environment_settings(ENV).map(&:to_controlled_hash),
|
29
|
+
command_line: command_line_settings.map(&:to_controlled_hash),
|
30
|
+
contrast_ui: contrast_ui_settings.map(&:to_controlled_hash)
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
@@ -31,17 +35,36 @@ module Contrast
|
|
31
35
|
|
32
36
|
def yaml_config_settings
|
33
37
|
{
|
34
|
-
|
35
|
-
|
38
|
+
path: Contrast::CONFIG.config_file_path,
|
39
|
+
values: value_to_s(Contrast::CONFIG.sources.for(Contrast::Components::Config::Sources::YAML))
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
39
43
|
def command_line_settings
|
40
|
-
flatten_settings(Contrast::CONFIG.sources.for(Contrast::Components::Config::Sources::CLI))
|
44
|
+
cli = flatten_settings(Contrast::CONFIG.sources.for(Contrast::Components::Config::Sources::CLI))
|
45
|
+
flat_settings(cli)
|
41
46
|
end
|
42
47
|
|
43
48
|
def contrast_ui_settings
|
44
|
-
flatten_settings(Contrast::CONFIG.sources.for(Contrast::Components::Config::Sources::CONTRASTUI))
|
49
|
+
ui = flatten_settings(Contrast::CONFIG.sources.for(Contrast::Components::Config::Sources::CONTRASTUI))
|
50
|
+
flat_settings(ui)
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param flats [Array] of flatten configs produced by #flatten_settings
|
54
|
+
# @return [Array]
|
55
|
+
def flat_settings flats
|
56
|
+
ui_settings = []
|
57
|
+
flats.each do |entry|
|
58
|
+
entry.each do |key, value|
|
59
|
+
efc_value = Contrast::Agent::DiagnosticsConfig::EffectiveConfigValue.new.tap do |effective_value|
|
60
|
+
effective_value.canonical_name = Contrast::Utils::ObjectShare::CONTRAST_DOT + key
|
61
|
+
effective_value.name = key
|
62
|
+
effective_value.value = value_to_s(value)
|
63
|
+
end
|
64
|
+
ui_settings << efc_value if efc_value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
ui_settings
|
45
68
|
end
|
46
69
|
|
47
70
|
def flatten_settings data, path = []
|
@@ -49,15 +72,58 @@ module Contrast
|
|
49
72
|
if v.cs__is_a?(Hash)
|
50
73
|
entries.concat(flatten_settings(v, path.dup.append(k.to_sym)))
|
51
74
|
else
|
52
|
-
entries << { "#{ path.join('.') }.#{ k }" => Contrast::CONFIG.config.loaded_config.dig(*path, k) }
|
75
|
+
entries << { "#{ path.join('.') }.#{ k }" => Contrast::CONFIG.config.loaded_config.dig(*path, k).to_s }
|
53
76
|
end
|
54
77
|
end.flatten # rubocop:disable Style/MethodCalledOnDoEndBlock
|
55
78
|
end
|
56
79
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
80
|
+
# This method will fill the canonical name for each env var and will check for any uncommon ones.
|
81
|
+
#
|
82
|
+
# @param env [Hash]
|
83
|
+
# @return [Array] array of all the values needed to be written.
|
84
|
+
def environment_settings env
|
85
|
+
env_hash = env.select do |e|
|
86
|
+
e.to_s.start_with?(Contrast::Components::Config::CONTRAST_ENV_MARKER) || NON_COMMON_ENV.include?(e.to_s)
|
87
|
+
end
|
88
|
+
environment_settings = []
|
89
|
+
env_hash.each do |key, value|
|
90
|
+
efc_value = Contrast::Agent::DiagnosticsConfig::EffectiveConfigValue.new.tap do |effective_value|
|
91
|
+
next unless value
|
92
|
+
|
93
|
+
effective_value.canonical_name = if NON_COMMON_ENV.include?(key)
|
94
|
+
key.gsub(Contrast::Utils::ObjectShare::UNDERSCORE,
|
95
|
+
Contrast::Utils::ObjectShare::PERIOD).downcase
|
96
|
+
else
|
97
|
+
key.gsub(Contrast::Utils::ObjectShare::DOUBLE_UNDERSCORE,
|
98
|
+
Contrast::Utils::ObjectShare::PERIOD).downcase
|
99
|
+
end
|
100
|
+
if effective_value.canonical_name
|
101
|
+
effective_value.name =
|
102
|
+
effective_value.canonical_name.gsub(Contrast::Utils::ObjectShare::CONTRAST_DOT,
|
103
|
+
Contrast::Utils::ObjectShare::EMPTY_STRING)
|
104
|
+
end
|
105
|
+
effective_value.value = value_to_s(value)
|
106
|
+
end
|
107
|
+
environment_settings << efc_value if efc_value
|
108
|
+
end
|
109
|
+
environment_settings
|
110
|
+
end
|
111
|
+
|
112
|
+
# Recursively converts each value to string.
|
113
|
+
#
|
114
|
+
# @param value [Hash]
|
115
|
+
def value_to_s value
|
116
|
+
return value if value.cs__is_a?(String)
|
117
|
+
|
118
|
+
value.each_with_object({}) do |(k, v), m| # rubocop:disable Style/HashTransformValues
|
119
|
+
m[k] = if v.cs__is_a?(Hash)
|
120
|
+
value_to_s(v)
|
121
|
+
elsif v.cs__is_a?(Array)
|
122
|
+
v.map(&:to_s)
|
123
|
+
else
|
124
|
+
v.to_s
|
125
|
+
end
|
126
|
+
end
|
61
127
|
end
|
62
128
|
end
|
63
129
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Contrast
|
@@ -21,9 +21,9 @@ module Contrast
|
|
21
21
|
{
|
22
22
|
canonical_name: canonical_name,
|
23
23
|
name: name, # rubocop:disable Security/Module/Name
|
24
|
-
value: value,
|
25
|
-
|
26
|
-
|
24
|
+
value: value&.cs__is_a?(Array) ? value.map(&:to_s) : value.to_s,
|
25
|
+
source: source,
|
26
|
+
filename: filename
|
27
27
|
}.compact
|
28
28
|
end
|
29
29
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Contrast
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'contrast/components/base'
|
@@ -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 'set'
|
@@ -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/config/protect_rule_configuration'
|
@@ -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/base'
|
@@ -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/config/base_configuration'
|
@@ -15,7 +15,7 @@ module Contrast
|
|
15
15
|
CONFIG_VALUES = %w[tags environment version].cs__freeze
|
16
16
|
|
17
17
|
# @return [String, nil]
|
18
|
-
|
18
|
+
attr_accessor :name
|
19
19
|
# @return [String, nil]
|
20
20
|
attr_accessor :path
|
21
21
|
# @return [String, nil]
|
data/lib/contrast/config.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,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 'yaml'
|
@@ -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/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
|
# This module is used to track propagation through ERB template rendering
|
@@ -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/at_exit_hook'
|
@@ -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/policy/propagation_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,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/extension/assess/exec_trigger'
|