contrast-agent 4.12.0 → 4.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +1 -0
  3. data/ext/cs__assess_module/cs__assess_module.c +48 -0
  4. data/ext/cs__assess_module/cs__assess_module.h +7 -0
  5. data/ext/cs__common/cs__common.c +5 -0
  6. data/ext/cs__common/cs__common.h +8 -0
  7. data/ext/cs__contrast_patch/cs__contrast_patch.c +16 -1
  8. data/ext/cs__os_information/cs__os_information.c +31 -0
  9. data/ext/cs__os_information/cs__os_information.h +7 -0
  10. data/ext/cs__os_information/extconf.rb +5 -0
  11. data/lib/contrast/agent/assess/policy/policy_node.rb +6 -6
  12. data/lib/contrast/agent/assess/policy/policy_scanner.rb +5 -0
  13. data/lib/contrast/agent/assess/policy/propagation_method.rb +2 -116
  14. data/lib/contrast/agent/assess/policy/propagation_node.rb +4 -4
  15. data/lib/contrast/agent/assess/policy/propagator/center.rb +1 -1
  16. data/lib/contrast/agent/assess/policy/propagator/substitution.rb +2 -154
  17. data/lib/contrast/agent/assess/policy/source_method.rb +2 -71
  18. data/lib/contrast/agent/assess/policy/trigger_method.rb +45 -110
  19. data/lib/contrast/agent/assess/policy/trigger_node.rb +14 -6
  20. data/lib/contrast/agent/assess/policy/trigger_validation/xss_validator.rb +1 -1
  21. data/lib/contrast/agent/assess/property/tagged.rb +53 -185
  22. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +40 -6
  23. data/lib/contrast/agent/deadzone/policy/policy.rb +1 -1
  24. data/lib/contrast/agent/inventory/dependency_usage_analysis.rb +1 -0
  25. data/lib/contrast/agent/metric_telemetry_event.rb +26 -0
  26. data/lib/contrast/agent/middleware.rb +14 -62
  27. data/lib/contrast/agent/patching/policy/method_policy.rb +3 -89
  28. data/lib/contrast/agent/patching/policy/method_policy_extend.rb +111 -0
  29. data/lib/contrast/agent/patching/policy/patch.rb +28 -235
  30. data/lib/contrast/agent/patching/policy/patcher.rb +14 -49
  31. data/lib/contrast/agent/reporting/report.rb +21 -0
  32. data/lib/contrast/agent/reporting/reporter.rb +142 -0
  33. data/lib/contrast/agent/reporting/reporting_events/finding.rb +90 -0
  34. data/lib/contrast/agent/reporting/reporting_events/preflight.rb +25 -0
  35. data/lib/contrast/agent/reporting/reporting_events/preflight_message.rb +56 -0
  36. data/lib/contrast/agent/reporting/reporting_events/reporting_event.rb +37 -0
  37. data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +127 -0
  38. data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +168 -0
  39. data/lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb +66 -0
  40. data/lib/contrast/agent/request.rb +2 -81
  41. data/lib/contrast/agent/request_context.rb +4 -128
  42. data/lib/contrast/agent/request_context_extend.rb +138 -0
  43. data/lib/contrast/agent/request_handler.rb +7 -3
  44. data/lib/contrast/agent/response.rb +2 -73
  45. data/lib/contrast/agent/startup_metrics_telemetry_event.rb +94 -0
  46. data/lib/contrast/agent/static_analysis.rb +5 -3
  47. data/lib/contrast/agent/telemetry.rb +137 -0
  48. data/lib/contrast/agent/telemetry_event.rb +33 -0
  49. data/lib/contrast/agent/thread_watcher.rb +66 -11
  50. data/lib/contrast/agent/version.rb +1 -1
  51. data/lib/contrast/agent.rb +21 -0
  52. data/lib/contrast/api/communication/connection_status.rb +10 -7
  53. data/lib/contrast/api/communication/messaging_queue.rb +37 -3
  54. data/lib/contrast/api/communication/response_processor.rb +15 -8
  55. data/lib/contrast/api/communication/service_lifecycle.rb +13 -3
  56. data/lib/contrast/api/communication/socket.rb +6 -8
  57. data/lib/contrast/api/communication/socket_client.rb +29 -12
  58. data/lib/contrast/api/communication/speedracer.rb +37 -1
  59. data/lib/contrast/api/communication/tcp_socket.rb +4 -3
  60. data/lib/contrast/api/communication/unix_socket.rb +1 -0
  61. data/lib/contrast/api/decorators/finding.rb +45 -0
  62. data/lib/contrast/components/api.rb +90 -0
  63. data/lib/contrast/components/app_context.rb +10 -41
  64. data/lib/contrast/components/app_context_extend.rb +78 -0
  65. data/lib/contrast/components/base.rb +23 -0
  66. data/lib/contrast/components/config.rb +92 -13
  67. data/lib/contrast/components/contrast_service.rb +11 -0
  68. data/lib/contrast/components/sampling.rb +2 -2
  69. data/lib/contrast/config/agent_configuration.rb +1 -1
  70. data/lib/contrast/config/api_configuration.rb +27 -0
  71. data/lib/contrast/config/api_proxy_configuration.rb +14 -0
  72. data/lib/contrast/config/application_configuration.rb +2 -3
  73. data/lib/contrast/config/assess_configuration.rb +3 -3
  74. data/lib/contrast/config/base_configuration.rb +17 -28
  75. data/lib/contrast/config/certification_configuration.rb +15 -0
  76. data/lib/contrast/config/env_variables.rb +18 -0
  77. data/lib/contrast/config/heap_dump_configuration.rb +6 -6
  78. data/lib/contrast/config/inventory_configuration.rb +1 -5
  79. data/lib/contrast/config/protect_rule_configuration.rb +1 -1
  80. data/lib/contrast/config/request_audit_configuration.rb +18 -0
  81. data/lib/contrast/config/root_configuration.rb +1 -0
  82. data/lib/contrast/config/ruby_configuration.rb +6 -6
  83. data/lib/contrast/config/service_configuration.rb +2 -2
  84. data/lib/contrast/config.rb +1 -1
  85. data/lib/contrast/configuration.rb +4 -2
  86. data/lib/contrast/extension/assess/array.rb +5 -7
  87. data/lib/contrast/extension/thread.rb +31 -12
  88. data/lib/contrast/framework/manager.rb +22 -44
  89. data/lib/contrast/framework/manager_extend.rb +50 -0
  90. data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +9 -6
  91. data/lib/contrast/framework/rails/patch/support.rb +31 -29
  92. data/lib/contrast/framework/rails/railtie.rb +1 -1
  93. data/lib/contrast/framework/sinatra/support.rb +2 -1
  94. data/lib/contrast/logger/application.rb +4 -0
  95. data/lib/contrast/logger/log.rb +8 -103
  96. data/lib/contrast/utils/assess/propagation_method_utils.rb +129 -0
  97. data/lib/contrast/utils/assess/property/tagged_utils.rb +165 -0
  98. data/lib/contrast/utils/assess/source_method_utils.rb +83 -0
  99. data/lib/contrast/utils/assess/tracking_util.rb +20 -15
  100. data/lib/contrast/utils/assess/trigger_method_utils.rb +138 -0
  101. data/lib/contrast/utils/class_util.rb +18 -14
  102. data/lib/contrast/utils/exclude_key.rb +20 -0
  103. data/lib/contrast/utils/findings.rb +62 -0
  104. data/lib/contrast/utils/hash_digest.rb +10 -73
  105. data/lib/contrast/utils/hash_digest_extend.rb +86 -0
  106. data/lib/contrast/utils/head_dump_utils_extend.rb +74 -0
  107. data/lib/contrast/utils/heap_dump_util.rb +2 -65
  108. data/lib/contrast/utils/invalid_configuration_util.rb +29 -0
  109. data/lib/contrast/utils/io_util.rb +1 -1
  110. data/lib/contrast/utils/log_utils.rb +108 -0
  111. data/lib/contrast/utils/metrics_hash.rb +59 -0
  112. data/lib/contrast/utils/middleware_utils.rb +87 -0
  113. data/lib/contrast/utils/net_http_base.rb +158 -0
  114. data/lib/contrast/utils/object_share.rb +1 -0
  115. data/lib/contrast/utils/os.rb +23 -0
  116. data/lib/contrast/utils/patching/policy/patch_utils.rb +232 -0
  117. data/lib/contrast/utils/patching/policy/patcher_utils.rb +54 -0
  118. data/lib/contrast/utils/request_utils.rb +88 -0
  119. data/lib/contrast/utils/response_utils.rb +97 -0
  120. data/lib/contrast/utils/substitution_utils.rb +167 -0
  121. data/lib/contrast/utils/tag_util.rb +9 -9
  122. data/lib/contrast/utils/telemetry.rb +79 -0
  123. data/lib/contrast/utils/telemetry_client.rb +90 -0
  124. data/lib/contrast/utils/telemetry_identifier.rb +130 -0
  125. data/lib/contrast.rb +18 -0
  126. data/ruby-agent.gemspec +7 -6
  127. data/service_executables/VERSION +1 -1
  128. data/service_executables/linux/contrast-service +0 -0
  129. data/service_executables/mac/contrast-service +0 -0
  130. metadata +69 -22
  131. data/lib/contrast/config/default_value.rb +0 -17
