contrast-agent 6.6.4 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -2
  3. data/.gitmodules +0 -3
  4. data/.simplecov +0 -1
  5. data/Rakefile +0 -1
  6. data/ext/cs__assess_array/cs__assess_array.c +41 -10
  7. data/ext/cs__assess_array/cs__assess_array.h +4 -1
  8. data/ext/cs__scope/cs__scope.c +1 -1
  9. data/lib/contrast/agent/assess/contrast_event.rb +2 -24
  10. data/lib/contrast/agent/assess/events/source_event.rb +7 -61
  11. data/lib/contrast/agent/assess/finalizers/hash.rb +11 -0
  12. data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +0 -55
  13. data/lib/contrast/agent/assess/policy/policy_node.rb +3 -3
  14. data/lib/contrast/agent/assess/policy/policy_node_utils.rb +0 -1
  15. data/lib/contrast/agent/assess/policy/propagation_node.rb +4 -4
  16. data/lib/contrast/agent/assess/policy/source_method.rb +24 -1
  17. data/lib/contrast/agent/assess/policy/trigger/reflected_xss.rb +7 -5
  18. data/lib/contrast/agent/assess/policy/trigger/xpath.rb +6 -1
  19. data/lib/contrast/agent/assess/policy/trigger_method.rb +40 -121
  20. data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -3
  21. data/lib/contrast/agent/assess/policy/trigger_validation/redos_validator.rb +1 -1
  22. data/lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb +1 -1
  23. data/lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb +1 -1
  24. data/lib/contrast/agent/assess/property/evented.rb +2 -12
  25. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +42 -82
  26. data/lib/contrast/agent/assess/rule/response/base_rule.rb +11 -27
  27. data/lib/contrast/agent/assess/rule/response/body_rule.rb +1 -3
  28. data/lib/contrast/agent/assess/rule/response/cache_control_header_rule.rb +77 -62
  29. data/lib/contrast/agent/assess/rule/response/csp_header_insecure_rule.rb +1 -1
  30. data/lib/contrast/agent/assess/rule/response/framework/rails_support.rb +6 -1
  31. data/lib/contrast/agent/assess/rule/response/header_rule.rb +5 -5
  32. data/lib/contrast/agent/assess/rule/response/hsts_header_rule.rb +1 -1
  33. data/lib/contrast/agent/assess/rule/response/x_xss_protection_header_rule.rb +1 -1
  34. data/lib/contrast/agent/assess/tracker.rb +1 -7
  35. data/lib/contrast/agent/at_exit_hook.rb +1 -7
  36. data/lib/contrast/agent/excluder.rb +224 -0
  37. data/lib/contrast/agent/exclusion_matcher.rb +25 -7
  38. data/lib/contrast/agent/inventory/database_config.rb +18 -23
  39. data/lib/contrast/agent/middleware.rb +4 -5
  40. data/lib/contrast/agent/patching/policy/after_load_patcher.rb +6 -0
  41. data/lib/contrast/agent/protect/input_analyzer/input_analyzer.rb +146 -127
  42. data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +4 -0
  43. data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +20 -0
  44. data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +1 -0
  45. data/lib/contrast/agent/protect/policy/rule_applicator.rb +1 -1
  46. data/lib/contrast/agent/protect/rule/base.rb +98 -66
  47. data/lib/contrast/agent/protect/rule/base_service.rb +49 -24
  48. data/lib/contrast/agent/protect/rule/bot_blocker/bot_blocker_input_classification.rb +98 -0
  49. data/lib/contrast/agent/protect/rule/bot_blocker.rb +81 -0
  50. data/lib/contrast/agent/protect/rule/cmd_injection.rb +30 -99
  51. data/lib/contrast/agent/protect/rule/cmdi/cmdi_backdoors.rb +132 -0
  52. data/lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb +169 -0
  53. data/lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb +69 -0
  54. data/lib/contrast/agent/protect/rule/cmdi/cmdi_dangerous_path.rb +68 -0
  55. data/lib/contrast/agent/protect/rule/cmdi/cmdi_input_classification.rb +2 -58
  56. data/lib/contrast/agent/protect/rule/default_scanner.rb +1 -1
  57. data/lib/contrast/agent/protect/rule/deserialization.rb +10 -19
  58. data/lib/contrast/agent/protect/rule/http_method_tampering/http_method_tampering_input_classification.rb +2 -2
  59. data/lib/contrast/agent/protect/rule/http_method_tampering.rb +0 -11
  60. data/lib/contrast/agent/protect/rule/no_sqli/no_sqli_input_classification.rb +29 -34
  61. data/lib/contrast/agent/protect/rule/no_sqli.rb +25 -18
  62. data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_input_classification.rb +61 -0
  63. data/lib/contrast/agent/protect/rule/path_traversal/path_traversal_semantic_security_bypass.rb +114 -0
  64. data/lib/contrast/agent/protect/rule/path_traversal.rb +46 -18
  65. data/lib/contrast/agent/protect/rule/sql_sample_builder.rb +49 -29
  66. data/lib/contrast/agent/protect/rule/sqli/sqli_base_rule.rb +37 -0
  67. data/lib/contrast/agent/protect/rule/sqli/sqli_input_classification.rb +2 -62
  68. data/lib/contrast/agent/protect/rule/sqli/sqli_semantic/sqli_dangerous_functions.rb +67 -0
  69. data/lib/contrast/agent/protect/rule/sqli.rb +67 -22
  70. data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_input_classification.rb +39 -63
  71. data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +6 -33
  72. data/lib/contrast/agent/protect/rule/xss/reflected_xss_input_classification.rb +58 -0
  73. data/lib/contrast/agent/protect/rule/xss.rb +14 -20
  74. data/lib/contrast/agent/protect/rule/xxe.rb +15 -30
  75. data/lib/contrast/agent/protect/rule.rb +3 -1
  76. data/lib/contrast/agent/reporting/attack_result/attack_result.rb +8 -0
  77. data/lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb +70 -36
  78. data/lib/contrast/agent/reporting/attack_result/response_type.rb +9 -9
  79. data/lib/contrast/agent/reporting/attack_result/user_input.rb +11 -0
  80. data/lib/contrast/agent/reporting/details/bot_blocker_details.rb +29 -0
  81. data/lib/contrast/agent/reporting/details/cmd_injection_details.rb +30 -0
  82. data/lib/contrast/agent/reporting/details/details.rb +18 -0
  83. data/lib/contrast/agent/reporting/details/http_method_tempering_details.rb +27 -0
  84. data/lib/contrast/agent/reporting/details/ip_denylist_details.rb +35 -0
  85. data/lib/contrast/agent/reporting/details/no_sqli_details.rb +36 -0
  86. data/lib/contrast/agent/reporting/details/path_traversal_details.rb +24 -0
  87. data/lib/contrast/agent/reporting/details/path_traversal_semantic_analysis_details.rb +32 -0
  88. data/lib/contrast/agent/reporting/details/protect_rule_details.rb +17 -0
  89. data/lib/contrast/agent/reporting/details/sqli_dangerous_functions.rb +22 -0
  90. data/lib/contrast/agent/reporting/details/sqli_details.rb +36 -0
  91. data/lib/contrast/agent/reporting/details/untrusted_deserialization_details.rb +27 -0
  92. data/lib/contrast/agent/reporting/details/virtual_patch_details.rb +30 -0
  93. data/lib/contrast/agent/reporting/details/xss_details.rb +33 -0
  94. data/lib/contrast/agent/reporting/details/xss_match.rb +30 -0
  95. data/lib/contrast/agent/reporting/details/xxe_details.rb +36 -0
  96. data/lib/contrast/agent/reporting/details/xxe_match.rb +25 -0
  97. data/lib/contrast/agent/reporting/details/xxe_wrapper.rb +25 -0
  98. data/lib/contrast/agent/reporting/input_analysis/details/bot_blocker_details.rb +27 -0
  99. data/lib/contrast/agent/reporting/input_analysis/details/protect_rule_details.rb +15 -0
  100. data/lib/contrast/agent/reporting/input_analysis/input_analysis.rb +1 -2
  101. data/lib/contrast/agent/reporting/input_analysis/input_analysis_result.rb +17 -3
  102. data/lib/contrast/agent/reporting/masker/masker.rb +80 -65
  103. data/lib/contrast/agent/reporting/masker/masker_utils.rb +1 -30
  104. data/lib/contrast/agent/reporting/reporter.rb +1 -15
  105. data/lib/contrast/agent/reporting/reporting_events/agent_startup.rb +2 -2
  106. data/lib/contrast/agent/reporting/reporting_events/application_activity.rb +84 -15
  107. data/lib/contrast/agent/reporting/reporting_events/application_defend_activity.rb +13 -25
  108. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_activity.rb +19 -24
  109. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample.rb +46 -126
  110. data/lib/contrast/agent/reporting/reporting_events/application_defend_attack_sample_activity.rb +5 -16
  111. data/lib/contrast/agent/reporting/reporting_events/application_defend_attacker_activity.rb +10 -18
  112. data/lib/contrast/agent/reporting/reporting_events/application_inventory_activity.rb +6 -14
  113. data/lib/contrast/agent/reporting/reporting_events/application_startup.rb +1 -1
  114. data/lib/contrast/agent/reporting/reporting_events/application_update.rb +0 -2
  115. data/lib/contrast/agent/reporting/reporting_events/architecture_component.rb +7 -22
  116. data/lib/contrast/agent/reporting/reporting_events/finding.rb +23 -53
  117. data/lib/contrast/agent/reporting/reporting_events/finding_event.rb +12 -9
  118. data/lib/contrast/agent/reporting/reporting_events/finding_event_signature.rb +1 -1
  119. data/lib/contrast/agent/reporting/reporting_events/finding_event_source.rb +23 -21
  120. data/lib/contrast/agent/reporting/reporting_events/finding_event_stack.rb +5 -18
  121. data/lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb +1 -0
  122. data/lib/contrast/{api/decorators/trace_taint_range_tags.rb → agent/reporting/reporting_events/finding_event_taint_range_tags.rb} +7 -6
  123. data/lib/contrast/agent/reporting/reporting_events/finding_request.rb +40 -10
  124. data/lib/contrast/agent/reporting/reporting_events/library_discovery.rb +0 -1
  125. data/lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb +1 -1
  126. data/lib/contrast/agent/reporting/reporting_events/observed_route.rb +2 -2
  127. data/lib/contrast/agent/reporting/reporting_events/poll.rb +1 -11
  128. data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +10 -14
  129. data/lib/contrast/agent/reporting/reporting_events/reporting_event.rb +11 -0
  130. data/lib/contrast/agent/reporting/reporting_events/route_coverage.rb +3 -1
  131. data/lib/contrast/agent/reporting/reporting_events/route_discovery.rb +12 -25
  132. data/lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb +8 -27
  133. data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +3 -3
  134. data/lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb +4 -7
  135. data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +1 -1
  136. data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +2 -1
  137. data/lib/contrast/agent/reporting/reporting_utilities/reporter_client_utils.rb +3 -3
  138. data/lib/contrast/agent/reporting/reporting_utilities/response.rb +1 -1
  139. data/lib/contrast/agent/reporting/reporting_utilities/response_handler.rb +0 -3
  140. data/lib/contrast/agent/reporting/reporting_utilities/response_handler_utils.rb +1 -0
  141. data/lib/contrast/agent/reporting/settings/code_exclusion.rb +6 -1
  142. data/lib/contrast/agent/reporting/settings/exclusion_base.rb +18 -0
  143. data/lib/contrast/agent/reporting/settings/exclusions.rb +2 -1
  144. data/lib/contrast/agent/reporting/settings/input_exclusion.rb +9 -3
  145. data/lib/contrast/agent/reporting/settings/protect.rb +15 -15
  146. data/lib/contrast/agent/request.rb +4 -14
  147. data/lib/contrast/agent/request_context.rb +18 -24
  148. data/lib/contrast/agent/request_context_extend.rb +23 -164
  149. data/lib/contrast/agent/request_handler.rb +1 -11
  150. data/lib/contrast/agent/response.rb +0 -18
  151. data/lib/contrast/agent/telemetry/events/event.rb +1 -1
  152. data/lib/contrast/agent/telemetry/events/metric_event.rb +1 -1
  153. data/lib/contrast/agent/telemetry/events/startup_metrics_event.rb +3 -3
  154. data/lib/contrast/agent/thread_watcher.rb +3 -18
  155. data/lib/contrast/agent/version.rb +1 -1
  156. data/lib/contrast/agent.rb +0 -11
  157. data/lib/contrast/agent_lib/api/command_injection.rb +46 -0
  158. data/lib/contrast/agent_lib/api/init.rb +101 -0
  159. data/lib/contrast/agent_lib/api/input_tracing.rb +267 -0
  160. data/lib/contrast/agent_lib/api/method_tempering.rb +29 -0
  161. data/lib/contrast/agent_lib/api/panic.rb +87 -0
  162. data/lib/contrast/agent_lib/api/path_semantic_file_security_bypass.rb +40 -0
  163. data/lib/contrast/agent_lib/interface.rb +260 -0
  164. data/lib/contrast/agent_lib/interface_base.rb +118 -0
  165. data/lib/contrast/agent_lib/return_types/eval_result.rb +44 -0
  166. data/lib/contrast/agent_lib/test.rb +29 -0
  167. data/lib/contrast/api/communication/connection_status.rb +5 -5
  168. data/lib/contrast/components/agent.rb +13 -23
  169. data/lib/contrast/components/api.rb +10 -10
  170. data/lib/contrast/components/app_context.rb +9 -11
  171. data/lib/contrast/components/app_context_extend.rb +1 -26
  172. data/lib/contrast/components/assess.rb +92 -38
  173. data/lib/contrast/components/assess_rules.rb +36 -0
  174. data/lib/contrast/components/config.rb +49 -24
  175. data/lib/contrast/components/heap_dump.rb +1 -1
  176. data/lib/contrast/components/protect.rb +9 -6
  177. data/lib/contrast/components/ruby_component.rb +81 -0
  178. data/lib/contrast/components/sampling.rb +1 -1
  179. data/lib/contrast/components/security_logger.rb +23 -0
  180. data/lib/contrast/components/settings.rb +41 -85
  181. data/lib/contrast/config/base_configuration.rb +1 -1
  182. data/lib/contrast/config/protect_rule_configuration.rb +7 -7
  183. data/lib/contrast/config/protect_rules_configuration.rb +24 -48
  184. data/lib/contrast/config/server_configuration.rb +1 -1
  185. data/lib/contrast/config.rb +0 -6
  186. data/lib/contrast/configuration.rb +73 -18
  187. data/lib/contrast/extension/assess/array.rb +9 -0
  188. data/lib/contrast/extension/assess/exec_trigger.rb +3 -1
  189. data/lib/contrast/extension/assess/marshal.rb +3 -2
  190. data/lib/contrast/extension/assess/string.rb +0 -1
  191. data/lib/contrast/extension/delegator.rb +2 -0
  192. data/lib/contrast/extension/extension.rb +1 -1
  193. data/lib/contrast/framework/base_support.rb +0 -5
  194. data/lib/contrast/framework/grape/support.rb +1 -23
  195. data/lib/contrast/framework/manager.rb +3 -11
  196. data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +1 -6
  197. data/lib/contrast/framework/rails/railtie.rb +0 -1
  198. data/lib/contrast/framework/rails/support.rb +5 -59
  199. data/lib/contrast/framework/sinatra/support.rb +2 -21
  200. data/lib/contrast/logger/cef_log.rb +21 -3
  201. data/lib/contrast/logger/log.rb +1 -11
  202. data/lib/contrast/tasks/config.rb +5 -10
  203. data/lib/contrast/utils/assess/event_limit_utils.rb +28 -12
  204. data/lib/contrast/utils/assess/trigger_method_utils.rb +10 -18
  205. data/lib/contrast/utils/duck_utils.rb +1 -0
  206. data/lib/contrast/utils/findings.rb +6 -5
  207. data/lib/contrast/utils/hash_digest.rb +9 -24
  208. data/lib/contrast/utils/hash_digest_extend.rb +6 -6
  209. data/lib/contrast/utils/input_classification_base.rb +156 -0
  210. data/lib/contrast/utils/invalid_configuration_util.rb +21 -58
  211. data/lib/contrast/utils/log_utils.rb +47 -17
  212. data/lib/contrast/utils/net_http_base.rb +2 -2
  213. data/lib/contrast/utils/os.rb +0 -20
  214. data/lib/contrast/utils/patching/policy/patch_utils.rb +3 -2
  215. data/lib/contrast/utils/response_utils.rb +0 -16
  216. data/lib/contrast/utils/stack_trace_utils.rb +3 -40
  217. data/lib/contrast/utils/string_utils.rb +19 -7
  218. data/lib/contrast/utils/telemetry_client.rb +13 -7
  219. data/lib/contrast.rb +7 -13
  220. data/resources/protect/policy.json +1 -2
  221. data/ruby-agent.gemspec +2 -5
  222. metadata +78 -137
  223. data/exe/contrast_service +0 -23
  224. data/lib/contrast/agent/protect/rule/cmdi/cmdi_worth_watching.rb +0 -64
  225. data/lib/contrast/agent/protect/rule/sqli/sqli_worth_watching.rb +0 -118
  226. data/lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_matcher.rb +0 -45
  227. data/lib/contrast/agent/reaction_processor.rb +0 -47
  228. data/lib/contrast/agent/reporting/reporting_events/trace_event_source.rb +0 -30
  229. data/lib/contrast/agent/reporting/reporting_utilities/dtm_message.rb +0 -43
  230. data/lib/contrast/agent/service_heartbeat.rb +0 -35
  231. data/lib/contrast/api/communication/messaging_queue.rb +0 -129
  232. data/lib/contrast/api/communication/response_processor.rb +0 -90
  233. data/lib/contrast/api/communication/service_lifecycle.rb +0 -77
  234. data/lib/contrast/api/communication/socket.rb +0 -44
  235. data/lib/contrast/api/communication/socket_client.rb +0 -130
  236. data/lib/contrast/api/communication/speedracer.rb +0 -142
  237. data/lib/contrast/api/communication/tcp_socket.rb +0 -32
  238. data/lib/contrast/api/communication/unix_socket.rb +0 -28
  239. data/lib/contrast/api/communication.rb +0 -20
  240. data/lib/contrast/api/decorators/activity.rb +0 -33
  241. data/lib/contrast/api/decorators/address.rb +0 -59
  242. data/lib/contrast/api/decorators/agent_startup.rb +0 -57
  243. data/lib/contrast/api/decorators/application_settings.rb +0 -42
  244. data/lib/contrast/api/decorators/application_startup.rb +0 -56
  245. data/lib/contrast/api/decorators/architecture_component.rb +0 -36
  246. data/lib/contrast/api/decorators/bot_blocker.rb +0 -37
  247. data/lib/contrast/api/decorators/finding.rb +0 -29
  248. data/lib/contrast/api/decorators/http_request.rb +0 -137
  249. data/lib/contrast/api/decorators/input_analysis.rb +0 -18
  250. data/lib/contrast/api/decorators/instrumentation_mode.rb +0 -35
  251. data/lib/contrast/api/decorators/ip_denylist.rb +0 -37
  252. data/lib/contrast/api/decorators/message.rb +0 -71
  253. data/lib/contrast/api/decorators/rasp_rule_sample.rb +0 -58
  254. data/lib/contrast/api/decorators/response_type.rb +0 -17
  255. data/lib/contrast/api/decorators/route_coverage.rb +0 -91
  256. data/lib/contrast/api/decorators/server_features.rb +0 -25
  257. data/lib/contrast/api/decorators/trace_event.rb +0 -120
  258. data/lib/contrast/api/decorators/trace_event_object.rb +0 -63
  259. data/lib/contrast/api/decorators/trace_event_signature.rb +0 -69
  260. data/lib/contrast/api/decorators/trace_taint_range.rb +0 -52
  261. data/lib/contrast/api/decorators/user_input.rb +0 -51
  262. data/lib/contrast/api/decorators/virtual_patch.rb +0 -34
  263. data/lib/contrast/api/decorators.rb +0 -28
  264. data/lib/contrast/api/dtm.pb.rb +0 -852
  265. data/lib/contrast/api/settings.pb.rb +0 -500
  266. data/lib/contrast/api.rb +0 -16
  267. data/lib/contrast/components/contrast_service.rb +0 -88
  268. data/lib/contrast/config/assess_configuration.rb +0 -93
  269. data/lib/contrast/config/assess_rules_configuration.rb +0 -32
  270. data/lib/contrast/config/root_configuration.rb +0 -90
  271. data/lib/contrast/config/ruby_configuration.rb +0 -81
  272. data/lib/contrast/config/service_configuration.rb +0 -49
  273. data/lib/contrast/tasks/service.rb +0 -84
  274. data/lib/contrast/utils/input_classification.rb +0 -73
  275. data/lib/contrast/utils/preflight_util.rb +0 -13
  276. data/lib/protobuf/code_generator.rb +0 -129
  277. data/lib/protobuf/decoder.rb +0 -28
  278. data/lib/protobuf/deprecation.rb +0 -117
  279. data/lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb +0 -79
  280. data/lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb +0 -360
  281. data/lib/protobuf/descriptors.rb +0 -3
  282. data/lib/protobuf/encoder.rb +0 -11
  283. data/lib/protobuf/enum.rb +0 -365
  284. data/lib/protobuf/exceptions.rb +0 -9
  285. data/lib/protobuf/field/base_field.rb +0 -380
  286. data/lib/protobuf/field/base_field_object_definitions.rb +0 -504
  287. data/lib/protobuf/field/bool_field.rb +0 -64
  288. data/lib/protobuf/field/bytes_field.rb +0 -67
  289. data/lib/protobuf/field/double_field.rb +0 -25
  290. data/lib/protobuf/field/enum_field.rb +0 -56
  291. data/lib/protobuf/field/field_array.rb +0 -102
  292. data/lib/protobuf/field/field_hash.rb +0 -122
  293. data/lib/protobuf/field/fixed32_field.rb +0 -25
  294. data/lib/protobuf/field/fixed64_field.rb +0 -28
  295. data/lib/protobuf/field/float_field.rb +0 -43
  296. data/lib/protobuf/field/int32_field.rb +0 -21
  297. data/lib/protobuf/field/int64_field.rb +0 -34
  298. data/lib/protobuf/field/integer_field.rb +0 -23
  299. data/lib/protobuf/field/message_field.rb +0 -51
  300. data/lib/protobuf/field/sfixed32_field.rb +0 -27
  301. data/lib/protobuf/field/sfixed64_field.rb +0 -28
  302. data/lib/protobuf/field/signed_integer_field.rb +0 -29
  303. data/lib/protobuf/field/sint32_field.rb +0 -21
  304. data/lib/protobuf/field/sint64_field.rb +0 -21
  305. data/lib/protobuf/field/string_field.rb +0 -51
  306. data/lib/protobuf/field/uint32_field.rb +0 -21
  307. data/lib/protobuf/field/uint64_field.rb +0 -21
  308. data/lib/protobuf/field/varint_field.rb +0 -77
  309. data/lib/protobuf/field.rb +0 -74
  310. data/lib/protobuf/generators/base.rb +0 -85
  311. data/lib/protobuf/generators/enum_generator.rb +0 -39
  312. data/lib/protobuf/generators/extension_generator.rb +0 -27
  313. data/lib/protobuf/generators/field_generator.rb +0 -193
  314. data/lib/protobuf/generators/file_generator.rb +0 -262
  315. data/lib/protobuf/generators/group_generator.rb +0 -122
  316. data/lib/protobuf/generators/message_generator.rb +0 -104
  317. data/lib/protobuf/generators/option_generator.rb +0 -17
  318. data/lib/protobuf/generators/printable.rb +0 -160
  319. data/lib/protobuf/generators/service_generator.rb +0 -50
  320. data/lib/protobuf/lifecycle.rb +0 -33
  321. data/lib/protobuf/logging.rb +0 -39
  322. data/lib/protobuf/message/fields.rb +0 -233
  323. data/lib/protobuf/message/serialization.rb +0 -85
  324. data/lib/protobuf/message.rb +0 -241
  325. data/lib/protobuf/optionable.rb +0 -72
  326. data/lib/protobuf/tasks/compile.rake +0 -80
  327. data/lib/protobuf/tasks.rb +0 -1
  328. data/lib/protobuf/varint.rb +0 -20
  329. data/lib/protobuf/varint_pure.rb +0 -31
  330. data/lib/protobuf/version.rb +0 -3
  331. data/lib/protobuf/wire_type.rb +0 -10
  332. data/lib/protobuf.rb +0 -91
  333. data/proto/dynamic_discovery.proto +0 -46
  334. data/proto/google/protobuf/compiler/plugin.proto +0 -183
  335. data/proto/google/protobuf/descriptor.proto +0 -911
  336. data/proto/rpc.proto +0 -71
  337. data/service_executables/.gitkeep +0 -0
  338. data/service_executables/VERSION +0 -1
  339. data/service_executables/linux/contrast-service +0 -0
  340. data/service_executables/mac/contrast-service +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contrast-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.4
