contrast-agent 6.6.3 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.gitmodules +0 -3
  4. data/ext/cs__scope/cs__scope.c +1 -1
  5. data/lib/contrast/agent/assess/contrast_event.rb +2 -24
  6. data/lib/contrast/agent/assess/events/source_event.rb +7 -61
  7. data/lib/contrast/agent/assess/finalizers/hash.rb +11 -0
  8. data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +0 -55
  9. data/lib/contrast/agent/assess/policy/policy_node.rb +3 -3
  10. data/lib/contrast/agent/assess/policy/policy_node_utils.rb +0 -1
  11. data/lib/contrast/agent/assess/policy/propagation_node.rb +4 -4
  12. data/lib/contrast/agent/assess/policy/source_method.rb +24 -1
  13. data/lib/contrast/agent/assess/policy/trigger/reflected_xss.rb +7 -5
  14. data/lib/contrast/agent/assess/policy/trigger/xpath.rb +6 -1
  15. data/lib/contrast/agent/assess/policy/trigger_method.rb +38 -119
  16. data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -3
  17. data/lib/contrast/agent/assess/property/evented.rb +2 -12
  18. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +42 -82
  19. data/lib/contrast/agent/assess/rule/response/base_rule.rb +11 -27
  20. data/lib/contrast/agent/assess/rule/response/body_rule.rb +1 -3
  21. data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +77 -62
  22. data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +1 -1
  23. data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +6 -1
  24. data/lib/contrast/agent/assess/rule/response/header_rule.rb +5 -5
  25. data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +1 -1
  26. data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -1
  27. data/lib/contrast/agent/assess/tracker.rb +1 -7
  28. data/lib/contrast/agent/at_exit_hook.rb +1 -7
  29. data/lib/contrast/agent/excluder.rb +206 -0
  30. data/lib/contrast/agent/exclusion_matcher.rb +6 -0
  31. data/lib/contrast/agent/inventory/database_config.rb +18 -23
  32. data/lib/contrast/agent/middleware.rb +0 -1
  33. data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +4 -0
  34. data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +1 -0
  35. data/lib/contrast/agent/protect/rule/base.rb +64 -24
  36. data/lib/contrast/agent/protect/rule/base_service.rb +1 -0
  37. data/lib/contrast/agent/protect/rule/cmd_injection.rb +18 -104
  38. data/lib/contrast/agent/protect/rule/cmdi/cmdi_backdoors.rb +129 -0
  39. data/lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb +169 -0
  40. data/lib/contrast/agent/protect/rule/deserialization.rb +7 -5
  41. data/lib/contrast/agent/protect/rule/path_traversal.rb +9 -7
  42. data/lib/contrast/agent/protect/rule/sql_sample_builder.rb +16 -14
  43. data/lib/contrast/agent/protect/rule/sqli/sqli_base_rule.rb +51 -0
  44. data/lib/contrast/agent/protect/rule/sqli/sqli_semantic/sqli_dangerous_functions.rb +67 -0
  45. data/lib/contrast/agent/protect/rule/sqli.rb +6 -31
  46. data/lib/contrast/agent/protect/rule/xxe.rb +11 -6
  47. data/lib/contrast/agent/protect/rule.rb +3 -1
  48. data/lib/contrast/agent/reporting/attack_result/attack_result.rb +8 -0
  49. data/lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb +91 -36
  50. data/lib/contrast/agent/reporting/attack_result/user_input.rb +11 -0
  51. data/lib/contrast/agent/reporting/details/bot_blocker_details.rb +29 -0
  52. data/lib/contrast/agent/reporting/details/cmd_injection_details.rb +30 -0
  53. data/lib/contrast/agent/reporting/details/details.rb +18 -0
  54. data/lib/contrast/agent/reporting/details/http_method_tempering_details.rb +27 -0
  55. data/lib/contrast/agent/reporting/details/ip_denylist_details.rb +27 -0
  56. data/lib/contrast/agent/reporting/details/no_sqli_details.rb +36 -0
  57. data/lib/contrast/agent/reporting/details/path_traversal_details.rb +24 -0
  58. data/lib/contrast/agent/reporting/details/path_traversal_semantic_analysis_details.rb +32 -0
  59. data/lib/contrast/agent/reporting/details/protect_rule_details.rb +17 -0
  60. data/lib/contrast/agent/reporting/details/sqli_dangerous_functions.rb +22 -0
  61. data/lib/contrast/agent/reporting/details/sqli_details.rb +36 -0
  62. data/lib/contrast/agent/reporting/details/untrusted_deserialization_details.rb +27 -0
  63. data/lib/contrast/agent/reporting/details/virtual_patch_details.rb +24 -0
  64. data/lib/contrast/agent/reporting/details/xss_details.rb +33 -0
  65. data/lib/contrast/agent/reporting/details/xss_match.rb +30 -0
  66. data/lib/contrast/agent/reporting/details/xxe_details.rb +36 -0
  67. data/lib/contrast/agent/reporting/details/xxe_match.rb +25 -0
  68. data/lib/contrast/agent/reporting/details/xxe_wrapper.rb +25 -0
  69. data/lib/contrast/agent/reporting/input_analysis/input_analysis_result.rb +1 -1
  70. data/lib/contrast/agent/reporting/masker/masker.rb +78 -65
  71. data/lib/contrast/agent/reporting/masker/masker_utils.rb +1 -30
  72. data/lib/contrast/agent/reporting/reporter.rb +1 -2
  73. data/lib/contrast/agent/reporting/reporting_events/agent_startup.rb +2 -2
  74. data/lib/contrast/agent/reporting/reporting_events/application_activity.rb +81 -15
  75. data/lib/contrast/agent/reporting/reporting_events/application_defend_activity.rb +13 -25
  76. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_activity.rb +17 -22
  77. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample.rb +46 -125
  78. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb +5 -16
  79. data/lib/contrast/agent/reporting/reporting_events/application_defend_attacker_activity.rb +10 -18
  80. data/lib/contrast/agent/reporting/reporting_events/application_inventory_activity.rb +6 -14
  81. data/lib/contrast/agent/reporting/reporting_events/application_startup.rb +1 -1
  82. data/lib/contrast/agent/reporting/reporting_events/architecture_component.rb +7 -21
  83. data/lib/contrast/agent/reporting/reporting_events/finding.rb +19 -49
  84. data/lib/contrast/agent/reporting/reporting_events/finding_event.rb +12 -9
  85. data/lib/contrast/agent/reporting/reporting_events/finding_event_signature.rb +1 -1
  86. data/lib/contrast/agent/reporting/reporting_events/finding_event_source.rb +23 -21
  87. data/lib/contrast/agent/reporting/reporting_events/finding_event_stack.rb +5 -18
  88. data/lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb +1 -0
  89. data/lib/contrast/{api/decorators/trace_taint_range_tags.rb → agent/reporting/reporting_events/finding_event_taint_range_tags.rb} +7 -6
  90. data/lib/contrast/agent/reporting/reporting_events/finding_request.rb +45 -10
  91. data/lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb +1 -1
  92. data/lib/contrast/agent/reporting/reporting_events/observed_route.rb +2 -2
  93. data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +10 -14
  94. data/lib/contrast/agent/reporting/reporting_events/reporting_event.rb +11 -0
  95. data/lib/contrast/agent/reporting/reporting_events/route_coverage.rb +3 -1
  96. data/lib/contrast/agent/reporting/reporting_events/route_discovery.rb +11 -23
  97. data/lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb +8 -26
  98. data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +1 -1
  99. data/lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb +4 -7
  100. data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +1 -1
  101. data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +2 -1
  102. data/lib/contrast/agent/reporting/reporting_utilities/reporter_client_utils.rb +3 -3
  103. data/lib/contrast/agent/request.rb +4 -2
  104. data/lib/contrast/agent/request_context.rb +12 -15
  105. data/lib/contrast/agent/request_context_extend.rb +67 -69
  106. data/lib/contrast/agent/request_handler.rb +1 -11
  107. data/lib/contrast/agent/response.rb +0 -18
  108. data/lib/contrast/agent/service_heartbeat.rb +1 -1
  109. data/lib/contrast/agent/telemetry/events/event.rb +1 -1
  110. data/lib/contrast/agent/telemetry/events/metric_event.rb +1 -1
  111. data/lib/contrast/agent/telemetry/events/startup_metrics_event.rb +3 -3
  112. data/lib/contrast/agent/version.rb +1 -1
  113. data/lib/contrast/api/communication/messaging_queue.rb +2 -3
  114. data/lib/contrast/api/communication/socket_client.rb +4 -4
  115. data/lib/contrast/api/communication/speedracer.rb +4 -8
  116. data/lib/contrast/api/decorators/agent_startup.rb +5 -6
  117. data/lib/contrast/api/decorators/application_settings.rb +2 -1
  118. data/lib/contrast/api/decorators/application_startup.rb +6 -6
  119. data/lib/contrast/api/decorators/message.rb +0 -4
  120. data/lib/contrast/api/decorators/rasp_rule_sample.rb +0 -6
  121. data/lib/contrast/api/decorators.rb +0 -6
  122. data/lib/contrast/api/dtm.pb.rb +0 -489
  123. data/lib/contrast/components/agent.rb +16 -12
  124. data/lib/contrast/components/api.rb +10 -10
  125. data/lib/contrast/components/app_context.rb +9 -9
  126. data/lib/contrast/components/app_context_extend.rb +1 -1
  127. data/lib/contrast/components/assess.rb +92 -38
  128. data/lib/contrast/components/assess_rules.rb +36 -0
  129. data/lib/contrast/components/config.rb +54 -12
  130. data/lib/contrast/components/contrast_service.rb +8 -8
  131. data/lib/contrast/components/heap_dump.rb +1 -1
  132. data/lib/contrast/components/protect.rb +5 -5
  133. data/lib/contrast/components/ruby_component.rb +81 -0
  134. data/lib/contrast/components/sampling.rb +1 -1
  135. data/lib/contrast/components/security_logger.rb +23 -0
  136. data/lib/contrast/components/service.rb +55 -0
  137. data/lib/contrast/components/settings.rb +12 -4
  138. data/lib/contrast/config/base_configuration.rb +1 -1
  139. data/lib/contrast/config/protect_rules_configuration.rb +17 -3
  140. data/lib/contrast/config/server_configuration.rb +1 -1
  141. data/lib/contrast/config.rb +0 -6
  142. data/lib/contrast/configuration.rb +81 -17
  143. data/lib/contrast/extension/assess/exec_trigger.rb +3 -1
  144. data/lib/contrast/extension/assess/marshal.rb +3 -2
  145. data/lib/contrast/extension/assess/string.rb +0 -1
  146. data/lib/contrast/extension/extension.rb +1 -1
  147. data/lib/contrast/framework/base_support.rb +0 -5
  148. data/lib/contrast/framework/grape/support.rb +1 -23
  149. data/lib/contrast/framework/manager.rb +0 -10
  150. data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +1 -6
  151. data/lib/contrast/framework/rails/support.rb +5 -58
  152. data/lib/contrast/framework/sinatra/support.rb +2 -21
  153. data/lib/contrast/logger/cef_log.rb +21 -3
  154. data/lib/contrast/logger/log.rb +1 -11
  155. data/lib/contrast/tasks/config.rb +4 -2
  156. data/lib/contrast/utils/assess/event_limit_utils.rb +28 -12
  157. data/lib/contrast/utils/assess/trigger_method_utils.rb +10 -18
  158. data/lib/contrast/utils/findings.rb +6 -5
  159. data/lib/contrast/utils/hash_digest.rb +9 -24
  160. data/lib/contrast/utils/hash_digest_extend.rb +6 -6
  161. data/lib/contrast/utils/invalid_configuration_util.rb +21 -58
  162. data/lib/contrast/utils/log_utils.rb +47 -17
  163. data/lib/contrast/utils/net_http_base.rb +7 -8
  164. data/lib/contrast/utils/patching/policy/patch_utils.rb +3 -2
  165. data/lib/contrast/utils/stack_trace_utils.rb +0 -25
  166. data/lib/contrast/utils/string_utils.rb +9 -0
  167. data/lib/contrast/utils/telemetry_client.rb +13 -7
  168. data/lib/contrast.rb +5 -10
  169. metadata +39 -28
  170. data/lib/contrast/agent/reporting/reporting_events/trace_event_source.rb +0 -30
  171. data/lib/contrast/agent/reporting/reporting_utilities/dtm_message.rb +0 -43
  172. data/lib/contrast/api/decorators/activity.rb +0 -33
  173. data/lib/contrast/api/decorators/architecture_component.rb +0 -36
  174. data/lib/contrast/api/decorators/finding.rb +0 -29
  175. data/lib/contrast/api/decorators/route_coverage.rb +0 -91
  176. data/lib/contrast/api/decorators/trace_event.rb +0 -120
  177. data/lib/contrast/api/decorators/trace_event_object.rb +0 -63
  178. data/lib/contrast/api/decorators/trace_event_signature.rb +0 -69
  179. data/lib/contrast/api/decorators/trace_taint_range.rb +0 -52
  180. data/lib/contrast/config/assess_configuration.rb +0 -93
  181. data/lib/contrast/config/assess_rules_configuration.rb +0 -32
  182. data/lib/contrast/config/root_configuration.rb +0 -90
  183. data/lib/contrast/config/ruby_configuration.rb +0 -81
  184. data/lib/contrast/config/service_configuration.rb +0 -49
  185. data/lib/contrast/utils/preflight_util.rb +0 -13
