lib/contrast/components/settings.rb in contrast-agent-6.11.0 vs lib/contrast/components/settings.rb in contrast-agent-6.12.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
+# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true
require 'contrast/agent/excluder'
require 'contrast/agent/reporting/settings/sensitive_data_masking'
require 'contrast/components/config'
@@ -83,14 +83,10 @@
def initialize
reset_state
end
- def code_exclusions
- excluder&.exclusions&.select(&:code?)
- end
-
# @param features_response [Contrast::Agent::Reporting::Response]
def update_from_server_features features_response # rubocop:disable Metrics/AbcSize
return unless (server_features = features_response&.server_features)
log_file = server_features.log_file
@@ -114,11 +110,11 @@
update_assess_server_features(server_features.assess)
@last_server_update_ms = Contrast::Utils::Timer.now_ms
# update via response header. We receive header from TS with last update info, setting the
# next request's header with the same time will save needless update of settings if there
# are no new server features updates after the said time.
- @server_settings_last_httpdate = header_last_update
+ @server_settings_last_httpdate = header_server_last_update
rescue StandardError => e
logger.warn('The following error occurred from server update: ', e: e)
end
# Update AgentLib log level
@@ -166,11 +162,11 @@
update_sensitive_data_policy(app_settings.sensitive_data_masking)
@assess_state.disabled_assess_rules = app_settings.assess.disabled_rules
new_session_id = app_settings.assess.session_id
@assess_state.session_id = new_session_id if new_session_id && !new_session_id.blank?
@last_app_update_ms = Contrast::Utils::Timer.now_ms
- @app_settings_last_httpdate = header_last_update
+ @app_settings_last_httpdate = header_application_last_update
end
# Wipe state to zero.
def reset_state
@protect_state = PROTECT_STATE_BASE.dup
@@ -221,13 +217,10 @@
matchers << Contrast::Agent::ExclusionMatcher.new(exclusion)
end
exclusions.input_exclusions.each do |exclusion|
matchers << Contrast::Agent::ExclusionMatcher.new(exclusion)
end
- exclusions.code_exclusions.each do |exclusion|
- matchers << Contrast::Agent::ExclusionMatcher.new(exclusion)
- end
@excluder = Contrast::Agent::Excluder.new(matchers)
end
# Update the sensitive data masking policy from settings,
# received from TS. In case the settings are empty,
@@ -258,15 +251,23 @@
return true if settings.nil? || settings.empty?
false
end
- # update via response header.
+ # update server last updated via response header.
# Used to build the next request header.
#
# @return [String]
- def header_last_update
+ def header_server_last_update
Contrast::Agent.reporter.client.response_handler.last_server_modified
+ end
+
+ # update application last updated via response header.
+ # Used to build the next request header.
+ #
+ # @return [String]
+ def header_application_last_update
+ Contrast::Agent.reporter.client.response_handler.last_application_modified
end
# Update the stored config values to ensure that we know about the correct values,
# and that the sources are correct for entries updated from the UI.
#