4
+ version: 6.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - galen.palmer@contrastsecurity.com
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2022-07-20 00:00:00.000000000 Z
16
+ date: 2022-09-08 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -644,43 +644,56 @@ dependencies:
644
644
  - !ruby/object:Gem::Version
645
645
  version: '2.0'
646
646
  - !ruby/object:Gem::Dependency
647
- name: activesupport
647
+ name: contrast-agent-lib
648
648
  requirement: !ruby/object:Gem::Requirement
649
649
  requirements:
650
- - - ">="
650
+ - - "~>"
651
651
  - !ruby/object:Gem::Version
652
- version: '3.2'
652
+ version: 0.1.0
653
653
  type: :runtime
654
654
  prerelease: false
655
655
  version_requirements: !ruby/object:Gem::Requirement
656
656
  requirements:
657
- - - ">="
657
+ - - "~>"
658
+ - !ruby/object:Gem::Version
659
+ version: 0.1.0
660
+ - !ruby/object:Gem::Dependency
661
+ name: ffi
662
+ requirement: !ruby/object:Gem::Requirement
663
+ requirements:
664
+ - - "~>"
658
665
  - !ruby/object:Gem::Version
659
- version: '3.2'
666
+ version: '1.0'
667
+ type: :runtime
668
+ prerelease: false
669
+ version_requirements: !ruby/object:Gem::Requirement
670
+ requirements:
671
+ - - "~>"
672
+ - !ruby/object:Gem::Version
673
+ version: '1.0'
660
674
  description: This gem instantiates a Rack middleware for rack-based web applications