@@ -0,0 +1,79 @@
1
+ # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/telemetry'
5
+ require 'contrast/utils/telemetry_identifier'
6
+
7
+ module Contrast
8
+ module Utils
9
+ # Tools for supporting the Telemetry feature
10
+ module Telemetry
11
+ DIR = '/ect/contrast/ruby-agent/'.cs__freeze
12
+ FILE = '.telemetry'.cs__freeze
13
+ CURRENT_DIR = Dir.pwd.cs__freeze
14
+ CONFIG_DIR = CURRENT_DIR + '/config/contrast/'.cs__freeze
15
+ MESSAGE = {
16
+ disclaimer:
17
+ "\n===================================================================================================" \
18
+ "\n\nThe [Contrast Security] [Ruby Agent] " \
19
+ "collects usage data in order to help us improve compatibility\n" \
20
+ "and security coverage. The data is anonymous and does not contain application data. It is collected\n" \
21
+ "by Contrast and is never shared. You can opt-out of telemetry by setting the\n" \
22
+ "'CONTRAST_AGENT_TELEMETRY_OPTOUT' environment variable to '1' or 'true'.\n" \
23
+ 'Read more about [Contrast Security] [Ruby Agent] telemetry: ' \
24
+ "https://docs.contrastsecurity.com/en/ruby-telemetry.html \n\n" \
25
+ "===================================================================================================\n\n"
26
+ }.cs__freeze
27
+
28
+ # Here we create the .telemetry file. If the file exist we do nothing.
29
+ #
30
+ # @return[Boolean, nil] true if file is created, false if file already exist
31
+ # and nil if Telemetry is disabled or on unsupported OS.
32
+ def self.create_telemetry_file
33
+ write_mark_file DIR, FILE, CONFIG_DIR
34
+ end
35
+
36
+ def self.disclaimer
37
+ @_disclaimer = MESSAGE[:disclaimer]
38
+ end
39
+
40
+ class << self
41
+ private
42
+
43
+ # Create the mark file
44
+ #
45
+ # @param dir [String] Directory in which the file is to be created
46
+ # @param file [String] filename of the mark file
47
+ # @param config_dir [String] path for the config folder in working directory
48
+ # @return[Boolean, nil] true if file is created, false if file already exist
49
+ # and nil if Telemetry is disabled or on unsupported OS.
50
+ def write_mark_file dir, file, config_dir
51
+ return unless Contrast::Agent::Telemetry.enabled?
52
+ return if Contrast::Utils::OS.windows?
53
+
54
+ @dir = dir
55
+ # After macOS Catalina, you can no longer store files or data in the read-only system volume,
56
+ # nor can we write to the "root" directory ( / ). This results in Errno::EROFS exception.
57
+ # So for the MacOS we would use the config directory of the instrumented application.
58
+ @dir = config_dir if Contrast::Utils::OS.mac?
59
+ return false if File.file? @dir + file
60
+ return true if touch_marker(@dir, file)
61
+
62
+ # If we don't have permission to write to root directory use config instead
63
+ touch_marker(config_dir, file)
64
+ end
65
+
66
+ # Touches .telemetry file
67
+ #
68
+ # @return[Boolean] true if success, false if fails
69
+ def touch_marker dir, file
70
+ FileUtils.mkdir_p dir unless Dir.exist? dir
71
+ FileUtils.touch dir + file
72
+ File.file? dir + file
73
+ rescue StandardError => _e
74
+ false
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,90 @@
1
+ # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'net/http'
5
+ require 'contrast/utils/net_http_base'
6
+ require 'contrast/components/logger'
7
+ require 'contrast/utils/object_share'
8
+ require 'contrast/agent/version'
9
+ require 'json'
10
+
11
+ module Contrast
12
+ module Utils
13
+ # This module creates a Net::HTTP client and initiates a connection to the provided result
14
+ class TelemetryClient < NetHttpBase
15
+ ENDPOINT = 'api/v1/telemetry/metrics' # /TelemetryEvent.path
16
+ SERVICE_NAME = 'Telemetry'
17
+ include Contrast::Components::Logger::InstanceMethods
18
+ # This method initializes the Net::HTTP client we'll need. it will validate
19
+ # the connection and make the first request. If connection is valid and response
20
+ # is available then the open connection is returned.
21
+ #
22
+ # @param url [String]
23
+ # @return [Net::HTTP, nil] Return open connection or nil
24
+ def initialize_connection url
25
+ super(SERVICE_NAME, url, false, false)
26
+ end
27
+
28
+ # This method will be responsible for building the request. Because the telemetry collector expects to receive
29
+ # multiple events in a single request, we must always wrap the event in an array, even if there is only one.
30
+ #
31
+ # @param event [Contrast::Agent::TelemetryEvent,Contrast::Agent::StartupMetricsTelemetryEvent]
32
+ # @return [Net::HTTP::Post]
33
+ def build_request event
34
+ return unless valid_event? event
35
+
36
+ string_body = [event.to_hash].to_json
37
+ header = {
38
+ 'User-Agent' => "<#{ Contrast::Utils::ObjectShare::RUBY }>-<#{ Contrast::Agent::VERSION }>",
39
+ 'Content-Type' => 'application/json'
40
+ }
41
+ request = Net::HTTP::Post.new(build_path(event.path), header)
42
+ request.body = string_body
43
+ request
44
+ end
45
+
46
+ # This method will create the actual request and send it
47
+ # @param event[Contrast::Agent::TelemetryEvent]
48
+ # @param connection[Net::HTTP]
49
+ def send_request event, connection
50
+ return if connection.nil? || event.nil?
51
+ return unless valid_event? event
52
+
53
+ req = build_request event
54
+ connection.request req
55
+ end
56
+
57
+ # This method will handle the response from the tenant
58
+ # @param res [Net::HTTPResponse]
59
+ # @return sleep_time [Integer, nil]
60
+ def handle_response res
61
+ status_code = res.code.to_i
62
+ ready_after = if res.to_hash.keys.map(&:downcase).include?('ready-after')
63
+ res['Ready-After']
64
+ else
65
+ 60
66
+ end
67
+ ready_after if status_code == 429
68
+ end
69
+
70
+ # This method will be responsible for validating the event
71
+ # @param event[Contrast::Agent::TelemetryEvent,Contrast::Agent::StartupMetricsTelemetryEvent]
72
+ def valid_event? event
73
+ return true if event.cs__is_a?(Contrast::Agent::TelemetryEvent)
74
+ return true if event.cs__is_a?(Contrast::Agent::StartupMetricsTelemetryEvent)
75
+
76
+ false
77
+ end
78
+
79
+ private
80
+
81
+ # The telemetry instance accepts any path to #{ Contrast::Agent::Telemetry::URL }#{ ENDPOINT }, using the
82
+ # remainder of the path to segregate messages.
83
+ #
84
+ # @return [String] the fully qualified path to send the request
85
+ def build_path event_path
86
+ "#{ Contrast::Agent::Telemetry::URL }#{ ENDPOINT }#{ event_path }"
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,130 @@
1
+ # Copyright (c) 2021 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
2
+ # frozen_string_literal: true
3
+
4
+ require 'contrast/agent/telemetry'
5
+ require 'contrast/utils/os'
6
+ require 'socket'
7
+
8
+ module Contrast
9
+ module Utils
10
+ # Tools for supporting the Telemetry feature
11
+ module Telemetry
12
+ # Gets info about the instrumented application required to build unique identifiers,
13
+ # used in the agent's Telemetry.
14
+ module Identifier
15
+ MAC_REGEX = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.cs__freeze
16
+ LINUX_OS_REG = /hwaddr=.*?(([A-F0-9]{2}:){5}[A-F0-9]{2})/im.cs__freeze
17
+ MAC_OS_PRIMARY = 'en0'.cs__freeze
18
+ LINUX_PRIMARY = 'enp'.cs__freeze
19
+
20
+ # Sinatra and Grape both use similar approach to identify the app_name.
21
+ # Rails has a different way of doing it, but to unify this we'll use this one.
22
+ # If app_name is changed/renamed during production it would still get the
23
+ # new folder's name.
24
+ #
25
+ # @ return [String] name of the application from the current working directory
26
+ def self.app_name
27
+ @_app_name ||= File.basename(Dir.pwd)
28
+ end
29
+
30
+ # Returns the MAC address of the primary network interface, depending on the used OS.
31
+ # If the primary is unknown it finds the first available network interface and gets it's
32
+ # MAC address instead.
33
+ #
34
+ # @return [String, nil] MAC address of the primary network interface or
35
+ # the first available one, or nil if nothing found
36
+ def self.mac
37
+ primary = Contrast::Utils::OS.mac? ? MAC_OS_PRIMARY : LINUX_PRIMARY
38
+ @_mac = find_mac(primary) || find_mac
39
+ end
40
+
41
+ class << self
42
+ private
43
+
44
+ # Finds the primary MAC address of all listed network adapters.
45
+ # If primary is not set or unknown, use the first MAC address found
46
+ # from the listed adapters.
47
+ #
48
+ # @param primary [nil, String] optional param if set look only for primary
49
+ # network adapter's name
50
+ # @return [String, nil] MAC address of the first listed network adapter or
51
+ # nil if not found
52
+ def find_mac primary = nil
53
+ result = nil
54
+ idx = 0
55
+ return if interfaces.empty?
56
+
57
+ while idx < interfaces.length
58
+ addr = interfaces[idx].addr
59
+ name = interfaces[idx].name # rubocop:disable Security/Module/Name
60
+ idx += 1
61
+ next if primary && !name.include?(primary)
62
+
63
+ # retrieving MAC address from primary network interface or first available
64
+ mac = retrieve_mac addr
65
+ next unless mac
66
+
67
+ result = mac if mac && (mac.match? MAC_REGEX)
68
+ break if result
69
+ end
70
+ result
71
+ end
72
+
73
+ # Retrieves MAC address for primary or any network interface.
74
+ # This is OS dependent search.
75
+ #
76
+ # @param addr [String] address info
77
+ # example: #<Addrinfo: LINK[en0 aa:bb:cc:00:11:22]>
78
+ # @return mac [nil, String] MAC address of primary network interface,
79
+ # any network interface, or nil if no interface is found.
80
+ def retrieve_mac addr
81
+ # Mac OS allow us to use getnameinfo(sockaddr [, flags]) => [hostname, servicename]
82
+ #
83
+ # returned address:
84
+ # <Socket::Ifaddr en0 UP,BROADCAST,RUNNING,NOTRAILERS,SIMPLEX,MULTICAST LINK[en0 aa:bb:cc:00:11:22]>
85
+ return addr.getnameinfo[0] if Contrast::Utils::OS.mac?
86
+
87
+ # In Linux using Socket::addr#getnameinfo results in ai_family not supported exception.
88
+ # In this case we are relying on match filtering of addresses.
89
+ #
90
+ # returned address:
91
+ # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000
92
+ # PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=aa:bb:cc:00:11:22]>
93
+ return Regexp.last_match(1) if addr.inspect =~ LINUX_OS_REG
94
+
95
+ nil
96
+ end
97
+
98
+ # Returns array of network interfaces.
99
+ # This is OS dependent search.
100
+ #
101
+ # @return interfaces [Array] Returns an array of interface addresses.
102
+ # Socket::Ifaddr - represents a result of getifaddrs().
103
+ def interfaces
104
+ @_interfaces ||= []
105
+
106
+ return @_interfaces unless @_interfaces.empty?
107
+
108
+ arr = Socket.getifaddrs
109
+ idx = 0
110
+ check_family = 0
111
+ while idx < arr.length
112
+ # We need only network adapters MACs. Checking for pfamily of every socket address:
113
+ # 18 for Mac OS and 17 for Linux.
114
+ # family should be an address family such as: :INET, :INET6, :UNIX, etc.
115
+ check_family = 18 if Contrast::Utils::OS.mac?
116
+ check_family = 17 if Contrast::Utils::OS.linux?
117
+ if arr[idx].addr.pfamily != check_family
118
+ idx += 1
119
+ next
120
+ end
121
+ @_interfaces << arr[idx]
122
+ idx += 1
123
+ end
124
+ @_interfaces
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
data/lib/contrast.rb CHANGED
@@ -35,6 +35,7 @@ if RUBY_VERSION >= '3.0.0'
35
35
  end
