contrast-agent 3.13.2 → 3.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/exe/contrast_service +1 -7
  3. data/ext/cs__assess_active_record_named/cs__active_record_named.c +8 -7
  4. data/ext/cs__assess_array/cs__assess_array.c +6 -5
  5. data/ext/cs__assess_basic_object/cs__assess_basic_object.c +5 -5
  6. data/ext/cs__assess_fiber_track/cs__assess_fiber_track.c +2 -1
  7. data/ext/cs__assess_hash/cs__assess_hash.c +18 -17
  8. data/ext/cs__assess_hash/cs__assess_hash.h +2 -1
  9. data/ext/cs__assess_kernel/cs__assess_kernel.c +7 -8
  10. data/ext/cs__assess_marshal_module/cs__assess_marshal_module.c +4 -5
  11. data/ext/cs__assess_module/cs__assess_module.c +6 -6
  12. data/ext/cs__assess_regexp/cs__assess_regexp.c +4 -4
  13. data/ext/cs__assess_string/cs__assess_string.c +20 -4
  14. data/ext/cs__assess_string/cs__assess_string.h +4 -1
  15. data/ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c +4 -2
  16. data/ext/cs__assess_yield_track/cs__assess_yield_track.c +2 -2
  17. data/ext/cs__common/cs__common.c +44 -37
  18. data/ext/cs__common/cs__common.h +15 -20
  19. data/ext/cs__contrast_patch/cs__contrast_patch.c +27 -25
  20. data/ext/cs__contrast_patch/cs__contrast_patch.h +5 -7
  21. data/ext/cs__protect_kernel/cs__protect_kernel.c +11 -12
  22. data/ext/cs__protect_kernel/cs__protect_kernel.h +2 -2
  23. data/lib/contrast-agent.rb +1 -1
  24. data/lib/contrast.rb +13 -23
  25. data/lib/contrast/agent.rb +39 -39
  26. data/lib/contrast/agent/assess.rb +11 -12
  27. data/lib/contrast/agent/assess/contrast_event.rb +11 -9
  28. data/lib/contrast/agent/assess/events/event_factory.rb +2 -2
  29. data/lib/contrast/agent/assess/events/source_event.rb +2 -2
  30. data/lib/contrast/agent/assess/finalizers/finalize.rb +21 -0
  31. data/lib/contrast/agent/assess/finalizers/freeze.rb +13 -0
  32. data/lib/contrast/agent/assess/finalizers/hash.rb +53 -0
  33. data/lib/contrast/agent/assess/policy/dynamic_source_factory.rb +1 -1
  34. data/lib/contrast/agent/assess/policy/patcher.rb +5 -5
  35. data/lib/contrast/agent/assess/policy/policy.rb +9 -9
  36. data/lib/contrast/agent/assess/policy/policy_node.rb +2 -2
  37. data/lib/contrast/agent/assess/policy/policy_scanner.rb +3 -3
  38. data/lib/contrast/agent/assess/policy/preshift.rb +15 -5
  39. data/lib/contrast/agent/assess/policy/propagation_method.rb +25 -22
  40. data/lib/contrast/agent/assess/policy/propagation_node.rb +2 -2
  41. data/lib/contrast/agent/assess/policy/propagator.rb +18 -18
  42. data/lib/contrast/agent/assess/policy/propagator/custom.rb +1 -1
  43. data/lib/contrast/agent/assess/policy/propagator/database_write.rb +1 -1
  44. data/lib/contrast/agent/assess/policy/propagator/match_data.rb +3 -2
  45. data/lib/contrast/agent/assess/policy/propagator/prepend.rb +5 -0
  46. data/lib/contrast/agent/assess/policy/propagator/split.rb +4 -4
  47. data/lib/contrast/agent/assess/policy/propagator/substitution.rb +5 -4
  48. data/lib/contrast/agent/assess/policy/rewriter_patch.rb +5 -5
  49. data/lib/contrast/agent/assess/policy/source_method.rb +5 -14
  50. data/lib/contrast/agent/assess/policy/source_validation/cross_site_validator.rb +1 -1
  51. data/lib/contrast/agent/assess/policy/source_validation/source_validation.rb +1 -1
  52. data/lib/contrast/agent/assess/policy/trigger/xpath.rb +1 -1
  53. data/lib/contrast/agent/assess/policy/trigger_method.rb +5 -5
  54. data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -3
  55. data/lib/contrast/agent/assess/policy/trigger_validation/trigger_validation.rb +2 -2
  56. data/lib/contrast/agent/assess/properties.rb +13 -5
  57. data/lib/contrast/agent/assess/property/evented.rb +2 -2
  58. data/lib/contrast/agent/assess/property/tagged.rb +4 -4
  59. data/lib/contrast/agent/assess/rule.rb +2 -2
  60. data/lib/contrast/agent/assess/rule/base.rb +3 -4
  61. data/lib/contrast/agent/assess/rule/provider.rb +3 -3
  62. data/lib/contrast/agent/assess/rule/provider/hardcoded_password.rb +1 -1
  63. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +2 -2
  64. data/lib/contrast/agent/at_exit_hook.rb +1 -1
  65. data/lib/contrast/agent/class_reopener.rb +7 -6
  66. data/lib/contrast/agent/deadzone/policy/deadzone_node.rb +1 -1
  67. data/lib/contrast/agent/deadzone/policy/policy.rb +2 -2
  68. data/lib/contrast/agent/disable_reaction.rb +1 -1
  69. data/lib/contrast/agent/exclusion_matcher.rb +1 -1
  70. data/lib/contrast/agent/inventory/policy/datastores.rb +2 -2
  71. data/lib/contrast/agent/inventory/policy/policy.rb +3 -3
  72. data/lib/contrast/agent/inventory/policy/trigger_node.rb +1 -1
  73. data/lib/contrast/agent/middleware.rb +33 -32
  74. data/lib/contrast/agent/patching/policy/after_load_patch.rb +4 -4
  75. data/lib/contrast/agent/patching/policy/after_load_patcher.rb +6 -5
  76. data/lib/contrast/agent/patching/policy/module_policy.rb +1 -1
  77. data/lib/contrast/agent/patching/policy/patch.rb +15 -15
  78. data/lib/contrast/agent/patching/policy/patcher.rb +30 -22
  79. data/lib/contrast/agent/patching/policy/policy.rb +6 -6
  80. data/lib/contrast/agent/patching/policy/policy_node.rb +1 -1
  81. data/lib/contrast/agent/patching/policy/trigger_node.rb +2 -2
  82. data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +3 -3
  83. data/lib/contrast/agent/protect/policy/applies_deserialization_rule.rb +2 -2
  84. data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +2 -2
  85. data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +3 -3
  86. data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +2 -2
  87. data/lib/contrast/agent/protect/policy/applies_xxe_rule.rb +3 -3
  88. data/lib/contrast/agent/protect/policy/policy.rb +8 -8
  89. data/lib/contrast/agent/protect/policy/rule_applicator.rb +1 -1
  90. data/lib/contrast/agent/protect/policy/trigger_node.rb +1 -1
  91. data/lib/contrast/agent/protect/rule.rb +18 -18
  92. data/lib/contrast/agent/protect/rule/base.rb +4 -3
  93. data/lib/contrast/agent/protect/rule/base_service.rb +1 -1
  94. data/lib/contrast/agent/protect/rule/cmd_injection.rb +5 -5
  95. data/lib/contrast/agent/protect/rule/deserialization.rb +1 -1
  96. data/lib/contrast/agent/protect/rule/http_method_tampering.rb +1 -1
  97. data/lib/contrast/agent/protect/rule/no_sqli.rb +1 -1
  98. data/lib/contrast/agent/protect/rule/path_traversal.rb +4 -5
  99. data/lib/contrast/agent/protect/rule/sqli.rb +2 -2
  100. data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +1 -1
  101. data/lib/contrast/agent/protect/rule/xss.rb +1 -1
  102. data/lib/contrast/agent/protect/rule/xxe.rb +3 -5
  103. data/lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb +2 -2
  104. data/lib/contrast/agent/railtie.rb +1 -1
  105. data/lib/contrast/agent/reaction_processor.rb +2 -2
  106. data/lib/contrast/agent/request.rb +11 -9
  107. data/lib/contrast/agent/request_context.rb +10 -6
  108. data/lib/contrast/agent/response.rb +6 -6
  109. data/lib/contrast/agent/rewriter.rb +5 -6
  110. data/lib/contrast/agent/service_heartbeat.rb +2 -2
  111. data/lib/contrast/agent/static_analysis.rb +3 -3
  112. data/lib/contrast/agent/thread.rb +1 -1
  113. data/lib/contrast/agent/thread_watcher.rb +2 -2
  114. data/lib/contrast/agent/tracepoint_hook.rb +1 -1
  115. data/lib/contrast/agent/version.rb +1 -1
  116. data/lib/contrast/api.rb +4 -4
  117. data/lib/contrast/api/communication.rb +9 -9
  118. data/lib/contrast/api/communication/messaging_queue.rb +2 -2
  119. data/lib/contrast/api/communication/response_processor.rb +1 -1
  120. data/lib/contrast/api/communication/socket_client.rb +5 -5
  121. data/lib/contrast/api/communication/speedracer.rb +1 -1
  122. data/lib/contrast/api/communication/tcp_socket.rb +1 -1
  123. data/lib/contrast/api/communication/unix_socket.rb +1 -1
  124. data/lib/contrast/api/decorators.rb +14 -14
  125. data/lib/contrast/api/decorators/address.rb +7 -6
  126. data/lib/contrast/api/decorators/application_settings.rb +3 -2
  127. data/lib/contrast/api/decorators/application_update.rb +5 -4
  128. data/lib/contrast/api/decorators/http_request.rb +13 -12
  129. data/lib/contrast/api/decorators/input_analysis.rb +3 -2
  130. data/lib/contrast/api/decorators/message.rb +3 -2
  131. data/lib/contrast/api/decorators/rasp_rule_sample.rb +2 -1
  132. data/lib/contrast/api/decorators/route_coverage.rb +3 -2
  133. data/lib/contrast/api/decorators/server_features.rb +3 -2
  134. data/lib/contrast/api/decorators/trace_event.rb +3 -2
  135. data/lib/contrast/api/decorators/trace_event_object.rb +6 -5
  136. data/lib/contrast/api/decorators/trace_event_signature.rb +5 -4
  137. data/lib/contrast/api/decorators/trace_taint_range.rb +4 -3
  138. data/lib/contrast/api/decorators/user_input.rb +4 -4
  139. data/lib/contrast/common_agent_configuration.rb +2 -2
  140. data/lib/contrast/components/agent.rb +2 -2
  141. data/lib/contrast/components/app_context.rb +1 -1
  142. data/lib/contrast/components/config.rb +4 -4
  143. data/lib/contrast/components/contrast_service.rb +1 -1
  144. data/lib/contrast/components/interface.rb +15 -15
  145. data/lib/contrast/components/logger.rb +1 -1
  146. data/lib/contrast/components/scope.rb +3 -3
  147. data/lib/contrast/config.rb +18 -18
  148. data/lib/contrast/config/base_configuration.rb +2 -2
  149. data/lib/contrast/config/protect_rule_configuration.rb +1 -1
  150. data/lib/contrast/configuration.rb +5 -5
  151. data/lib/contrast/extension/assess.rb +22 -21
  152. data/lib/contrast/extension/assess/array.rb +4 -4
  153. data/lib/contrast/extension/assess/assess_extension.rb +27 -29
  154. data/lib/contrast/extension/assess/eval_trigger.rb +3 -3
  155. data/lib/contrast/extension/assess/exec_trigger.rb +1 -1
  156. data/lib/contrast/extension/assess/fiber.rb +3 -3
  157. data/lib/contrast/extension/assess/hash.rb +5 -3
  158. data/lib/contrast/extension/assess/kernel.rb +7 -6
  159. data/lib/contrast/extension/assess/marshal.rb +62 -0
  160. data/lib/contrast/extension/assess/regexp.rb +3 -3
  161. data/lib/contrast/extension/assess/string.rb +5 -5
  162. data/lib/contrast/extension/inventory.rb +4 -4
  163. data/lib/contrast/extension/kernel.rb +1 -1
  164. data/lib/contrast/extension/module.rb +1 -1
  165. data/lib/contrast/extension/protect.rb +3 -3
  166. data/lib/contrast/extension/protect/kernel.rb +2 -2
  167. data/lib/contrast/extension/protect/psych.rb +2 -2
  168. data/lib/contrast/framework/manager.rb +7 -8
  169. data/lib/contrast/framework/rack/patch/session_cookie.rb +1 -1
  170. data/lib/contrast/framework/rack/patch/support.rb +1 -1
  171. data/lib/contrast/framework/rack/support.rb +2 -2
  172. data/lib/contrast/framework/rails/patch/assess_configuration.rb +2 -2
  173. data/lib/contrast/framework/rails/patch/rails_application_configuration.rb +1 -1
  174. data/lib/contrast/framework/rails/patch/support.rb +3 -3
  175. data/lib/contrast/framework/rails/rewrite/action_controller_railties_helper_inherited.rb +2 -2
  176. data/lib/contrast/framework/rails/rewrite/active_record_named.rb +2 -2
  177. data/lib/contrast/framework/rails/rewrite/active_record_time_zone_inherited.rb +2 -2
  178. data/lib/contrast/framework/rails/support.rb +62 -14
  179. data/lib/contrast/framework/sinatra/patch/base.rb +1 -1
  180. data/lib/contrast/framework/sinatra/patch/support.rb +1 -1
  181. data/lib/contrast/framework/sinatra/support.rb +2 -2
  182. data/lib/contrast/funchook/funchook.rb +1 -1
  183. data/lib/contrast/logger/application.rb +2 -2
  184. data/lib/contrast/logger/format.rb +22 -9
  185. data/lib/contrast/logger/log.rb +10 -8
  186. data/lib/contrast/logger/request.rb +30 -0
  187. data/lib/contrast/tasks/config.rb +1 -1
  188. data/lib/contrast/tasks/service.rb +2 -2
  189. data/lib/contrast/utils/assess/sampling_util.rb +2 -2
  190. data/lib/contrast/utils/assess/tracking_util.rb +1 -1
  191. data/lib/contrast/utils/boolean_util.rb +1 -1
  192. data/lib/contrast/utils/class_util.rb +2 -2
  193. data/lib/contrast/utils/freeze_util.rb +1 -1
  194. data/lib/contrast/utils/gemfile_reader.rb +5 -5
  195. data/lib/contrast/utils/hash_digest.rb +2 -1
  196. data/lib/contrast/utils/heap_dump_util.rb +2 -2
  197. data/lib/contrast/utils/invalid_configuration_util.rb +1 -1
  198. data/lib/contrast/utils/inventory_util.rb +4 -4
  199. data/lib/contrast/utils/io_util.rb +1 -1
  200. data/lib/contrast/utils/os.rb +1 -1
  201. data/lib/contrast/utils/ruby_ast_rewriter.rb +1 -1
  202. data/lib/contrast/utils/sha256_builder.rb +2 -2
  203. data/lib/contrast/utils/stack_trace_utils.rb +2 -2
  204. data/lib/contrast/utils/string_utils.rb +1 -1
  205. data/ruby-agent.gemspec +5 -5
  206. data/service_executables/VERSION +1 -1
  207. data/service_executables/linux/contrast-service +0 -0
  208. data/service_executables/mac/contrast-service +0 -0
  209. metadata +22 -19
  210. data/lib/contrast/agent/assess/insulator.rb +0 -49
  211. data/lib/contrast/agent/require_state.rb +0 -61
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base'
4
+ require 'contrast/agent/protect/rule/base'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,11 +1,11 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/at_exit_hook'
5
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
6
- cs__scoped_require 'contrast/utils/stack_trace_utils'
7
- cs__scoped_require 'contrast/utils/object_share'
8
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/agent/at_exit_hook'
5
+ require 'contrast/agent/protect/rule/base_service'
6
+ require 'contrast/utils/stack_trace_utils'
7
+ require 'contrast/utils/object_share'
8
+ require 'contrast/components/interface'
9
9
 