661
675
  in order to provide Interactive Application Security Testing and Protection.
662
676
  email:
663
677
  - ruby@contrastsecurity.com
664
- executables:
665
- - contrast_service
678
+ executables: []
666
679
  extensions:
667
680
  - ext/cs__common/extconf.rb
668
- - ext/cs__tests/extconf.rb
669
- - ext/cs__assess_module/extconf.rb
670
- - ext/cs__assess_array/extconf.rb
671
681
  - ext/cs__assess_hash/extconf.rb
672
682
  - ext/cs__assess_basic_object/extconf.rb
673
- - ext/cs__assess_regexp/extconf.rb
674
- - ext/cs__os_information/extconf.rb
675
- - ext/cs__assess_test/extconf.rb
676
683
  - ext/cs__assess_string/extconf.rb
677
- - ext/cs__contrast_patch/extconf.rb
684
+ - ext/cs__assess_regexp/extconf.rb
685
+ - ext/cs__assess_yield_track/extconf.rb
678
686
  - ext/cs__assess_string_interpolation/extconf.rb
679
687
  - ext/cs__scope/extconf.rb
688
+ - ext/cs__contrast_patch/extconf.rb
689
+ - ext/cs__assess_module/extconf.rb
690
+ - ext/cs__assess_kernel/extconf.rb
680
691
  - ext/cs__assess_marshal_module/extconf.rb