36
36
 
37
37
  require 'contrast/components/agent'
38
+ require 'contrast/components/api'
38
39
  require 'contrast/components/app_context'
39
40
  require 'contrast/components/assess'
40
41
  require 'contrast/components/config'
@@ -47,6 +48,7 @@ require 'contrast/components/scope'
47
48
  require 'contrast/components/settings'
48
49
 
49
50
  module Contrast
51
+ API = Contrast::Components::Api::Interface.new
50
52
  SCOPE = Contrast::Components::Scope::Interface.new
51
53
  CONFIG = Contrast::Components::Config::Interface.new
52
54
  SETTINGS = Contrast::Components::Settings::Interface.new
@@ -76,3 +78,19 @@ if RUBY_VERSION >= '3.0.0'
76
78
  Class.alias_method(:prepend, :cs__orig_prepend)
77
79
  Class.remove_method(:cs__orig_prepend)
78
80
  end
81
+
82
+ if RUBY_VERSION < '3.0.0'
83
+ # Better handles ancestors for older ruby versions.
84
+ # This is called from C, tread lightly.
85
+ class Module
86
+ @_included_in = []
87
+ # Returns array with modules including this instance
88
+ def included_in
89
+ @_included_in ||= [] unless cs__frozen?
90
+ end
91
+
92
+ def self.included_in
93
+ @_included_in ||= [] unless cs__frozen?
94
+ end
95
+ end
96
+ end
data/ruby-agent.gemspec CHANGED
@@ -89,11 +89,11 @@ end
89
89
 