10
10
  module Contrast
11
11
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base'
4
+ require 'contrast/agent/protect/rule/base'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
4
+ require 'contrast/agent/protect/rule/base_service'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
4
+ require 'contrast/agent/protect/rule/base_service'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,9 +1,9 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
5
- cs__scoped_require 'contrast/components/interface'
6
- cs__scoped_require 'contrast/utils/stack_trace_utils'
4
+ require 'contrast/agent/protect/rule/base_service'
5
+ require 'contrast/components/interface'
6
+ require 'contrast/utils/stack_trace_utils'
7
7
 
8
8
  module Contrast
9
9
  module Agent
@@ -52,8 +52,7 @@ module Contrast
52
52
  def find_attacker context, path
53
53
  attack_result = nil
54
54
  attack_result = super(context, path) if infilter?(context)
55
- attack_result = check_rep_features(context, path, attack_result)
56
- attack_result
55
+ check_rep_features(context, path, attack_result)
57
56
  end
58
57
 
59
58
  # Build a subclass of the RaspRuleSample using the query string and the
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
5
- cs__scoped_require 'contrast/agent/protect/policy/applies_sqli_rule'
4
+ require 'contrast/agent/protect/rule/base_service'
5
+ require 'contrast/agent/protect/policy/applies_sqli_rule'
6
6
 