692
+ - ext/cs__assess_test/extconf.rb
693
+ - ext/cs__os_information/extconf.rb
694
+ - ext/cs__assess_array/extconf.rb
695
+ - ext/cs__tests/extconf.rb
681
696
  - ext/cs__assess_fiber_track/extconf.rb
682
- - ext/cs__assess_yield_track/extconf.rb
683
- - ext/cs__assess_kernel/extconf.rb
684
697
  extra_rdoc_files: []
685
698
  files:
686
699
  - ".clang-format"
@@ -694,7 +707,6 @@ files:
694
707
  - Gemfile
695
708
  - LICENSE.txt
696
709
  - Rakefile
697
- - exe/contrast_service
698
710
  - ext/build_funchook.rb
699
711
  - ext/cs__assess_array/cs__assess_array.c
700
712
  - ext/cs__assess_array/cs__assess_array.h
@@ -960,6 +972,7 @@ files:
960
972
  - lib/contrast/agent/deadzone/policy/deadzone_node.rb
961
973
  - lib/contrast/agent/deadzone/policy/policy.rb
962
974
  - lib/contrast/agent/disable_reaction.rb
975
+ - lib/contrast/agent/excluder.rb
963
976
  - lib/contrast/agent/exclusion_matcher.rb
964
977
  - lib/contrast/agent/inventory.rb