90
90
  # Dependencies used to run all of our Rubocop during the linting phase.
91
91
  def self.add_rubocop spec
92
- spec.add_development_dependency 'rubocop', '1.13.0'
93
- spec.add_development_dependency 'rubocop-performance', '1.11.0'
94
- spec.add_development_dependency 'rubocop-rails', '2.9.1'
95
- spec.add_development_dependency 'rubocop-rake', '0.5.1'
96
- spec.add_development_dependency 'rubocop-rspec', '2.2.0'
92
+ spec.add_development_dependency 'rubocop', '1.22.3'
93
+ spec.add_development_dependency 'rubocop-performance', '1.12.0'
94
+ spec.add_development_dependency 'rubocop-rails', '2.12.4'
95
+ spec.add_development_dependency 'rubocop-rake', '0.6.0'
96
+ spec.add_development_dependency 'rubocop-rspec', '2.6.0'
97
97
  end
98
98
 
99
99
  # Dependencies not mocked out during RSpec that we test real code of, beyond just frameworks.
@@ -150,7 +150,8 @@ def self.add_files spec
150
150
  'shared_libraries/libfunchook.so',
151
151
  'shared_libraries/funchook.h',
152
152
  'funchook/src/libfunchook.dylib',
153
- 'funchook/src/libfunchook.so')
153
+ 'funchook/src/libfunchook.so',
154
+ '.secrets.baseline')
154
155
  end