@@ -0,0 +1,18 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/bot_blocker_details'
5
+ require 'contrast/agent/reporting/details/cmd_injection_details'
6
+ require 'contrast/agent/reporting/details/http_method_tempering_details'
7
+ require 'contrast/agent/reporting/details/no_sqli_details'
8
+ require 'contrast/agent/reporting/details/path_traversal_details'
9
+ require 'contrast/agent/reporting/details/protect_rule_details'
10
+ require 'contrast/agent/reporting/details/sqli_details'
11
+ require 'contrast/agent/reporting/details/untrusted_deserialization_details'
12
+ require 'contrast/agent/reporting/details/xss_match'
13
+ require 'contrast/agent/reporting/details/xss_details'
14
+ require 'contrast/agent/reporting/details/xxe_details'
15
+ require 'contrast/agent/reporting/details/xxe_match'
16
+ require 'contrast/agent/reporting/details/xxe_wrapper'
17
+ require 'contrast/agent/reporting/details/virtual_patch_details'
18
+ require 'contrast/agent/reporting/details/ip_denylist_details'
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # HttpMethodTemperingDetails IA result details info.
11
+ class HttpMethodTemperingDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :method
14
+ # @return [Integer]
15
+ attr_accessor :response_code
16
+
17
+ def to_controlled_hash
18
+ {
19
+ method: method, # rubocop:disable Security/Object/Method
20
+ responseCode: response_code
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # Bot blocker IA result details info.
11
+ class IpDenylistDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :ip
14
+ # @return [String]
15
+ attr_accessor :uuid
16
+
17
+ def to_controlled_hash
18
+ {
19
+ ip: ip,
20
+ uuid: uuid
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # NoSqliDetails IA result details info.
11
+ class NoSqliDetails < ProtectRuleDetails
12
+ # @return [Integer]
13
+ attr_accessor :start_idx
14
+ # @return [Integer]
15
+ attr_accessor :end_idx
16
+ # @return [Integer]
17
+ attr_accessor :boundary_overrun_idx
18
+ # @return [Integer]
19
+ attr_accessor :input_boundary_idx
20
+ # @return [String]
21
+ attr_accessor :query
22
+
23
+ def to_controlled_hash
24
+ {
25
+ start: start_idx,
26
+ end: end_idx,
27
+ boundaryOverrunIndex: boundary_overrun_idx,
28
+ inputBoundaryIndex: input_boundary_idx,
29
+ query: query
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # PathTraversalDetails IA result details info.
11
+ class PathTraversalDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :path
14
+
15
+ def to_controlled_hash
16
+ {
17
+ path: path
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # PathTraversalDetails IA result details info.
11
+ class PathTraversalSemanticAnalysisDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :path
14
+ # @return [Array<Symbol>]
15
+ attr_accessor :findings
16
+
17
+ def initialize
18
+ @findings = []
19
+ super
20
+ end
21
+
22
+ def to_controlled_hash
23
+ {
24
+ path: path,
25
+ findings: findings&.map(&:to_s)
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,17 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ module Contrast
5
+ module Agent
6
+ module Reporting
7
+ module Details
8
+ # This class is holding additional info which is rule specific and this is
9
+ # the base class for type check made easy.
10
+ class ProtectRuleDetails
11
+ # Extend per each rule.
12
+ def to_controlled_hash; end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # SqliDangerousFunctions IA result details info.
11
+ class SqliDangerousFunctions < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :query
14
+
15
+ def to_controlled_hash
16
+ { query: query }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # SqliDetails IA result details info.
11
+ class SqliDetails < ProtectRuleDetails
12
+ # @return [Integer]
13
+ attr_accessor :start_idx
14
+ # @return [Integer]
15
+ attr_accessor :end_idx
16
+ # @return [Integer]
17
+ attr_accessor :boundary_overrun_idx
18
+ # @return [Integer]
19
+ attr_accessor :input_boundary_idx
20
+ # @return [String]
21
+ attr_accessor :query
22
+
23
+ def to_controlled_hash
24
+ {
25
+ start: start_idx,
26
+ end: end_idx,
27
+ boundaryOverrunIndex: boundary_overrun_idx,
28
+ inputBoundaryIndex: input_boundary_idx,
29
+ query: query
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # Untrusted Deserialization IA result details info.
11
+ class UntrustedDeserializationDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :cmd
14
+ # @return [String]
15
+ attr_accessor :deserializer
16
+
17
+ def to_controlled_hash
18
+ {
19
+ command: cmd,
20
+ deserializer: deserializer
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # Bot blocker IA result details info.
11
+ class VirtualPatchDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :uuid
14
+
15
+ def to_controlled_hash
16
+ {
17
+ uuid: uuid
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+ require 'contrast/agent/reporting/details/xss_match'
6
+
7
+ module Contrast
8
+ module Agent
9
+ module Reporting
10
+ module Details
11
+ # XssDetails IA result details info.
12
+ class XssDetails < ProtectRuleDetails
13
+ # @return [String]
14
+ attr_accessor :input
15
+ # @return [<Array<Contrast::Agent::Reporting::XssMatch>]
16
+ attr_accessor :matches
17
+
18
+ def initialize
19
+ @matches = []
20
+ super
21
+ end
22
+
23
+ def to_controlled_hash
24
+ {
25
+ input: input,
26
+ matches: matches&.map(&:to_controlled_hash)
27
+ }
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # Matcher data for XSS rule.
11
+ class XssMatch
12
+ # @return [Integer] in ms
13
+ attr_accessor :evidence_start
14
+ # @return [String]
15
+ attr_accessor :evidence
16
+ # @return [Integer]
17
+ attr_accessor :offset
18
+
19
+ def to_controlled_hash
20
+ {
21
+ evidenceStart: evidence_start,
22
+ evidence: evidence,
23
+ offset: offset
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/reporting/details/protect_rule_details'
5
+
6
+ module Contrast
7
+ module Agent
8
+ module Reporting
9
+ module Details
10
+ # XssDetails IA result details info.
11
+ class XxeDetails < ProtectRuleDetails
12
+ # @return [String]
13
+ attr_accessor :xml
14
+ # @return [<Array<Contrast::Agent::Reporting::Details::XxeMatch>]
15
+ attr_accessor :declared_entities
16
+ # @return [<Array<Contrast::Agent::Reporting::Details::XxeWrapper>]
17
+ attr_accessor :entities_resolved
18
+
19
+ def initialize
20
+ @declared_entities = []
21
+ @entities_resolved = []
22
+ super
23
+ end
24
+
25
+ def to_controlled_hash
26
+ {
27
+ xml: xml,
28
+ declaredEntities: declared_entities&.map(&:to_controlled_hash),
29
+ entitiesResolved: entities_resolved&.map(&:to_controlled_hash)
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ module Contrast
5
+ module Agent
6
+ module Reporting
7
+ module Details
8
+ # Matcher data for XXE rule.
9
+ class XxeMatch
10
+ # @return [Integer]
11
+ attr_accessor :start_idx
12
+ # @return [Integer]
13
+ attr_accessor :end_idx
14
+
15
+ def to_controlled_hash
16
+ {
17
+ start: start_idx,
18
+ end: end_idx
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ module Contrast
5
+ module Agent
6
+ module Reporting
7
+ module Details
8
+ # Wrapper data for XXE rule.
9
+ class XxeWrapper
10
+ # @return [String]
11
+ attr_accessor :system_id
12
+ # @return [String]
13
+ attr_accessor :public_id
14
+
15
+ def to_controlled_hash
16
+ {
17
+ systemId: system_id,
18
+ publicId: public_id
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -28,7 +28,7 @@ module Contrast
28
28
  # @return @_input_type [
29
29
  # Symbol<Contrast::Agent::Reporting::Settings::InputAnalysis::InputAnalysisResult::InputType>]
30
30
  def input_type
31
- @_input_type ||= INPUT_TYPE::UNDEFINED_TYPE
31
+ @_input_type ||= INPUT_TYPE::UNKNOWN
32
32
  end
33
33
 
34
34
  # @param input_type [