965
978
  - lib/contrast/agent/inventory/database_config.rb
@@ -996,9 +1009,14 @@ files:
996
1009
  - lib/contrast/agent/protect/rule.rb
997
1010
  - lib/contrast/agent/protect/rule/base.rb
998
1011
  - lib/contrast/agent/protect/rule/base_service.rb
1012
+ - lib/contrast/agent/protect/rule/bot_blocker.rb
1013
+ - lib/contrast/agent/protect/rule/bot_blocker/bot_blocker_input_classification.rb
999
1014
  - lib/contrast/agent/protect/rule/cmd_injection.rb
1015
+ - lib/contrast/agent/protect/rule/cmdi/cmdi_backdoors.rb
1016
+ - lib/contrast/agent/protect/rule/cmdi/cmdi_base_rule.rb
1017
+ - lib/contrast/agent/protect/rule/cmdi/cmdi_chained_command.rb
1018
+ - lib/contrast/agent/protect/rule/cmdi/cmdi_dangerous_path.rb
1000
1019
  - lib/contrast/agent/protect/rule/cmdi/cmdi_input_classification.rb
1001
- - lib/contrast/agent/protect/rule/cmdi/cmdi_worth_watching.rb
1002
1020
  - lib/contrast/agent/protect/rule/default_scanner.rb
1003
1021
  - lib/contrast/agent/protect/rule/deserialization.rb
1004
1022
  - lib/contrast/agent/protect/rule/http_method_tampering.rb
@@ -1007,25 +1025,47 @@ files:
1007
1025
  - lib/contrast/agent/protect/rule/no_sqli/mongo_no_sql_scanner.rb
1008
1026
  - lib/contrast/agent/protect/rule/no_sqli/no_sqli_input_classification.rb
1009
1027
  - lib/contrast/agent/protect/rule/path_traversal.rb
1028
+ - lib/contrast/agent/protect/rule/path_traversal/path_traversal_input_classification.rb
1029
+ - lib/contrast/agent/protect/rule/path_traversal/path_traversal_semantic_security_bypass.rb
1010
1030
  - lib/contrast/agent/protect/rule/sql_sample_builder.rb
1011
1031
  - lib/contrast/agent/protect/rule/sqli.rb
1012
1032
  - lib/contrast/agent/protect/rule/sqli/default_sql_scanner.rb
1013
1033
  - lib/contrast/agent/protect/rule/sqli/mysql_sql_scanner.rb
1014
1034
  - lib/contrast/agent/protect/rule/sqli/postgres_sql_scanner.rb
1035
+ - lib/contrast/agent/protect/rule/sqli/sqli_base_rule.rb
1015
1036
  - lib/contrast/agent/protect/rule/sqli/sqli_input_classification.rb
1016
- - lib/contrast/agent/protect/rule/sqli/sqli_worth_watching.rb
1037
+ - lib/contrast/agent/protect/rule/sqli/sqli_semantic/sqli_dangerous_functions.rb
1017
1038
  - lib/contrast/agent/protect/rule/sqli/sqlite_sql_scanner.rb
1018
1039
  - lib/contrast/agent/protect/rule/unsafe_file_upload.rb
1019
1040
  - lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_input_classification.rb
1020
- - lib/contrast/agent/protect/rule/unsafe_file_upload/unsafe_file_upload_matcher.rb
1021
1041
  - lib/contrast/agent/protect/rule/xss.rb
1042
+ - lib/contrast/agent/protect/rule/xss/reflected_xss_input_classification.rb
1022
1043
  - lib/contrast/agent/protect/rule/xxe.rb
1023
1044
  - lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb
1024
- - lib/contrast/agent/reaction_processor.rb
1025
1045
  - lib/contrast/agent/reporting/attack_result/attack_result.rb
1026
1046
  - lib/contrast/agent/reporting/attack_result/rasp_rule_sample.rb
1027
1047
  - lib/contrast/agent/reporting/attack_result/response_type.rb
1028
1048
  - lib/contrast/agent/reporting/attack_result/user_input.rb
1049
+ - lib/contrast/agent/reporting/details/bot_blocker_details.rb
1050
+ - lib/contrast/agent/reporting/details/cmd_injection_details.rb
1051
+ - lib/contrast/agent/reporting/details/details.rb
1052
+ - lib/contrast/agent/reporting/details/http_method_tempering_details.rb
1053
+ - lib/contrast/agent/reporting/details/ip_denylist_details.rb
1054
+ - lib/contrast/agent/reporting/details/no_sqli_details.rb
1055
+ - lib/contrast/agent/reporting/details/path_traversal_details.rb
1056
+ - lib/contrast/agent/reporting/details/path_traversal_semantic_analysis_details.rb
1057
+ - lib/contrast/agent/reporting/details/protect_rule_details.rb
1058
+ - lib/contrast/agent/reporting/details/sqli_dangerous_functions.rb
1059
+ - lib/contrast/agent/reporting/details/sqli_details.rb
1060
+ - lib/contrast/agent/reporting/details/untrusted_deserialization_details.rb
1061
+ - lib/contrast/agent/reporting/details/virtual_patch_details.rb
1062
+ - lib/contrast/agent/reporting/details/xss_details.rb
1063
+ - lib/contrast/agent/reporting/details/xss_match.rb
1064
+ - lib/contrast/agent/reporting/details/xxe_details.rb
1065
+ - lib/contrast/agent/reporting/details/xxe_match.rb
1066
+ - lib/contrast/agent/reporting/details/xxe_wrapper.rb
1067
+ - lib/contrast/agent/reporting/input_analysis/details/bot_blocker_details.rb
1068
+ - lib/contrast/agent/reporting/input_analysis/details/protect_rule_details.rb
1029
1069
  - lib/contrast/agent/reporting/input_analysis/input_analysis.rb
1030
1070
  - lib/contrast/agent/reporting/input_analysis/input_analysis_result.rb
1031
1071
  - lib/contrast/agent/reporting/input_analysis/input_type.rb
@@ -1060,6 +1100,7 @@ files:
1060
1100
  - lib/contrast/agent/reporting/reporting_events/finding_event_source.rb
1061
1101
  - lib/contrast/agent/reporting/reporting_events/finding_event_stack.rb
1062
1102
  - lib/contrast/agent/reporting/reporting_events/finding_event_taint_range.rb
1103
+ - lib/contrast/agent/reporting/reporting_events/finding_event_taint_range_tags.rb
1063
1104
  - lib/contrast/agent/reporting/reporting_events/finding_request.rb
1064
1105
  - lib/contrast/agent/reporting/reporting_events/library_discovery.rb
1065
1106
  - lib/contrast/agent/reporting/reporting_events/library_usage_observation.rb
@@ -1074,10 +1115,8 @@ files:
1074
1115
  - lib/contrast/agent/reporting/reporting_events/route_discovery_observation.rb
1075
1116
  - lib/contrast/agent/reporting/reporting_events/server_activity.rb
1076
1117
  - lib/contrast/agent/reporting/reporting_events/server_reporting_event.rb