155
156
  end
156
157
 
@@ -1 +1 @@
1
- 2.26.0
1
+ 2.27.3
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: 4.12.0
4
+ version: 4.14.1
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: 2021-10-14 00:00:00.000000000 Z
16
+ date: 2021-12-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -147,70 +147,70 @@ dependencies:
147
147
  requirements:
148
148
  - - '='
149
149
  - !ruby/object:Gem::Version
150
- version: 1.13.0
150
+ version: 1.22.3
151
151
  type: :development
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - '='
156
156
  - !ruby/object:Gem::Version
157
- version: 1.13.0
157
+ version: 1.22.3
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: rubocop-performance
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - '='
163
163
  - !ruby/object:Gem::Version
164
- version: 1.11.0
164
+ version: 1.12.0
165
165
  type: :development
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - '='
170
170
  - !ruby/object:Gem::Version
171
- version: 1.11.0
171
+ version: 1.12.0
172
172
  - !ruby/object:Gem::Dependency
173
173
  name: rubocop-rails
174
174
  requirement: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - '='
177
177
  - !ruby/object:Gem::Version
178
- version: 2.9.1
178
+ version: 2.12.4
179
179
  type: :development
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - '='
184
184
  - !ruby/object:Gem::Version
185
- version: 2.9.1
185
+ version: 2.12.4
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: rubocop-rake
188
188
  requirement: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - '='
