contrast-agent 6.5.0 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/contrast/agent/protect/rule/base.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/audit.rb +5 -5
- data/lib/contrast/agent/reporting/reporting_utilities/headers.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/reporter_client.rb +1 -1
- data/lib/contrast/agent/reporting/reporting_utilities/response_handler_utils.rb +1 -1
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/api/communication/response_processor.rb +1 -1
- data/lib/contrast/components/agent.rb +1 -1
- data/lib/contrast/components/api.rb +60 -23
- data/lib/contrast/components/protect.rb +41 -1
- data/lib/contrast/components/sampling.rb +29 -0
- data/lib/contrast/config/assess_configuration.rb +5 -3
- data/lib/contrast/config/root_configuration.rb +9 -9
- data/lib/contrast/config.rb +0 -3
- data/lib/contrast/utils/net_http_base.rb +2 -2
- data/lib/contrast.rb +2 -2
- data/resources/assess/policy.json +11 -0
- data/resources/deadzone/policy.json +132 -19
- metadata +2 -5
- data/lib/contrast/config/api_configuration.rb +0 -56
- data/lib/contrast/config/protect_configuration.rb +0 -33
- data/lib/contrast/config/sampling_configuration.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 958ef5b303e23294af4b85759012ab4c80cb0000d97088b4c8f495560701b91e
|
4
|
+
data.tar.gz: 714c35c53e89cc2f6335fda57827c5eba620e2ee42ede41d586f072f074defb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3e1c9a23238e9c3a6727fcd19e1ddf177ac699fcb2200eb1ae190f6a9022a3c5b8e0ee109c90793634cbeb54245f07e3b043e244664782f4a83d34896270baa
|
7
|
+
data.tar.gz: 79b54ad82d5df30ff7c95499d0862947703a6f6dadab29d3f946072d6c91cd84e3a4207dad71e2be9584b720471325d8eb8fb7d124c4bf4136c4b01a225560bf
|
@@ -26,12 +26,12 @@ module Contrast
|
|
26
26
|
# event field of Contrast::Agent::Reporting::ReportingEvent
|
27
27
|
# @param response_data [Net::HTTP::Response]
|
28
28
|
def audit_event event, response_data = nil
|
29
|
-
return unless ::Contrast::API.request_audit_requests
|
29
|
+
return unless ::Contrast::API.request_audit_requests || ::Contrast::API.request_audit_responses
|
30
30
|
|
31
31
|
file_name = event.cs__respond_to?(:file_name) ? event.file_name : event.cs__class.cs__name.to_s.downcase
|
32
32
|
data = event.to_controlled_hash.to_json
|
33
33
|
log_data(:request, file_name, data) if data
|
34
|
-
return unless ::Contrast::API.request_audit_responses
|
34
|
+
return unless ::Contrast::API.request_audit_responses
|
35
35
|
|
36
36
|
data = response_data&.body || 'There is no available response'
|
37
37
|
log_data(:response, file_name, data)
|
@@ -94,7 +94,7 @@ module Contrast
|
|
94
94
|
# Retrieves the configuration value if the request audit is enabled
|
95
95
|
# @return [Boolean]
|
96
96
|
def enabled?
|
97
|
-
::Contrast::API.request_audit_enable
|
97
|
+
::Contrast::API.request_audit_enable
|
98
98
|
end
|
99
99
|
|
100
100
|
# The boolean values for the requests and the responses should be taken under
|
@@ -107,13 +107,13 @@ module Contrast
|
|
107
107
|
# Retrieve the configuration value if the audit for requests is enabled
|
108
108
|
# @return [Boolean]
|
109
109
|
def enabled_for_requests?
|
110
|
-
::Contrast::API.request_audit_requests
|
110
|
+
::Contrast::API.request_audit_requests
|
111
111
|
end
|
112
112
|
|
113
113
|
# Retrieve the configuration value if the audit for responses is enabled
|
114
114
|
# @return [Boolean]
|
115
115
|
def enabled_for_responses?
|
116
|
-
::Contrast::API.request_audit_requests
|
116
|
+
::Contrast::API.request_audit_requests
|
117
117
|
end
|
118
118
|
|
119
119
|
# Retrieve the configuration value for the path of the audits
|
@@ -24,7 +24,7 @@ module Contrast
|
|
24
24
|
@app_language = RUBY
|
25
25
|
@app_path = Base64.strict_encode64(Contrast::APP_CONTEXT.path)
|
26
26
|
@app_version = Contrast::APP_CONTEXT.app_version
|
27
|
-
@authorization = Base64.strict_encode64("#{ Contrast::API.
|
27
|
+
@authorization = Base64.strict_encode64("#{ Contrast::API.user_name }:#{ Contrast::API.service_key }")
|
28
28
|
@server_name = Base64.strict_encode64(Contrast::APP_CONTEXT.server_name)
|
29
29
|
@server_path = Base64.strict_encode64(Contrast::APP_CONTEXT.server_path)
|
30
30
|
@server_type = Base64.strict_encode64(Contrast::APP_CONTEXT.server_type)
|
@@ -59,7 +59,7 @@ module Contrast
|
|
59
59
|
|
60
60
|
request = build_request(event)
|
61
61
|
response = connection.request(request)
|
62
|
-
audit&.audit_event(event, response) if ::Contrast::API.request_audit_enable
|
62
|
+
audit&.audit_event(event, response) if ::Contrast::API.request_audit_enable
|
63
63
|
process_settings_response(response)
|
64
64
|
process_preflight_response(event, response, connection)
|
65
65
|
response
|
@@ -185,7 +185,7 @@ module Contrast
|
|
185
185
|
::Contrast::SETTINGS.build_protect_rules if ::Contrast::PROTECT.enabled?
|
186
186
|
::Contrast::AGENT.reset_ruleset
|
187
187
|
logger.info('Current rule settings:')
|
188
|
-
::Contrast::PROTECT.
|
188
|
+
::Contrast::PROTECT.defend_rules.each { |k, v| logger.info('Protect Rule mode set', rule: k, mode: v.mode) }
|
189
189
|
logger.info('Disabled Assess Rules', rules: ::Contrast::ASSESS.disabled_rules)
|
190
190
|
end
|
191
191
|
end
|
@@ -80,7 +80,7 @@ module Contrast
|
|
80
80
|
|
81
81
|
logger.info('Current rule settings:')
|
82
82
|
|
83
|
-
::Contrast::PROTECT.
|
83
|
+
::Contrast::PROTECT.defend_rules.each { |k, v| logger.info('Protect Rule mode set', rule: k, mode: v.mode) }
|
84
84
|
logger.info('Disabled Assess Rules', rules: ::Contrast::ASSESS.disabled_rules)
|
85
85
|
end
|
86
86
|
end
|
@@ -3,6 +3,9 @@
|
|
3
3
|
|
4
4
|
require 'contrast/components/base'
|
5
5
|
require 'contrast/components/config'
|
6
|
+
require 'contrast/config/api_proxy_configuration'
|
7
|
+
require 'contrast/config/request_audit_configuration'
|
8
|
+
require 'contrast/config/certification_configuration'
|
6
9
|
|
7
10
|
module Contrast
|
8
11
|
module Components
|
@@ -12,50 +15,86 @@ module Contrast
|
|
12
15
|
# parent_configuration_spec.yaml.
|
13
16
|
class Interface
|
14
17
|
include Contrast::Components::ComponentBase
|
18
|
+
include Contrast::Config::BaseConfiguration
|
19
|
+
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :api_key
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :user_name
|
24
|
+
# @return [String]
|
25
|
+
attr_accessor :service_key
|
26
|
+
attr_writer :url
|
27
|
+
|
28
|
+
DEFAULT_URL = 'https://app.contrastsecurity.com/Contrast'
|
29
|
+
|
30
|
+
def initialize hsh = {}
|
31
|
+
return unless hsh
|
32
|
+
|
33
|
+
@api_key = hsh[:api_key]
|
34
|
+
@url = hsh[:url]
|
35
|
+
@user_name = hsh[:user_name]
|
36
|
+
@service_key = hsh[:service_key]
|
37
|
+
@_proxy = Contrast::Config::ApiProxyConfiguration.new(hsh[:proxy])
|
38
|
+
@_request_audit = Contrast::Config::RequestAuditConfiguration.new(hsh[:request_audit])
|
39
|
+
@_certificate = Contrast::Config::CertificationConfiguration.new(hsh[:certificate])
|
40
|
+
end
|
15
41
|
|
16
|
-
def
|
17
|
-
@
|
18
|
-
tmp = ::Contrast::CONFIG.root.api.url
|
19
|
-
tmp += '/Contrast' unless tmp.end_with?('/Contrast')
|
20
|
-
tmp
|
21
|
-
end
|
42
|
+
def url
|
43
|
+
@url.nil? ? DEFAULT_URL : @url
|
22
44
|
end
|
23
45
|
|
24
|
-
|
25
|
-
|
46
|
+
# @return [Contrast::Config::ApiProxyConfiguration]
|
47
|
+
def proxy
|
48
|
+
return @_proxy unless @_proxy.nil?
|
49
|
+
|
50
|
+
@_proxy = Contrast::Config::ApiProxyConfiguration.new
|
26
51
|
end
|
27
52
|
|
28
|
-
|
29
|
-
|
53
|
+
# @return [Contrast::Config::RequestAuditConfiguration]
|
54
|
+
def request_audit
|
55
|
+
return @_request_audit unless @_request_audit.nil?
|
56
|
+
|
57
|
+
@_request_audit = Contrast::Config::RequestAuditConfiguration.new
|
30
58
|
end
|
31
59
|
|
32
|
-
|
33
|
-
|
60
|
+
# @return [Contrast::Config::CertificationConfiguration]
|
61
|
+
def certificate
|
62
|
+
return @_certificate unless @_certificate.nil?
|
63
|
+
|
64
|
+
@_certificate = Contrast::Config::CertificationConfiguration.new
|
34
65
|
end
|
35
66
|
|
36
|
-
def
|
37
|
-
|
67
|
+
def api_url
|
68
|
+
@_api_url ||= begin
|
69
|
+
tmp = Contrast::CONFIG.root.api.url
|
70
|
+
tmp += '/Contrast' unless tmp.end_with?('/Contrast')
|
71
|
+
tmp
|
72
|
+
end
|
73
|
+
end
|
38
74
|
|
39
|
-
|
75
|
+
def proxy_enable
|
76
|
+
return @_proxy_enable unless @_proxy_enable.nil?
|
77
|
+
|
78
|
+
@_proxy_enable = true?(::Contrast::CONFIG.root.api.proxy.enable)
|
40
79
|
end
|
41
80
|
|
42
81
|
def proxy_url
|
43
|
-
|
82
|
+
proxy.url
|
44
83
|
end
|
45
84
|
|
46
|
-
def request_audit_enable
|
85
|
+
def request_audit_enable
|
47
86
|
return @_request_audit_enable unless @_request_audit_enable.nil?
|
48
87
|
|
49
88
|
@_request_audit_enable = true?(::Contrast::CONFIG.root.api.request_audit.enable)
|
50
89
|
end
|
51
90
|
|
52
|
-
def request_audit_requests
|
91
|
+
def request_audit_requests
|
53
92
|
return @_request_audit_requests unless @_request_audit_requests.nil?
|
54
93
|
|
55
94
|
@_request_audit_requests = true?(::Contrast::CONFIG.root.api.request_audit.requests)
|
56
95
|
end
|
57
96
|
|
58
|
-
def request_audit_responses
|
97
|
+
def request_audit_responses
|
59
98
|
return @_request_audit_responses unless @_request_audit_responses.nil?
|
60
99
|
|
61
100
|
@_request_audit_responses = true?(::Contrast::CONFIG.root.api.request_audit.responses)
|
@@ -65,10 +104,8 @@ module Contrast
|
|
65
104
|
@_request_audit_path ||= ::Contrast::CONFIG.root.api.request_audit.path.to_s
|
66
105
|
end
|
67
106
|
|
68
|
-
def
|
69
|
-
|
70
|
-
|
71
|
-
@_certification_enabled = certification_truly_enabled?(::Contrast::CONFIG.root.api.certificate)
|
107
|
+
def certification_enable
|
108
|
+
@_certification_enable ||= certification_truly_enabled?(::Contrast::CONFIG.root.api.certificate)
|
72
109
|
end
|
73
110
|
|
74
111
|
def certification_ca_file
|
@@ -2,6 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'contrast/components/base'
|
5
|
+
require 'contrast/config/exception_configuration'
|
6
|
+
require 'contrast/config/protect_rule_configuration'
|
5
7
|
|
6
8
|
module Contrast
|
7
9
|
module Components
|
@@ -10,6 +12,39 @@ module Contrast
|
|
10
12
|
# its parent_configuration_spec.yaml. Specifically, this allows for querying the state of the Protect product.
|
11
13
|
class Interface
|
12
14
|
include Contrast::Components::ComponentBase
|
15
|
+
include Contrast::Config::BaseConfiguration
|
16
|
+
|
17
|
+
# @return [Boolean, nil]
|
18
|
+
attr_accessor :enable
|
19
|
+
|
20
|
+
def initialize hsh = {}
|
21
|
+
return unless hsh
|
22
|
+
|
23
|
+
@_exceptions = Contrast::Config::ExceptionConfiguration.new(hsh[:exceptions])
|
24
|
+
@_rules = Contrast::Config::ProtectRulesConfiguration.new(hsh[:rules])
|
25
|
+
@enable = hsh[:enable]
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Contrast::Config::ExceptionConfiguration]
|
29
|
+
def exceptions
|
30
|
+
@_exceptions ||= Contrast::Config::ExceptionConfiguration.new
|
31
|
+
end
|
32
|
+
|
33
|
+
# Name is kept the same - rules to correspond to config,
|
34
|
+
# mapping. - root.protect.rules
|
35
|
+
#
|
36
|
+
# @return [Contrast::Config::ProtectRulesConfiguration]
|
37
|
+
def rules
|
38
|
+
@_rules ||= Contrast::Config::ProtectRulesConfiguration.new
|
39
|
+
end
|
40
|
+
|
41
|
+
def rules= new_rules
|
42
|
+
@_rules = new_rules
|
43
|
+
end
|
44
|
+
|
45
|
+
def exceptions= new_exceptions
|
46
|
+
@_exceptions = new_exceptions
|
47
|
+
end
|
13
48
|
|
14
49
|
def enabled?
|
15
50
|
# config overrides if forcibly set
|
@@ -23,7 +58,12 @@ module Contrast
|
|
23
58
|
::Contrast::CONFIG.root.protect.rules
|
24
59
|
end
|
25
60
|
|
26
|
-
|
61
|
+
# Returns Protect array of all initialized
|
62
|
+
# protect rules.
|
63
|
+
#
|
64
|
+
# @return defend_rules[Hash<Contrast::SETTINGS.protect_state.rules>]
|
65
|
+
#
|
66
|
+
def defend_rules
|
27
67
|
::Contrast::SETTINGS.protect_state.rules
|
28
68
|
end
|
29
69
|
|
@@ -91,6 +91,35 @@ module Contrast
|
|
91
91
|
include Constants
|
92
92
|
include ClassMethods
|
93
93
|
end
|
94
|
+
|
95
|
+
class Interface # :nodoc:
|
96
|
+
include InstanceMethods
|
97
|
+
include Contrast::Config::BaseConfiguration
|
98
|
+
|
99
|
+
# @return [Integer, nil]
|
100
|
+
attr_reader :baseline
|
101
|
+
# @return [Integer, nil]
|
102
|
+
attr_reader :request_frequency
|
103
|
+
# @return [Integer, nil]
|
104
|
+
attr_reader :response_frequency
|
105
|
+
# @return [Integer, nil]
|
106
|
+
attr_reader :window_ms
|
107
|
+
|
108
|
+
def initialize hsh = {}
|
109
|
+
return unless hsh
|
110
|
+
|
111
|
+
@enable = hsh[:enable]
|
112
|
+
@baseline = hsh[:baseline]
|
113
|
+
@request_frequency = hsh[:request_frequency]
|
114
|
+
@response_frequency = hsh[:response_frequency]
|
115
|
+
@window_ms = hsh[:window_ms]
|
116
|
+
end
|
117
|
+
|
118
|
+
# @return [Boolean, false]
|
119
|
+
def enable
|
120
|
+
!!@enable
|
121
|
+
end
|
122
|
+
end
|
94
123
|
end
|
95
124
|
end
|
96
125
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require 'contrast/components/sampling'
|
5
|
+
|
4
6
|
module Contrast
|
5
7
|
module Config
|
6
8
|
# Common Configuration settings. Those in this section pertain to the
|
@@ -28,7 +30,7 @@ module Contrast
|
|
28
30
|
@enable_scan_response = hsh[:enable_scan_response]
|
29
31
|
@enable_dynamic_sources = hsh[:enable_dynamic_sources]
|
30
32
|
@enable_original_object = hsh[:enable_original_object]
|
31
|
-
@sampling = Contrast::
|
33
|
+
@sampling = Contrast::Components::Sampling::Interface.new(hsh[:sampling])
|
32
34
|
@rules = Contrast::Config::AssessRulesConfiguration.new(hsh[:rules])
|
33
35
|
@stacktraces = hsh[:stacktraces]
|
34
36
|
@max_context_source_events = hsh[:max_context_source_events]
|
@@ -52,9 +54,9 @@ module Contrast
|
|
52
54
|
@enable_original_object.nil? ? true : @enable_original_object
|
53
55
|
end
|
54
56
|
|
55
|
-
# @return [Contrast::
|
57
|
+
# @return [Contrast::Components::Sampling::Interface]
|
56
58
|
def sampling
|
57
|
-
@sampling ||= Contrast::
|
59
|
+
@sampling ||= Contrast::Components::Sampling::Interface.new
|
58
60
|
end
|
59
61
|
|
60
62
|
# @return [Contrast::Config::AssessRulesConfiguration]
|
@@ -3,14 +3,14 @@
|
|
3
3
|
|
4
4
|
require 'contrast/components/agent'
|
5
5
|
require 'contrast/components/inventory'
|
6
|
-
|
6
|
+
require 'contrast/components/protect'
|
7
7
|
module Contrast
|
8
8
|
module Config
|
9
9
|
# The base of the Common Configuration settings.
|
10
10
|
class RootConfiguration
|
11
11
|
include Contrast::Config::BaseConfiguration
|
12
12
|
|
13
|
-
# @return [Contrast::
|
13
|
+
# @return [Contrast::Components::Api::Interface]
|
14
14
|
attr_writer :api
|
15
15
|
# @return [Contrast::Components::Agent::Interface]
|
16
16
|
attr_writer :agent
|
@@ -22,7 +22,7 @@ module Contrast
|
|
22
22
|
attr_writer :assess
|
23
23
|
# @return [Contrast::Components::Inventory::Interface]
|
24
24
|
attr_writer :inventory
|
25
|
-
# @return [Contrast::
|
25
|
+
# @return [Contrast::Components::Protect::Interface]
|
26
26
|
attr_writer :protect
|
27
27
|
# @return [Contrast::Config::ServiceConfiguration]
|
28
28
|
attr_writer :service
|
@@ -33,20 +33,20 @@ module Contrast
|
|
33
33
|
def initialize hsh = {}
|
34
34
|
raise(ArgumentError, 'Expected a hash') unless hsh.is_a?(Hash)
|
35
35
|
|
36
|
-
@api = Contrast::
|
36
|
+
@api = Contrast::Components::Api::Interface.new(hsh[:api])
|
37
37
|
@enable = hsh[:enable]
|
38
38
|
@agent = Contrast::Components::Agent::Interface.new(hsh[:agent])
|
39
39
|
@application = Contrast::Config::ApplicationConfiguration.new(hsh[:application])
|
40
40
|
@server = Contrast::Config::ServerConfiguration.new(hsh[:server])
|
41
41
|
@assess = Contrast::Config::AssessConfiguration.new(hsh[:assess])
|
42
42
|
@inventory = Contrast::Components::Inventory::Interface.new(hsh[:inventory])
|
43
|
-
@protect = Contrast::
|
43
|
+
@protect = Contrast::Components::Protect::Interface.new(hsh[:protect])
|
44
44
|
@service = Contrast::Config::ServiceConfiguration.new(hsh[:service])
|
45
45
|
end
|
46
46
|
|
47
|
-
# @return [Contrast::
|
47
|
+
# @return [Contrast::Components::Api::Interface]
|
48
48
|
def api
|
49
|
-
@api ||= Contrast::
|
49
|
+
@api ||= Contrast::Components::Api::Interface.new
|
50
50
|
end
|
51
51
|
|
52
52
|
# @return [Contrast::Components::Agent::Interface]
|
@@ -74,9 +74,9 @@ module Contrast
|
|
74
74
|
@inventory ||= Contrast::Components::Inventory::Interface.new
|
75
75
|
end
|
76
76
|
|
77
|
-
# @return [Contrast::
|
77
|
+
# @return [Contrast::Components::Protect::Interface]
|
78
78
|
def protect
|
79
|
-
@protect ||= Contrast::
|
79
|
+
@protect ||= Contrast::Components::Protect::Interface.new
|
80
80
|
end
|
81
81
|
|
82
82
|
# @return [Contrast::Config::ServiceConfiguration]
|
data/lib/contrast/config.rb
CHANGED
@@ -16,12 +16,9 @@ require 'contrast/config/exception_configuration'
|
|
16
16
|
require 'contrast/config/assess_rules_configuration'
|
17
17
|
require 'contrast/config/protect_rule_configuration'
|
18
18
|
require 'contrast/config/protect_rules_configuration'
|
19
|
-
require 'contrast/config/sampling_configuration'
|
20
19
|
|
21
20
|
require 'contrast/config/ruby_configuration'
|
22
|
-
require 'contrast/config/api_configuration'
|
23
21
|
require 'contrast/config/application_configuration'
|
24
22
|
require 'contrast/config/server_configuration'
|
25
23
|
require 'contrast/config/assess_configuration'
|
26
|
-
require 'contrast/config/protect_configuration'
|
27
24
|
require 'contrast/config/root_configuration'
|
@@ -131,7 +131,7 @@ module Contrast
|
|
131
131
|
end
|
132
132
|
return initialize_client if addr.host.to_s.include?('localhost') # TODO: RUBY-99999 allow http w/ localhost
|
133
133
|
|
134
|
-
assign_cert(initialize_client) if use_custom_cert && Contrast::API.
|
134
|
+
assign_cert(initialize_client) if use_custom_cert && Contrast::API.certification_enable
|
135
135
|
initialize_client.use_ssl = true
|
136
136
|
initialize_client.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
137
137
|
initialize_client.verify_depth = 5
|
@@ -150,7 +150,7 @@ module Contrast
|
|
150
150
|
def proxy_enabled?
|
151
151
|
return @_proxy_enabled unless @_proxy_enabled.nil?
|
152
152
|
|
153
|
-
@_proxy_enabled = Contrast::API.
|
153
|
+
@_proxy_enabled = Contrast::API.proxy_enable && !Contrast::API.proxy_url.nil?
|
154
154
|
end
|
155
155
|
|
156
156
|
# Retrieve the IP address from the client.
|
data/lib/contrast.rb
CHANGED
@@ -71,9 +71,9 @@ require 'contrast/agent/telemetry/events/exceptions/telemetry_exception_event'
|
|
71
71
|
require 'protobuf' # TODO: RUBY-1438
|
72
72
|
|
73
73
|
module Contrast
|
74
|
-
API = Contrast::Components::Api::Interface.new
|
75
|
-
SCOPE = Contrast::Components::Scope::Interface.new
|
76
74
|
CONFIG = Contrast::Components::Config::Interface.new
|
75
|
+
SCOPE = Contrast::Components::Scope::Interface.new
|
76
|
+
API = CONFIG.root.api
|
77
77
|
SETTINGS = Contrast::Components::Settings::Interface.new
|
78
78
|
ASSESS = Contrast::Components::Assess::Interface.new
|
79
79
|
PROTECT = Contrast::Components::Protect::Interface.new
|
@@ -1096,6 +1096,17 @@
|
|
1096
1096
|
"tags":["SQL_ENCODED"],
|
1097
1097
|
"untags":["SQL_DECODED"]
|
1098
1098
|
},
|
1099
|
+
{
|
1100
|
+
"class_name":"ActiveRecord::ConnectionAdapters::Quoting",
|
1101
|
+
"instance_method": true,
|
1102
|
+
"method_visibility": "public",
|
1103
|
+
"method_name":"quote",
|
1104
|
+
"source": "P0",
|
1105
|
+
"target": "R",
|
1106
|
+
"action": "SPLAT",
|
1107
|
+
"tags":["SQL_ENCODED"],
|
1108
|
+
"untags":["SQL_DECODED"]
|
1109
|
+
},
|
1099
1110
|
{
|
1100
1111
|
"class_name":"IO",
|
1101
1112
|
"method_name":"initialize",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"deadzones":[
|
3
3
|
{
|
4
|
-
"class_name":"
|
4
|
+
"class_name":"RSpec::Core::Example",
|
5
5
|
"instance_method":true,
|
6
6
|
"method_visibility": "private",
|
7
7
|
"method_name":"finish"
|
@@ -49,19 +49,20 @@
|
|
49
49
|
"class_name":"Rack::Session::Cookie",
|
50
50
|
"instance_method":true,
|
51
51
|
"method_visibility": "public",
|
52
|
-
"method_name":"
|
52
|
+
"method_name":"set_session"
|
53
53
|
}, {
|
54
54
|
"class_name":"Rack::Session::Abstract::Persisted",
|
55
55
|
"instance_method":true,
|
56
56
|
"method_visibility": "private",
|
57
57
|
"method_name":"session_exists?",
|
58
|
-
"code": "https://github.com/rack/rack/blob/
|
58
|
+
"code": "https://github.com/rack/rack-session/blob/main/lib/rack/session/abstract/id.rb#L339"
|
59
59
|
}, {
|
60
60
|
"class_name":"ActionDispatch::FileHandler",
|
61
61
|
"instance_method":true,
|
62
62
|
"method_visibility": "public",
|
63
63
|
"method_name":"match?",
|
64
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/static.rb#L30"
|
64
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/static.rb#L30",
|
65
|
+
"note": "Removable once Rails 6.0 is no longer supported"
|
65
66
|
}, {
|
66
67
|
"class_name":"ActionDispatch::Http::MimeNegotiation",
|
67
68
|
"instance_method":true,
|
@@ -109,91 +110,203 @@
|
|
109
110
|
"instance_method":true,
|
110
111
|
"method_visibility": "public",
|
111
112
|
"method_name":"cookie_jar",
|
112
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L11"
|
113
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L11",
|
114
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
115
|
+
}, {
|
116
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
117
|
+
"instance_method":true,
|
118
|
+
"method_visibility": "public",
|
119
|
+
"method_name":"cookie_jar",
|
120
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L11"
|
113
121
|
}, {
|
114
122
|
"class_name":"ActionDispatch::Request",
|
115
123
|
"instance_method":true,
|
116
124
|
"method_visibility": "public",
|
117
125
|
"method_name":"have_cookie_jar?",
|
118
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L24"
|
126
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L24",
|
127
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
128
|
+
}, {
|
129
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
130
|
+
"instance_method":true,
|
131
|
+
"method_visibility": "public",
|
132
|
+
"method_name":"have_cookie_jar?",
|
133
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L24"
|
119
134
|
}, {
|
120
135
|
"class_name":"ActionDispatch::Request",
|
121
136
|
"instance_method":true,
|
122
137
|
"method_visibility": "public",
|
123
138
|
"method_name":"key_generator",
|
124
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L32"
|
139
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L32",
|
140
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
141
|
+
}, {
|
142
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
143
|
+
"instance_method":true,
|
144
|
+
"method_visibility": "public",
|
145
|
+
"method_name":"key_generator",
|
146
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L32"
|
125
147
|
}, {
|
126
148
|
"class_name":"ActionDispatch::Request",
|
127
149
|
"instance_method":true,
|
128
150
|
"method_visibility": "public",
|
129
151
|
"method_name":"signed_cookie_salt",
|
130
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L36"
|
152
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L36",
|
153
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
154
|
+
}, {
|
155
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
156
|
+
"instance_method":true,
|
157
|
+
"method_visibility": "public",
|
158
|
+
"method_name":"signed_cookie_salt",
|
159
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L36"
|
131
160
|
}, {
|
132
161
|
"class_name":"ActionDispatch::Request",
|
133
162
|
"instance_method":true,
|
134
163
|
"method_visibility": "public",
|
135
164
|
"method_name":"encrypted_cookie_salt",
|
136
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L40"
|
165
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L40",
|
166
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
167
|
+
}, {
|
168
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
169
|
+
"instance_method":true,
|
170
|
+
"method_visibility": "public",
|
171
|
+
"method_name":"encrypted_cookie_salt",
|
172
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L40"
|
137
173
|
}, {
|
138
174
|
"class_name":"ActionDispatch::Request",
|
139
175
|
"instance_method":true,
|
140
176
|
"method_visibility": "public",
|
141
177
|
"method_name":"encrypted_signed_cookie_salt",
|
142
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L44"
|
178
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L44",
|
179
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
180
|
+
}, {
|
181
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
182
|
+
"instance_method":true,
|
183
|
+
"method_visibility": "public",
|
184
|
+
"method_name":"encrypted_signed_cookie_salt",
|
185
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L44"
|
143
186
|
}, {
|
144
187
|
"class_name":"ActionDispatch::Request",
|
145
188
|
"instance_method":true,
|
146
189
|
"method_visibility": "public",
|
147
190
|
"method_name":"authenticated_encrypted_cookie_salt",
|
148
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L48"
|
191
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L48",
|
192
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
193
|
+
}, {
|
194
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
195
|
+
"instance_method":true,
|
196
|
+
"method_visibility": "public",
|
197
|
+
"method_name":"authenticated_encrypted_cookie_salt",
|
198
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L48"
|
149
199
|
}, {
|
150
200
|
"class_name":"ActionDispatch::Request",
|
151
201
|
"instance_method":true,
|
152
202
|
"method_visibility": "public",
|
153
203
|
"method_name":"use_authenticated_cookie_encryption",
|
154
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L52"
|
204
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L52",
|
205
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
206
|
+
}, {
|
207
|
+
"new": true,
|
208
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
209
|
+
"instance_method": true,
|
210
|
+
"method_visibility": "public",
|
211
|
+
"method_name": "use_authenticated_cookie_encryption",
|
212
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L52"
|
155
213
|
}, {
|
156
214
|
"class_name":"ActionDispatch::Request",
|
157
215
|
"instance_method":true,
|
158
216
|
"method_visibility": "public",
|
159
217
|
"method_name":"encrypted_cookie_cipher",
|
160
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L56"
|
218
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L56",
|
219
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
220
|
+
}, {
|
221
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
222
|
+
"instance_method":true,
|
223
|
+
"method_visibility": "public",
|
224
|
+
"method_name":"encrypted_cookie_cipher",
|
225
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L56"
|
161
226
|
}, {
|
162
227
|
"class_name":"ActionDispatch::Request",
|
163
228
|
"instance_method":true,
|
164
229
|
"method_visibility": "public",
|
165
230
|
"method_name":"signed_cookie_digest",
|
166
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L60"
|
231
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L60",
|
232
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
233
|
+
}, {
|
234
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
235
|
+
"instance_method":true,
|
236
|
+
"method_visibility": "public",
|
237
|
+
"method_name":"signed_cookie_digest",
|
238
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L60"
|
167
239
|
}, {
|
168
240
|
"class_name":"ActionDispatch::Request",
|
169
241
|
"instance_method":true,
|
170
242
|
"method_visibility": "public",
|
171
243
|
"method_name":"secret_key_base",
|
172
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L64"
|
244
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L64",
|
245
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
246
|
+
}, {
|
247
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
248
|
+
"instance_method":true,
|
249
|
+
"method_visibility": "public",
|
250
|
+
"method_name":"secret_key_base",
|
251
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L64"
|
173
252
|
}, {
|
174
253
|
"class_name":"ActionDispatch::Request",
|
175
254
|
"instance_method":true,
|
176
255
|
"method_visibility": "public",
|
177
256
|
"method_name":"cookies_serializer",
|
178
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L68"
|
257
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L68",
|
258
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
259
|
+
}, {
|
260
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
261
|
+
"instance_method":true,
|
262
|
+
"method_visibility": "public",
|
263
|
+
"method_name":"cookies_serializer",
|
264
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L68"
|
179
265
|
}, {
|
180
266
|
"class_name":"ActionDispatch::Request",
|
181
267
|
"instance_method":true,
|
182
268
|
"method_visibility": "public",
|
183
269
|
"method_name":"cookies_digest",
|
184
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L72"
|
270
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L72",
|
271
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
272
|
+
}, {
|
273
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
274
|
+
"instance_method":true,
|
275
|
+
"method_visibility": "public",
|
276
|
+
"method_name":"cookies_digest",
|
277
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L76"
|
278
|
+
}, {
|
279
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
280
|
+
"instance_method":true,
|
281
|
+
"method_visibility": "public",
|
282
|
+
"method_name":"cookies_same_site_protection",
|
283
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L72"
|
185
284
|
}, {
|
186
285
|
"class_name":"ActionDispatch::Request",
|
187
286
|
"instance_method":true,
|
188
287
|
"method_visibility": "public",
|
189
288
|
"method_name":"cookies_rotations",
|
190
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L76"
|
289
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L76",
|
290
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
291
|
+
}, {
|
292
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
293
|
+
"instance_method":true,
|
294
|
+
"method_visibility": "public",
|
295
|
+
"method_name":"cookies_rotations",
|
296
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L80"
|
191
297
|
}, {
|
192
298
|
"class_name":"ActionDispatch::Request",
|
193
299
|
"instance_method":true,
|
194
300
|
"method_visibility": "public",
|
195
301
|
"method_name":"use_cookies_with_metadata",
|
196
|
-
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L80"
|
302
|
+
"code": "https://github.com/rails/rails/blob/v6.0.3.4/actionpack/lib/action_dispatch/middleware/cookies.rb#L80",
|
303
|
+
"note": "Removable once Rails 6.1 is no longer supported"
|
304
|
+
}, {
|
305
|
+
"class_name":"ActionDispatch::RequestCookieMethods",
|
306
|
+
"instance_method":true,
|
307
|
+
"method_visibility": "public",
|
308
|
+
"method_name":"use_cookies_with_metadata",
|
309
|
+
"code": "https://github.com/rails/rails/blob/v7.0.3/actionpack/lib/action_dispatch/middleware/cookies.rb#L84"
|
197
310
|
}, {
|
198
311
|
"class_name":"ActionDispatch::Request::Session",
|
199
312
|
"instance_method":true,
|
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.5.
|
4
|
+
version: 6.5.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: 2022-
|
16
|
+
date: 2022-07-01 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|
@@ -1192,7 +1192,6 @@ files:
|
|
1192
1192
|
- lib/contrast/components/scope.rb
|
1193
1193
|
- lib/contrast/components/settings.rb
|
1194
1194
|
- lib/contrast/config.rb
|
1195
|
-
- lib/contrast/config/api_configuration.rb
|
1196
1195
|
- lib/contrast/config/api_proxy_configuration.rb
|
1197
1196
|
- lib/contrast/config/application_configuration.rb
|
1198
1197
|
- lib/contrast/config/assess_configuration.rb
|
@@ -1201,13 +1200,11 @@ files:
|
|
1201
1200
|
- lib/contrast/config/certification_configuration.rb
|
1202
1201
|
- lib/contrast/config/env_variables.rb
|
1203
1202
|
- lib/contrast/config/exception_configuration.rb
|
1204
|
-
- lib/contrast/config/protect_configuration.rb
|
1205
1203
|
- lib/contrast/config/protect_rule_configuration.rb
|
1206
1204
|
- lib/contrast/config/protect_rules_configuration.rb
|
1207
1205
|
- lib/contrast/config/request_audit_configuration.rb
|
1208
1206
|
- lib/contrast/config/root_configuration.rb
|
1209
1207
|
- lib/contrast/config/ruby_configuration.rb
|
1210
|
-
- lib/contrast/config/sampling_configuration.rb
|
1211
1208
|
- lib/contrast/config/server_configuration.rb
|
1212
1209
|
- lib/contrast/config/service_configuration.rb
|
1213
1210
|
- lib/contrast/configuration.rb
|
@@ -1,56 +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/config/api_proxy_configuration'
|
5
|
-
require 'contrast/config/certification_configuration'
|
6
|
-
require 'contrast/config/request_audit_configuration'
|
7
|
-
|
8
|
-
module Contrast
|
9
|
-
module Config
|
10
|
-
# Api keys configuration
|
11
|
-
class ApiConfiguration
|
12
|
-
include Contrast::Config::BaseConfiguration
|
13
|
-
|
14
|
-
# @return [String]
|
15
|
-
attr_accessor :api_key
|
16
|
-
# @return [String]
|
17
|
-
attr_accessor :user_name
|
18
|
-
# @return [String]
|
19
|
-
attr_accessor :service_key
|
20
|
-
attr_writer :url, :proxy, :request_audit, :certificate
|
21
|
-
|
22
|
-
DEFAULT_URL = 'https://app.contrastsecurity.com/Contrast'
|
23
|
-
|
24
|
-
def initialize hsh = {}
|
25
|
-
return unless hsh
|
26
|
-
|
27
|
-
@api_key = hsh[:api_key]
|
28
|
-
@url = hsh[:url]
|
29
|
-
@user_name = hsh[:user_name]
|
30
|
-
@service_key = hsh[:service_key]
|
31
|
-
@proxy = Contrast::Config::ApiProxyConfiguration.new(hsh[:proxy])
|
32
|
-
@request_audit = Contrast::Config::RequestAuditConfiguration.new(hsh[:request_audit])
|
33
|
-
@certificate = Contrast::Config::CertificationConfiguration.new(hsh[:certificate])
|
34
|
-
end
|
35
|
-
|
36
|
-
def url
|
37
|
-
@url.nil? ? DEFAULT_URL : @url
|
38
|
-
end
|
39
|
-
|
40
|
-
# @return [Contrast::Config::ApiProxyConfiguration]
|
41
|
-
def proxy
|
42
|
-
@proxy ||= Contrast::Config::ApiProxyConfiguration.new
|
43
|
-
end
|
44
|
-
|
45
|
-
# @return [Contrast::Config::RequestAuditConfiguration]
|
46
|
-
def request_audit
|
47
|
-
@request_audit ||= Contrast::Config::RequestAuditConfiguration.new
|
48
|
-
end
|
49
|
-
|
50
|
-
# @return [Contrast::Config::CertificationConfiguration]
|
51
|
-
def certificate
|
52
|
-
@certificate ||= Contrast::Config::CertificationConfiguration.new
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,33 +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 Config
|
6
|
-
# Common Configuration settings. Those in this section pertain to the protect functionality of the Agent.
|
7
|
-
class ProtectConfiguration
|
8
|
-
include Contrast::Config::BaseConfiguration
|
9
|
-
|
10
|
-
# @return [Boolean, nil]
|
11
|
-
attr_accessor :enable
|
12
|
-
attr_writer :exceptions, :rules
|
13
|
-
|
14
|
-
def initialize hsh = {}
|
15
|
-
return unless hsh
|
16
|
-
|
17
|
-
@exceptions = Contrast::Config::ExceptionConfiguration.new(hsh[:exceptions])
|
18
|
-
@rules = Contrast::Config::ProtectRulesConfiguration.new(hsh[:rules])
|
19
|
-
@enable = hsh[:enable]
|
20
|
-
end
|
21
|
-
|
22
|
-
# @return [Contrast::Config::ExceptionConfiguration]
|
23
|
-
def exceptions
|
24
|
-
@exceptions ||= Contrast::Config::ExceptionConfiguration.new
|
25
|
-
end
|
26
|
-
|
27
|
-
# @return [Contrast::Config::ProtectRulesConfiguration]
|
28
|
-
def rules
|
29
|
-
@rules ||= Contrast::Config::ProtectRulesConfiguration.new
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,35 +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 Config
|
6
|
-
# Common Configuration settings. Those in this section pertain to the sampling functionality of the Agent.
|
7
|
-
class SamplingConfiguration
|
8
|
-
include Contrast::Config::BaseConfiguration
|
9
|
-
|
10
|
-
# @return [Integer, nil]
|
11
|
-
attr_reader :baseline
|
12
|
-
# @return [Integer, nil]
|
13
|
-
attr_reader :request_frequency
|
14
|
-
# @return [Integer, nil]
|
15
|
-
attr_reader :response_frequency
|
16
|
-
# @return [Integer, nil]
|
17
|
-
attr_reader :window_ms
|
18
|
-
|
19
|
-
def initialize hsh = {}
|
20
|
-
return unless hsh
|
21
|
-
|
22
|
-
@enable = hsh[:enable]
|
23
|
-
@baseline = hsh[:baseline]
|
24
|
-
@request_frequency = hsh[:request_frequency]
|
25
|
-
@response_frequency = hsh[:response_frequency]
|
26
|
-
@window_ms = hsh[:window_ms]
|
27
|
-
end
|
28
|
-
|
29
|
-
# @return [Boolean, false]
|
30
|
-
def enable
|
31
|
-
!!@enable
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|