1077
- - lib/contrast/agent/reporting/reporting_events/trace_event_source.rb
1078
1118
  - lib/contrast/agent/reporting/reporting_utilities/audit.rb
1079
1119
  - lib/contrast/agent/reporting/reporting_utilities/build_preflight.rb
1080
- - lib/contrast/agent/reporting/reporting_utilities/dtm_message.rb
1081
1120
  - lib/contrast/agent/reporting/reporting_utilities/endpoints.rb
1082
1121
  - lib/contrast/agent/reporting/reporting_utilities/headers.rb
1083
1122
  - lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb
@@ -1119,7 +1158,6 @@ files:
1119
1158
  - lib/contrast/agent/response.rb
1120
1159
  - lib/contrast/agent/rule_set.rb
1121
1160
  - lib/contrast/agent/scope.rb
1122
- - lib/contrast/agent/service_heartbeat.rb
1123
1161
  - lib/contrast/agent/static_analysis.rb
1124
1162
  - lib/contrast/agent/telemetry/base.rb
1125
1163
  - lib/contrast/agent/telemetry/events/event.rb
@@ -1137,64 +1175,37 @@ files:
1137
1175
  - lib/contrast/agent/tracepoint_hook.rb
1138
1176
  - lib/contrast/agent/version.rb
1139
1177
  - lib/contrast/agent/worker_thread.rb
1140
- - lib/contrast/api.rb
1178
+ - lib/contrast/agent_lib/api/command_injection.rb
1179
+ - lib/contrast/agent_lib/api/init.rb
1180
+ - lib/contrast/agent_lib/api/input_tracing.rb
1181
+ - lib/contrast/agent_lib/api/method_tempering.rb
1182
+ - lib/contrast/agent_lib/api/panic.rb
1183
+ - lib/contrast/agent_lib/api/path_semantic_file_security_bypass.rb
1184
+ - lib/contrast/agent_lib/interface.rb
1185
+ - lib/contrast/agent_lib/interface_base.rb
1186
+ - lib/contrast/agent_lib/return_types/eval_result.rb
1187
+ - lib/contrast/agent_lib/test.rb
1141
1188
  - lib/contrast/api/.gitkeep
1142
- - lib/contrast/api/communication.rb
1143
1189
  - lib/contrast/api/communication/connection_status.rb
1144
- - lib/contrast/api/communication/messaging_queue.rb
1145
- - lib/contrast/api/communication/response_processor.rb
1146
- - lib/contrast/api/communication/service_lifecycle.rb
1147
- - lib/contrast/api/communication/socket.rb
1148
- - lib/contrast/api/communication/socket_client.rb
1149
- - lib/contrast/api/communication/speedracer.rb
1150
- - lib/contrast/api/communication/tcp_socket.rb
1151
- - lib/contrast/api/communication/unix_socket.rb
1152
- - lib/contrast/api/decorators.rb
1153
- - lib/contrast/api/decorators/activity.rb
1154
- - lib/contrast/api/decorators/address.rb
1155
- - lib/contrast/api/decorators/agent_startup.rb
1156
- - lib/contrast/api/decorators/application_settings.rb
1157
- - lib/contrast/api/decorators/application_startup.rb
1158
- - lib/contrast/api/decorators/architecture_component.rb
1159
- - lib/contrast/api/decorators/bot_blocker.rb
1160
- - lib/contrast/api/decorators/finding.rb
1161
- - lib/contrast/api/decorators/http_request.rb
1162
- - lib/contrast/api/decorators/input_analysis.rb
1163
- - lib/contrast/api/decorators/instrumentation_mode.rb
1164
- - lib/contrast/api/decorators/ip_denylist.rb
1165
- - lib/contrast/api/decorators/message.rb
1166
- - lib/contrast/api/decorators/rasp_rule_sample.rb
1167
- - lib/contrast/api/decorators/response_type.rb
1168
- - lib/contrast/api/decorators/route_coverage.rb
1169
- - lib/contrast/api/decorators/server_features.rb
1170
- - lib/contrast/api/decorators/trace_event.rb
1171
- - lib/contrast/api/decorators/trace_event_object.rb
1172
- - lib/contrast/api/decorators/trace_event_signature.rb
1173
- - lib/contrast/api/decorators/trace_taint_range.rb
1174
- - lib/contrast/api/decorators/trace_taint_range_tags.rb
1175
- - lib/contrast/api/decorators/user_input.rb
1176
- - lib/contrast/api/decorators/virtual_patch.rb
1177
- - lib/contrast/api/dtm.pb.rb
1178
- - lib/contrast/api/settings.pb.rb
1179
1190
  - lib/contrast/components/agent.rb
1180
1191
  - lib/contrast/components/api.rb
1181
1192
  - lib/contrast/components/app_context.rb
1182
1193
  - lib/contrast/components/app_context_extend.rb
1183
1194
  - lib/contrast/components/assess.rb
1195
+ - lib/contrast/components/assess_rules.rb
1184
1196
  - lib/contrast/components/base.rb
1185
1197
  - lib/contrast/components/config.rb
1186
- - lib/contrast/components/contrast_service.rb
1187
1198
  - lib/contrast/components/heap_dump.rb
1188
1199
  - lib/contrast/components/inventory.rb
1189
1200
  - lib/contrast/components/logger.rb
1190
1201
  - lib/contrast/components/protect.rb
1202
+ - lib/contrast/components/ruby_component.rb
1191
1203
  - lib/contrast/components/sampling.rb
1192
1204
  - lib/contrast/components/scope.rb
1205
+ - lib/contrast/components/security_logger.rb
1193
1206
  - lib/contrast/components/settings.rb
1194
1207
  - lib/contrast/config.rb
1195
1208
  - lib/contrast/config/api_proxy_configuration.rb
1196
- - lib/contrast/config/assess_configuration.rb
1197
- - lib/contrast/config/assess_rules_configuration.rb
1198
1209
  - lib/contrast/config/base_configuration.rb
1199
1210
  - lib/contrast/config/certification_configuration.rb
1200
1211
  - lib/contrast/config/env_variables.rb
@@ -1202,10 +1213,7 @@ files:
1202
1213
  - lib/contrast/config/protect_rule_configuration.rb
1203
1214
  - lib/contrast/config/protect_rules_configuration.rb
1204
1215
  - lib/contrast/config/request_audit_configuration.rb
1205
- - lib/contrast/config/root_configuration.rb
1206
- - lib/contrast/config/ruby_configuration.rb
1207
1216
  - lib/contrast/config/server_configuration.rb
1208
- - lib/contrast/config/service_configuration.rb
1209
1217
  - lib/contrast/configuration.rb
1210
1218
  - lib/contrast/extension/assess.rb
1211
1219
  - lib/contrast/extension/assess/array.rb
@@ -1250,7 +1258,6 @@ files:
1250
1258
  - lib/contrast/logger/time.rb
1251
1259
  - lib/contrast/security_exception.rb
1252
1260
  - lib/contrast/tasks/config.rb
1253
- - lib/contrast/tasks/service.rb
1254
1261
  - lib/contrast/utils/assess/event_limit_utils.rb
1255
1262
  - lib/contrast/utils/assess/object_store.rb
1256
1263
  - lib/contrast/utils/assess/propagation_method_utils.rb
@@ -1268,7 +1275,7 @@ files:
1268
1275
  - lib/contrast/utils/hash_digest_extend.rb