191
191
  - !ruby/object:Gem::Version
192
- version: 0.5.1
192
+ version: 0.6.0
193
193
  type: :development
194
194
  prerelease: false
195
195
  version_requirements: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - '='
198
198
  - !ruby/object:Gem::Version
199
- version: 0.5.1
199
+ version: 0.6.0
200
200
  - !ruby/object:Gem::Dependency
201
201
  name: rubocop-rspec
202
202
  requirement: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - '='
205
205
  - !ruby/object:Gem::Version
206
- version: 2.2.0
206
+ version: 2.6.0
207
207
  type: :development
208
208
  prerelease: false
209
209
  version_requirements: !ruby/object:Gem::Requirement
210
210
  requirements:
211
211
  - - '='
212
212
  - !ruby/object:Gem::Version
213
- version: 2.2.0
213
+ version: 2.6.0
214
214
  - !ruby/object:Gem::Dependency
215
215
  name: simplecov
216
216
  requirement: !ruby/object:Gem::Requirement
@@ -617,19 +617,20 @@ executables:
617
617
  - contrast_service
618
618
  extensions:
619
619
  - ext/cs__common/extconf.rb
620
- - ext/cs__assess_array/extconf.rb
621
620
  - ext/cs__assess_fiber_track/extconf.rb
622
- - ext/cs__assess_marshal_module/extconf.rb
623
- - ext/cs__assess_active_record_named/extconf.rb
624
- - ext/cs__assess_basic_object/extconf.rb
621
+ - ext/cs__assess_array/extconf.rb
625
622
  - ext/cs__assess_string/extconf.rb
626
- - ext/cs__assess_string_interpolation26/extconf.rb
627
- - ext/cs__assess_hash/extconf.rb
628
- - ext/cs__assess_module/extconf.rb
629
623
  - ext/cs__assess_regexp/extconf.rb
630
- - ext/cs__assess_kernel/extconf.rb
631
- - ext/cs__contrast_patch/extconf.rb
632
624
  - ext/cs__assess_yield_track/extconf.rb
625
+ - ext/cs__assess_active_record_named/extconf.rb
626
+ - ext/cs__contrast_patch/extconf.rb
627
+ - ext/cs__assess_kernel/extconf.rb
628
+ - ext/cs__assess_hash/extconf.rb
629
+ - ext/cs__assess_string_interpolation26/extconf.rb
630
+ - ext/cs__os_information/extconf.rb
631
+ - ext/cs__assess_marshal_module/extconf.rb
632
+ - ext/cs__assess_basic_object/extconf.rb
633
+ - ext/cs__assess_module/extconf.rb
633
634
  extra_rdoc_files: []
634
635
  files:
635
636
  - ".clang-format"
@@ -687,6 +688,9 @@ files:
687
688
  - ext/cs__contrast_patch/cs__contrast_patch.c
688
689
  - ext/cs__contrast_patch/cs__contrast_patch.h
689
690
  - ext/cs__contrast_patch/extconf.rb