7
7
  module Contrast
8
8
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
4
+ require 'contrast/agent/protect/rule/base_service'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base_service'
4
+ require 'contrast/agent/protect/rule/base_service'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/protect/rule/base'
5
- cs__scoped_require 'contrast/utils/timer'
4
+ require 'contrast/agent/protect/rule/base'
5
+ require 'contrast/utils/timer'
6
6
 
7
7
  module Contrast
8
8
  module Agent
@@ -50,14 +50,12 @@ module Contrast
50
50
  # string to the end of the last entity declaration.
51
51
  xxe_details.xml = Contrast::Utils::StringUtils.protobuf_safe_string(xml[0, last_idx])
52
52
  ia_result = build_evaluation(xxe_details.xml)
53
- result = build_attack_with_match(
53
+ build_attack_with_match(
54
54
  context,
55
55
  ia_result,
56
56
  nil,
57
57
  nil,
58
58
  details: xxe_details)
59
-
60
- result
61
59
  end
62
60
 
63
61
  def build_details xml, _evaluation = nil
@@ -27,14 +27,14 @@ module Contrast
27
27
  end
28
28
 
29
29
  # <!ENTITY name SYSTEM "URI">
30
- SYSTEM_ID_REGEXP = /<!ENTITY\s+([a-zA-Z0-f]+)\s+SYSTEM\s+"(?<id>.*?)">/.cs__freeze
30
+ SYSTEM_ID_REGEXP = /<!ENTITY\s+(?<name>[a-zA-Z0-f]+)\s+SYSTEM\s+"(?<id>.*?)">/.cs__freeze
31
31
  def parse_system_id entity
32
32
  match = SYSTEM_ID_REGEXP.match(entity)
33
33
  match[:id] if match
34
34
  end
35
35
 
36
36
  # <!ENTITY name PUBLIC "public_ID" "URI">
37
- PUBLIC_ID_REGEXP = /<!ENTITY\s+([a-zA-Z0-f]+)\s+PUBLIC\s+".*?"\s+"(?<id>.*?)">/.cs__freeze
37
+ PUBLIC_ID_REGEXP = /<!ENTITY\s+(?<name>[a-zA-Z0-f]+)\s+PUBLIC\s+".*?"\s+"(?<id>.*?)">/.cs__freeze
38
38
  def parse_public_id entity
39
39
  match = PUBLIC_ID_REGEXP.match(entity)
40
40
  match[:id] if match
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/utils/job_servers_running'
4
+ require 'contrast/utils/job_servers_running'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/disable_reaction'
5
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/agent/disable_reaction'
5
+ require 'contrast/components/interface'
6
6
 
7
7
  module Contrast
8
8
  module Agent
@@ -1,13 +1,13 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'resolv'
5
- cs__scoped_require 'timeout'
4
+ require 'resolv'
5
+ require 'timeout'
6
6
 
7
- cs__scoped_require 'contrast/utils/object_share'
8
- cs__scoped_require 'contrast/utils/string_utils'
9
- cs__scoped_require 'contrast/utils/hash_digest'
10
- cs__scoped_require 'contrast/components/interface'
7
+ require 'contrast/utils/object_share'
8
+ require 'contrast/utils/string_utils'
9
+ require 'contrast/utils/hash_digest'
10
+ require 'contrast/components/interface'
11
11
 
12
12
  module Contrast
13
13
  module Agent
@@ -21,8 +21,8 @@ module Contrast
21
21
 
22
22
  extend Forwardable
23
23
 
24
- INNER_REST_TOKEN = %r{/[\d]+/}.cs__freeze
25
- LAST_REST_TOKEN = %r{/[\d]+$}.cs__freeze
24
+ INNER_REST_TOKEN = %r{/\d+/}.cs__freeze
25
+ LAST_REST_TOKEN = %r{/\d+$}.cs__freeze
26
26
  INNER_NUMBER_MARKER = '/{n}/'
27
27
  LAST_NUMBER_MARKER = '/{n}'
28
28
 
@@ -168,7 +168,9 @@ module Contrast
168
168
  # (rather than breaking this out into two methods)
169
169
  case val
170
170
  when Tempfile
171
- { prefix => Contrast::Utils::StringUtils.force_utf8(val.path) }
171
+ # Skip if it's the auto-generated value from rails when it handles
172
+ # file uploads. The file name will still be sent to SR for analysis.
173
+ {}
172
174
  when Hash
173
175
  res = val.each_with_object({}) do |(k, v), hash|
174
176
  k = Contrast::Utils::StringUtils.force_utf8(k)
@@ -1,11 +1,11 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/utils/timer'
5
- cs__scoped_require 'contrast/agent/request'
6
- cs__scoped_require 'contrast/agent/response'
7
- cs__scoped_require 'contrast/utils/inventory_util'
8
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/utils/timer'
5
+ require 'contrast/agent/request'
6
+ require 'contrast/agent/response'
7
+ require 'contrast/utils/inventory_util'
8
+ require 'contrast/components/interface'
9
9
 
10
10
  module Contrast
11
11
  module Agent
@@ -19,6 +19,7 @@ module Contrast
19
19
  EMPTY_INPUT_ANALYSIS_PB = Contrast::Api::Settings::InputAnalysis.new
20
20
 
21
21
  attr_reader :timer,
22
+ :logging_hash,
22
23
  :speedracer_input_analysis,
23
24
  :request,
24
25
  :response,
@@ -29,8 +30,11 @@ module Contrast
29
30
 
30
31
  def initialize rack_request, app_loaded = true
31
32
  with_contrast_scope do
32
- # all requests get a timer
33
+ # all requests get a timer and hash
33
34
  @timer = Contrast::Utils::Timer.new
35
+ @logging_hash = {
36
+ request_id: __id__
37
+ }
34
38
 
35
39
  # instantiate helper for request and response
36
40
  @request = Contrast::Agent::Request.new(rack_request)
@@ -1,13 +1,13 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'resolv'
5
- cs__scoped_require 'timeout'
4
+ require 'resolv'
5
+ require 'timeout'
6
6
 
7
- cs__scoped_require 'contrast/utils/object_share'
8
- cs__scoped_require 'contrast/utils/string_utils'
9
- cs__scoped_require 'contrast/utils/hash_digest'
10
- cs__scoped_require 'contrast/components/interface'
7
+ require 'contrast/utils/object_share'
8
+ require 'contrast/utils/string_utils'
9
+ require 'contrast/utils/hash_digest'
10
+ require 'contrast/components/interface'
11
11
 
12
12
  module Contrast
13
13
  module Agent
@@ -3,10 +3,10 @@
3
3
 
4
4
  # intentional -- we're using a << operator here
5
5
 
6
- cs__scoped_require 'contrast/agent/class_reopener'
7
- cs__scoped_require 'contrast/agent/patching/policy/patch_status'
8
- cs__scoped_require 'contrast/components/interface'
9
- cs__scoped_require 'contrast/utils/ruby_ast_rewriter'
6
+ require 'contrast/agent/class_reopener'
7
+ require 'contrast/agent/patching/policy/patch_status'
8
+ require 'contrast/components/interface'
9
+ require 'contrast/utils/ruby_ast_rewriter'
10
10
 
11
11
  module Contrast
12
12
  module Agent
@@ -163,8 +163,7 @@ module Contrast
163
163
 
164
164
  def rewrite_method original_source_code
165
165
  new_code = rewrite(original_source_code)
166
- new_code = remove_self_definition(new_code)
167
- new_code
166
+ remove_self_definition(new_code)
168
167
  end
169
168
 
170
169
  def rewrite source
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
5
- cs__scoped_require 'contrast/agent/worker_thread'
4
+ require 'contrast/components/interface'
5
+ require 'contrast/agent/worker_thread'
6
6
 
7
7
  module Contrast
8
8
  module Agent
@@ -1,9 +1,9 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
5
- cs__scoped_require 'contrast/utils/gemfile_reader'
6
- cs__scoped_require 'contrast/api/decorators/application_update'
4
+ require 'contrast/components/interface'
5
+ require 'contrast/utils/gemfile_reader'
6
+ require 'contrast/api/decorators/application_update'
7
7
 
8
8
  module Contrast
9
9
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/components/interface'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
5
- cs__scoped_require 'contrast/agent/service_heartbeat'
4
+ require 'contrast/components/interface'
5
+ require 'contrast/agent/service_heartbeat'
6
6
 
7
7
  module Contrast
8
8
  module Agent
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/components/interface'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Contrast
5
5
  module Agent
6
- VERSION = '3.13.2'
6
+ VERSION = '3.14.0'
7
7
  end
8
8
  end
@@ -10,7 +10,7 @@ module Contrast
10
10
  end
11
11
  end
12
12
 
13
- cs__scoped_require 'contrast/api/dtm.pb'
14
- cs__scoped_require 'contrast/api/settings.pb'
15
- cs__scoped_require 'contrast/api/decorators'
16
- cs__scoped_require 'contrast/api/communication'
13
+ require 'contrast/api/dtm.pb'
14
+ require 'contrast/api/settings.pb'
15
+ require 'contrast/api/decorators'
16
+ require 'contrast/api/communication'
@@ -9,12 +9,12 @@ module Contrast
9
9
  end
10
10
  end
11
11
 
12
- cs__scoped_require 'contrast/api/communication/service_lifecycle'
13
- cs__scoped_require 'contrast/api/communication/connection_status'
14
- cs__scoped_require 'contrast/api/communication/socket'
15
- cs__scoped_require 'contrast/api/communication/tcp_socket'
16
- cs__scoped_require 'contrast/api/communication/unix_socket'
17
- cs__scoped_require 'contrast/api/communication/socket_client'
18
- cs__scoped_require 'contrast/api/communication/messaging_queue'
19
- cs__scoped_require 'contrast/api/communication/response_processor'
20
- cs__scoped_require 'contrast/api/communication/speedracer'
12
+ require 'contrast/api/communication/service_lifecycle'
13
+ require 'contrast/api/communication/connection_status'
14
+ require 'contrast/api/communication/socket'
15
+ require 'contrast/api/communication/tcp_socket'
16
+ require 'contrast/api/communication/unix_socket'
17
+ require 'contrast/api/communication/socket_client'
18
+ require 'contrast/api/communication/messaging_queue'
19
+ require 'contrast/api/communication/response_processor'
20
+ require 'contrast/api/communication/speedracer'
@@ -1,8 +1,8 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
5
- cs__scoped_require 'contrast/agent/worker_thread'
4
+ require 'contrast/components/interface'
5
+ require 'contrast/agent/worker_thread'
6
6
 
7
7
  module Contrast
8
8
  module Api
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/agent/reaction_processor'
4
+ require 'contrast/agent/reaction_processor'
5
5
 
6
6
  module Contrast
7
7
  module Api
@@ -1,12 +1,12 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'socket'
5
- cs__scoped_require 'uri'
4
+ require 'socket'
5
+ require 'uri'
6
6
 
7
- cs__scoped_require 'contrast/api/communication/tcp_socket'
8
- cs__scoped_require 'contrast/api/communication/unix_socket'
9
- cs__scoped_require 'contrast/components/interface'
7
+ require 'contrast/api/communication/tcp_socket'
8
+ require 'contrast/api/communication/unix_socket'
9
+ require 'contrast/components/interface'
10
10
 
11
11
  module Contrast
12
12
  module Api
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
2
  # frozen_string_literal: true
3
3
 
4
- cs__scoped_require 'contrast/components/interface'
4
+ require 'contrast/components/interface'
5
5
 
6
6
  module Contrast
7
7
  module Api