1269
1276
  - lib/contrast/utils/head_dump_utils_extend.rb
1270
1277
  - lib/contrast/utils/heap_dump_util.rb
1271
- - lib/contrast/utils/input_classification.rb
1278
+ - lib/contrast/utils/input_classification_base.rb
1272
1279
  - lib/contrast/utils/invalid_configuration_util.rb
1273
1280
  - lib/contrast/utils/io_util.rb
1274
1281
  - lib/contrast/utils/job_servers_running.rb
@@ -1281,7 +1288,6 @@ files:
1281
1288
  - lib/contrast/utils/os.rb
1282
1289
  - lib/contrast/utils/patching/policy/patch_utils.rb
1283
1290
  - lib/contrast/utils/patching/policy/patcher_utils.rb
1284
- - lib/contrast/utils/preflight_util.rb
1285
1291
  - lib/contrast/utils/request_utils.rb
1286
1292
  - lib/contrast/utils/resource_loader.rb
1287
1293
  - lib/contrast/utils/response_utils.rb
@@ -1295,77 +1301,12 @@ files:
1295
1301
  - lib/contrast/utils/telemetry_identifier.rb
1296
1302
  - lib/contrast/utils/thread_tracker.rb
1297
1303
  - lib/contrast/utils/timer.rb
1298
- - lib/protobuf.rb
1299
- - lib/protobuf/code_generator.rb
1300
- - lib/protobuf/decoder.rb
1301
- - lib/protobuf/deprecation.rb
1302
- - lib/protobuf/descriptors.rb
1303
- - lib/protobuf/descriptors/google/protobuf/compiler/plugin.pb.rb
1304
- - lib/protobuf/descriptors/google/protobuf/descriptor.pb.rb
1305
- - lib/protobuf/encoder.rb
1306
- - lib/protobuf/enum.rb
1307
- - lib/protobuf/exceptions.rb
1308
- - lib/protobuf/field.rb
1309
- - lib/protobuf/field/base_field.rb
1310
- - lib/protobuf/field/base_field_object_definitions.rb
1311
- - lib/protobuf/field/bool_field.rb
1312
- - lib/protobuf/field/bytes_field.rb
1313
- - lib/protobuf/field/double_field.rb
1314
- - lib/protobuf/field/enum_field.rb
1315
- - lib/protobuf/field/field_array.rb
1316
- - lib/protobuf/field/field_hash.rb
1317
- - lib/protobuf/field/fixed32_field.rb
1318
- - lib/protobuf/field/fixed64_field.rb
1319
- - lib/protobuf/field/float_field.rb
1320
- - lib/protobuf/field/int32_field.rb
1321
- - lib/protobuf/field/int64_field.rb
1322
- - lib/protobuf/field/integer_field.rb
1323
- - lib/protobuf/field/message_field.rb
1324
- - lib/protobuf/field/sfixed32_field.rb
1325
- - lib/protobuf/field/sfixed64_field.rb
1326
- - lib/protobuf/field/signed_integer_field.rb
1327
- - lib/protobuf/field/sint32_field.rb
1328
- - lib/protobuf/field/sint64_field.rb
1329
- - lib/protobuf/field/string_field.rb
1330
- - lib/protobuf/field/uint32_field.rb
1331
- - lib/protobuf/field/uint64_field.rb
1332
- - lib/protobuf/field/varint_field.rb
1333
- - lib/protobuf/generators/base.rb
1334
- - lib/protobuf/generators/enum_generator.rb
1335
- - lib/protobuf/generators/extension_generator.rb
1336
- - lib/protobuf/generators/field_generator.rb
1337
- - lib/protobuf/generators/file_generator.rb
1338
- - lib/protobuf/generators/group_generator.rb
1339
- - lib/protobuf/generators/message_generator.rb
1340
- - lib/protobuf/generators/option_generator.rb
1341
- - lib/protobuf/generators/printable.rb
1342
- - lib/protobuf/generators/service_generator.rb
1343
- - lib/protobuf/lifecycle.rb
1344
- - lib/protobuf/logging.rb
1345
- - lib/protobuf/message.rb
1346
- - lib/protobuf/message/fields.rb
1347
- - lib/protobuf/message/serialization.rb
1348
- - lib/protobuf/optionable.rb
1349
- - lib/protobuf/tasks.rb
1350
- - lib/protobuf/tasks/compile.rake
1351
- - lib/protobuf/varint.rb
1352
- - lib/protobuf/varint_pure.rb
1353
- - lib/protobuf/version.rb
1354
- - lib/protobuf/wire_type.rb
1355
- - proto/dynamic_discovery.proto
1356
- - proto/google/protobuf/compiler/plugin.proto
1357
- - proto/google/protobuf/descriptor.proto
1358
- - proto/rpc.proto
1359
1304
  - resources/assess/policy.json
1360
1305
  - resources/deadzone/policy.json
1361
1306
  - resources/inventory/policy.json
1362
1307
  - resources/protect/policy.json
1363
1308
  - resources/test_marker.txt
1364
1309
  - ruby-agent.gemspec
1365
- - service_executables/.gitkeep
1366
- - service_executables/VERSION
1367
- - service_executables/linux/contrast-service
1368
- - service_executables/mac/contrast-service
1369
1310
  - shared_libraries/.gitkeep
1370
1311
  - sonar-project.properties
1371
1312
  homepage: https://www.contrastsecurity.com