691
+ - ext/cs__os_information/cs__os_information.c
692
+ - ext/cs__os_information/cs__os_information.h
693
+ - ext/cs__os_information/extconf.rb
690
694
  - ext/extconf_common.rb
691
695
  - funchook/LICENSE
692
696
  - funchook/Makefile.in
@@ -894,11 +898,13 @@ files:
894
898
  - lib/contrast/agent/inventory/policy/datastores.rb
895
899
  - lib/contrast/agent/inventory/policy/policy.rb
896
900
  - lib/contrast/agent/inventory/policy/trigger_node.rb
901
+ - lib/contrast/agent/metric_telemetry_event.rb
897
902
  - lib/contrast/agent/middleware.rb
898
903
  - lib/contrast/agent/module_data.rb
899
904
  - lib/contrast/agent/patching/policy/after_load_patch.rb
900
905
  - lib/contrast/agent/patching/policy/after_load_patcher.rb
901
906
  - lib/contrast/agent/patching/policy/method_policy.rb
907
+ - lib/contrast/agent/patching/policy/method_policy_extend.rb
902
908
  - lib/contrast/agent/patching/policy/module_policy.rb
903
909
  - lib/contrast/agent/patching/policy/patch.rb
904
910
  - lib/contrast/agent/patching/policy/patch_status.rb
@@ -936,15 +942,28 @@ files:
936
942
  - lib/contrast/agent/protect/rule/xxe.rb
937
943
  - lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb
938
944
  - lib/contrast/agent/reaction_processor.rb
945
+ - lib/contrast/agent/reporting/report.rb
946
+ - lib/contrast/agent/reporting/reporter.rb
947
+ - lib/contrast/agent/reporting/reporting_events/finding.rb
948
+ - lib/contrast/agent/reporting/reporting_events/preflight.rb
949
+ - lib/contrast/agent/reporting/reporting_events/preflight_message.rb
950
+ - lib/contrast/agent/reporting/reporting_events/reporting_event.rb
951
+ - lib/contrast/agent/reporting/reporting_utilities/audit.rb
952
+ - lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb
953
+ - lib/contrast/agent/reporting/reporting_utilities/reporting_storage.rb
939
954
  - lib/contrast/agent/request.rb
940
955
  - lib/contrast/agent/request_context.rb
956
+ - lib/contrast/agent/request_context_extend.rb
941
957
  - lib/contrast/agent/request_handler.rb
942
958
  - lib/contrast/agent/response.rb
943
959
  - lib/contrast/agent/rewriter.rb
944
960
  - lib/contrast/agent/rule_set.rb
945
961
  - lib/contrast/agent/scope.rb
946
962
  - lib/contrast/agent/service_heartbeat.rb
963
+ - lib/contrast/agent/startup_metrics_telemetry_event.rb
947
964
  - lib/contrast/agent/static_analysis.rb
965
+ - lib/contrast/agent/telemetry.rb
966
+ - lib/contrast/agent/telemetry_event.rb
948
967
  - lib/contrast/agent/thread.rb
949
968
  - lib/contrast/agent/thread_watcher.rb
950
969
  - lib/contrast/agent/tracepoint_hook.rb
@@ -968,6 +987,7 @@ files:
968
987
  - lib/contrast/api/decorators/application_settings.rb
969
988
  - lib/contrast/api/decorators/application_startup.rb
970
989
  - lib/contrast/api/decorators/application_update.rb
990
+ - lib/contrast/api/decorators/finding.rb
971
991
  - lib/contrast/api/decorators/http_request.rb
972
992
  - lib/contrast/api/decorators/input_analysis.rb
973
993
  - lib/contrast/api/decorators/instrumentation_mode.rb
@@ -986,7 +1006,9 @@ files:
986
1006
  - lib/contrast/api/dtm.pb.rb
987
1007
  - lib/contrast/api/settings.pb.rb
988
1008
  - lib/contrast/components/agent.rb
1009
+ - lib/contrast/components/api.rb
989
1010
  - lib/contrast/components/app_context.rb
1011
+ - lib/contrast/components/app_context_extend.rb
990
1012
  - lib/contrast/components/assess.rb
991
1013
  - lib/contrast/components/base.rb
992
1014
  - lib/contrast/components/config.rb
@@ -1000,11 +1022,14 @@ files:
1000
1022
  - lib/contrast/components/settings.rb
1001
1023
  - lib/contrast/config.rb
1002
1024
  - lib/contrast/config/agent_configuration.rb
1025
+ - lib/contrast/config/api_configuration.rb
1026
+ - lib/contrast/config/api_proxy_configuration.rb
1003
1027
  - lib/contrast/config/application_configuration.rb
1004
1028
  - lib/contrast/config/assess_configuration.rb
1005
1029
  - lib/contrast/config/assess_rules_configuration.rb
1006
1030
  - lib/contrast/config/base_configuration.rb