data/exe/contrast_service DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
3
- # frozen_string_literal: true
4
-
5
- def mac?
6
- RUBY_PLATFORM.include?('darwin')
7
- end
8
-
9
- def path
10
- base_path = "#{ File.dirname(__FILE__) }/.."
11
- if mac?
12
- "#{ base_path }/service_executables/mac/contrast-service"
13
- else
14
- "#{ base_path }/service_executables/linux/contrast-service"
15
- end
16
- end
17
-
18
- executable_path = path
19
- if File.exist?(executable_path)
20
- Kernel.exec(executable_path)
21
- else
22
- puts "Service executable not found at: #{ executable_path }"
23
- end
@@ -1,64 +0,0 @@
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/utils/object_share'
5
-
6
- module Contrast
7
- module Agent
8
- module Protect
9
- module Rule
10
- # This module implements the cmdi-worth-watching-v2 check to determine whether input
11
- # is IGNORED or WORTH_WATCHING. If WORTH_WATCHING => analyze at sink level.
12
- # https://protect-spec.prod.dotnet.contsec.com/rules/cmd-injection.html#input-tracing
13
- module CmdiWorthWatching
14
- POSSIBLE_CHAINING_ELEMENTS = %w[& ; | $ < > `].cs__freeze
15
- UNIX_COMMANDS = %w[
16
- uname echo cat ping nestat nc whoami wget curl dir ls ps rm chmod cp kill
17
- grep sleep mkdir pwd shutdown system touch timeout fetch bash sh
18
- ].cs__freeze
19
- UNIX_PATHS = %w[tmp opt etc home mnt proc lib bin sbin sys usr var root run].cs__freeze
20
- WINDOWS_COMMANDS = %w[
21
- sc net reg cmd query cmd.exe powershell powershell.exe hostname ifconfig ipconfig netsh
22
- netstat systeminfo sysinfo whoami wscript cscript wmic PowerShell_ISE pskill psexec qprocess
23
- regedit regini rename winrm wpeutil ntdsutil taskkill certutil mapisend shellrunas
24
- ].cs__freeze
25
- # This method will determine if a user input is Worth watching and return true if it is.
26
- # This is done by running checks, and if the inputs is worth to watch it would be
27
- # saved for the later sink cmdi input analysis.
28
- #
29
- # @param input [String] the user input to be inspected
30
- # @return true | false
31
- def cmdi_worth_watching? input
32
- return false if input.nil? || input.empty? || input.length < 3
33
-
34
- exploitable?(input) && worth_watching?(input)
35
- end
36
-
37
- private
38
-
39
- # This method will check if the input is exploitable
40
- #
41
- # @param input [String] the user input to be inspected
42
- def exploitable? input
43
- contains_substring?(input, POSSIBLE_CHAINING_ELEMENTS)
44
- end
45
-
46
- def worth_watching? input
47
- return true if contains_substring?(input, UNIX_COMMANDS)
48
- return true if contains_substring?(input, UNIX_PATHS)
49
- return true if contains_substring?(input, WINDOWS_COMMANDS)
50
-
51
- false
52
- end
53
-
54
- def contains_substring? input, values
55
- return true if values.any? { |val| input.include?(val) }
56
- return true if values.include?(Contrast::Utils::ObjectShare::SPACE)
57
-
58
- false
59
- end
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,118 +0,0 @@
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/utils/object_share'
5
-
6
- module Contrast
7
- module Agent
8
- module Protect
9
- module Rule
10
- # This module implements the sqli-worth-watching-v2 check to determine whether input
11
- # is IGNORED or WORTH_WATCHING. If WORTH_WATCHING => analyze at sink level.
12
- # https://protect-spec.prod.dotnet.contsec.com/rules/sql-injection.html#input-tracing
13
- module SqliWorthWatching
14
- COLOR_CODE = /^#[0-9A-Fa-f]{6}$/.cs__freeze
15
- ALPHA_NUMERIC_AND_SPACES = /^+[a-zA-Z\d\s]+$/.cs__freeze
16
- OR_CLAUSE = /[oO][rR]/.cs__freeze
17
- EXPLOITABLE_SUBSTRING = %w[# -- // /*].cs__freeze
18
- SUSPICIOUS_CHARS = %w[` " \' ; - % , ( ) | { } =].cs__freeze
19
- SQL_COMMENTS = %w[# /* */ // -- @@].cs__freeze
20
- BLOCK_START = '/*'.cs__freeze
21
- BLOCK_END = '*/'.cs__freeze
22
- SQL_KEYWORDS = %w[
23
- alter begin between create case column_name
24
- current_user delete drop exec execute from
25
- group insert limit like merge order outfile
26
- select session_user syslogins update union
27
- UTL_INADDR UTL_HTTP
28
- ].cs__freeze
29
-
30
- # This method will determine if a user input is Worth watching and return true if it is.
31
- # This is done by running checks, and if the inputs is worth to watch it would be
32
- # saved for the later sink sqli input analysis.
33
- #
34
- # @param input [String] the user input to be inspected
35
- # @return true | false
36
- def sqli_worth_watching? input
37
- return false if input.nil? || input.empty?
38
-
39
- exploitable?(input) && (
40
- input.match?(OR_CLAUSE) || sql_comments?(input) || suspicious_chars?(input) || language_keywords?(input)
41
- )
42
- end
43
-
44
- private
45
-
46
- # Check if input is exploitable, with min length set to 3 chars
47
- #
48
- # @param input [String] the user input to be inspected
49
- # @return true | false
50
- def exploitable? input
51
- return false if input.length < 3 && input.match?(ALPHA_NUMERIC_AND_SPACES)
52
- return false if input.length == 3 && !contains_substring?(input, EXPLOITABLE_SUBSTRING)
53
- return false if input.length == 7 && input.match?(COLOR_CODE)
54
-
55
- true
56
- end
57
-
58
- # Check if input contains sqli comments:
59
- # '# /* */ // -- @@'
60
- #
61
- # @param input [String] the user input to be inspected
62
- # @return true | false
63
- def sql_comments? input
64
- input.length >= 3 && contains_substring?(input, SQL_COMMENTS)
65
- end
66
-
67
- # Check if input contains block comments starting and
68
- # ending with '/*..*/'
69
- #
70
- # @param input [String] the user input to be inspected
71
- # @return true | false
72
- def block_comments? input
73
- idx1 = input.index(BLOCK_START)
74
- idx2 = input.index(BLOCK_END)
75
-
76
- return false if idx1.nil? || idx2.nil?
77
-
78
- (idx1 >= 0 && idx2 >= 2 && (idx1 < idx2))
79
- end
80
-
81
- # Runs the input against suspicious chars array.
82
- #
83
- # @param input [String] the user input to be inspected
84
- # @return true | false
85
- def suspicious_chars? input
86
- input.length >= 7 && (number_of_substrings(input, SUSPICIOUS_CHARS) >= 2 || block_comments?(input))
87
- end
88
-
89
- # Runs the input against SQL language preserved words.
90
- #
91
- # @param input [String] the user input to be inspected
92
- # @return true | false
93
- def language_keywords? input
94
- contains_substring?(input, SQL_KEYWORDS)
95
- end
96
-
97
- # Helper method to find a substrings in given input.
98
- #
99
- # @param substrings [Array] set of substrings to inspect.
100
- # @return true | false
101
- def contains_substring? input, substrings
102
- substrings.any? { |sub| input.include?(sub) }
103
- end
104
-
105
- # Helper method to find the number of substrings.
106
- #
107
- # @param input [String] the user input to be inspected
108
- # @return number [Integer] Number of substrings
109
- def number_of_substrings input, substring
110
- number = 0
111
- input.each_char.reduce(0) { |_acc, elem| number += 1 if contains_substring?(elem, substring) }
112
- number
113
- end
114
- end
115
- end
116
- end
117
- end
118
- end
@@ -1,45 +0,0 @@
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 Protect
7
- module Rule
8
- # Here will be made the match of the user input provided by the
9
- # Agent InputAnalysis.
10
- module UnsafeFileUploadMatcher
11
- # EXPLOIT_CHARS = %w[.. ; � < > ~ *].cs__freeze # rubocop:disable Style/AsciiComments
12
- # # Extensions that can be executed on the server side or can be dangerous on the client side:
13
- # # https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload
14
- # EXPLOITABLE_EXTENSIONS = %w[.php .exe .rb .jsp .pht .phtml .shtml .asa .cer .asax .swf .xap].cs__freeze
15
- #
16
- # # Match the user input to see if the filename
17
- # # contains malicious file extension.
18
- # #
19
- # # @param input [String] The filename
20
- # # extracted from the current request
21
- # # @return true | false
22
- # def unsafe_match? input
23
- # suspicious_chars?(input) || suspicious_extensions?(input)
24
- # end
25
- #
26
- # private
27
- #
28
- # # @param input [String] The filename
29
- # # extracted from the current request
30
- # # @return true | false
31
- # def suspicious_chars? input
32
- # input.chars.any? { |c| EXPLOIT_CHARS.include? c }
33
- # end
34
- #
35
- # # @param input [String] The filename
36
- # # extracted from the current request
37
- # # @return true | false
38
- # def suspicious_extensions? input
39
- # EXPLOITABLE_EXTENSIONS.include? File.extname(input).downcase
40
- # end
41
- end
42
- end
43
- end
44
- end
45
- end