1007
- - lib/contrast/config/default_value.rb
1031
+ - lib/contrast/config/certification_configuration.rb
1032
+ - lib/contrast/config/env_variables.rb
1008
1033
  - lib/contrast/config/exception_configuration.rb
1009
1034
  - lib/contrast/config/heap_dump_configuration.rb
1010
1035
  - lib/contrast/config/inventory_configuration.rb
@@ -1012,6 +1037,7 @@ files:
1012
1037
  - lib/contrast/config/protect_configuration.rb
1013
1038
  - lib/contrast/config/protect_rule_configuration.rb
1014
1039
  - lib/contrast/config/protect_rules_configuration.rb
1040
+ - lib/contrast/config/request_audit_configuration.rb
1015
1041
  - lib/contrast/config/root_configuration.rb
1016
1042
  - lib/contrast/config/ruby_configuration.rb
1017
1043
  - lib/contrast/config/sampling_configuration.rb
@@ -1040,6 +1066,7 @@ files:
1040
1066
  - lib/contrast/framework/base_support.rb
1041
1067
  - lib/contrast/framework/grape/support.rb
1042
1068
  - lib/contrast/framework/manager.rb
1069
+ - lib/contrast/framework/manager_extend.rb
1043
1070
  - lib/contrast/framework/platform_version.rb
1044
1071
  - lib/contrast/framework/rack/patch/session_cookie.rb
1045
1072
  - lib/contrast/framework/rack/patch/support.rb
@@ -1064,26 +1091,46 @@ files:
1064
1091
  - lib/contrast/security_exception.rb
1065
1092
  - lib/contrast/tasks/config.rb
1066
1093
  - lib/contrast/tasks/service.rb
1094
+ - lib/contrast/utils/assess/propagation_method_utils.rb
1095
+ - lib/contrast/utils/assess/property/tagged_utils.rb
1067
1096
  - lib/contrast/utils/assess/sampling_util.rb
1097
+ - lib/contrast/utils/assess/source_method_utils.rb
1068
1098
  - lib/contrast/utils/assess/tracking_util.rb
1099
+ - lib/contrast/utils/assess/trigger_method_utils.rb
1069
1100
  - lib/contrast/utils/class_util.rb
1070
1101
  - lib/contrast/utils/duck_utils.rb
1071
1102
  - lib/contrast/utils/env_configuration_item.rb
1103
+ - lib/contrast/utils/exclude_key.rb
1104
+ - lib/contrast/utils/findings.rb
1072
1105
  - lib/contrast/utils/hash_digest.rb
1106
+ - lib/contrast/utils/hash_digest_extend.rb
1107
+ - lib/contrast/utils/head_dump_utils_extend.rb
1073
1108
  - lib/contrast/utils/heap_dump_util.rb
1074
1109
  - lib/contrast/utils/invalid_configuration_util.rb
1075
1110
  - lib/contrast/utils/io_util.rb
1076
1111
  - lib/contrast/utils/job_servers_running.rb
1112
+ - lib/contrast/utils/log_utils.rb
1077
1113
  - lib/contrast/utils/lru_cache.rb
1114
+ - lib/contrast/utils/metrics_hash.rb
1115
+ - lib/contrast/utils/middleware_utils.rb
1116
+ - lib/contrast/utils/net_http_base.rb
1078
1117
  - lib/contrast/utils/object_share.rb
1079
1118
  - lib/contrast/utils/os.rb
1119
+ - lib/contrast/utils/patching/policy/patch_utils.rb
1120
+ - lib/contrast/utils/patching/policy/patcher_utils.rb
1080
1121
  - lib/contrast/utils/preflight_util.rb
1122
+ - lib/contrast/utils/request_utils.rb
1081
1123
  - lib/contrast/utils/resource_loader.rb
1124
+ - lib/contrast/utils/response_utils.rb
1082
1125
  - lib/contrast/utils/ruby_ast_rewriter.rb
1083
1126
  - lib/contrast/utils/sha256_builder.rb
1084
1127
  - lib/contrast/utils/stack_trace_utils.rb
1085
1128
  - lib/contrast/utils/string_utils.rb
1129
+ - lib/contrast/utils/substitution_utils.rb
1086
1130
  - lib/contrast/utils/tag_util.rb
1131
+ - lib/contrast/utils/telemetry.rb
1132
+ - lib/contrast/utils/telemetry_client.rb
1133
+ - lib/contrast/utils/telemetry_identifier.rb
1087
1134
  - lib/contrast/utils/thread_tracker.rb
1088
1135
  - lib/contrast/utils/timer.rb
1089
1136
  - resources/assess/policy.json
@@ -1,17 +0,0 @@
1
- # Copyright (c) 2021 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 Config
6
- # This is the wrapper for the default values in the configurations, used to
7
- # differentiate between nil or false defaults and things being set
8
- # explicitly to false.
9
- class DefaultValue
10
- attr_reader :value
11
-
12
- def initialize value
13
- @value = value
14
- end
15
- end
16
- end
17
- end