Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions app/controllers/concerns/idv/threat_metrix_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ def override_csp_for_threat_metrix
def override_csp_for_threat_metrix_no_fsm
return unless FeatureManagement.proofing_device_profiling_collecting_enabled?

##
# In order to test the behavior without the CSP changes, we do not perform the CSP override
# if the user's email is on a list of CSP disabled emails.
#
current_user.email_addresses.each do |email_address|
no_csp_email = IdentityConfig.store.idv_tmx_test_csp_disabled_emails.include?(
email_address.email,
)
return nil if no_csp_email
end

threat_metrix_csp_overrides
end

Expand Down
19 changes: 0 additions & 19 deletions app/controllers/idv/ssn_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class SsnController < ApplicationController
before_action :confirm_repeat_ssn, only: :show
before_action :override_csp_for_threat_metrix_no_fsm

helper_method :should_render_threatmetrix_js?

attr_accessor :error_message

def show
Expand Down Expand Up @@ -49,23 +47,6 @@ def update
end
end

##
# In order to test the behavior without the threatmetrix JS, we do not load the threatmetrix
# JS if the user's email is on a list of JS disabled emails.
#
def should_render_threatmetrix_js?
return false unless FeatureManagement.proofing_device_profiling_collecting_enabled?

current_user.email_addresses.each do |email_address|
no_csp_email = IdentityConfig.store.idv_tmx_test_js_disabled_emails.include?(
email_address.email,
)
return false if no_csp_email
end

true
end

private

def confirm_repeat_ssn
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/ssn/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ locals:
<% end %>
</p>

<% if should_render_threatmetrix_js? %>
<% if FeatureManagement.proofing_device_profiling_collecting_enabled? %>
<% if threatmetrix_session_id.present? %>
<% threatmetrix_javascript_urls.each do |threatmetrix_javascript_url| %>
<%= javascript_include_tag threatmetrix_javascript_url, nonce: true %>
Expand Down
2 changes: 0 additions & 2 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ idv_acuant_sdk_upgrade_a_b_testing_percent: 50
idv_getting_started_a_b_testing: '{"welcome_default":100, "welcome_new":0, "getting_started":0}'
idv_send_link_attempt_window_in_minutes: 10
idv_send_link_max_attempts: 5
idv_tmx_test_csp_disabled_emails: '[]'
idv_tmx_test_js_disabled_emails: '[]'
idv_sp_required: false
in_person_capture_secondary_id_enabled: false
in_person_public_address_search_enabled: false
Expand Down
2 changes: 0 additions & 2 deletions lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ def self.build_store(config_map)
config.add(:idv_send_link_attempt_window_in_minutes, type: :integer)
config.add(:idv_send_link_max_attempts, type: :integer)
config.add(:idv_sp_required, type: :boolean)
config.add(:idv_tmx_test_csp_disabled_emails, type: :json)
config.add(:idv_tmx_test_js_disabled_emails, type: :json)
config.add(:in_person_capture_secondary_id_enabled, type: :boolean)
config.add(:in_person_completion_survey_url, type: :string)
config.add(:in_person_doc_auth_button_enabled, type: :boolean)
Expand Down
48 changes: 0 additions & 48 deletions spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,6 @@
expect(csp.directives['img-src']).to include('*.online-metrix.net')
end
end

it 'does not override the Content Security for CSP disabled test users' do
allow(IdentityConfig.store).to receive(:proofing_device_profiling).
and_return(:enabled)
allow(IdentityConfig.store).to receive(:idv_tmx_test_csp_disabled_emails).
and_return([user.email_addresses.first.email])

get :show

csp = response.request.content_security_policy

aggregate_failures do
expect(csp.directives['script-src']).to_not include('h.online-metrix.net')

expect(csp.directives['style-src']).to_not include("'unsafe-inline'")

expect(csp.directives['child-src']).to_not include('h.online-metrix.net')

expect(csp.directives['connect-src']).to_not include('h.online-metrix.net')

expect(csp.directives['img-src']).to_not include('*.online-metrix.net')
end
end
end

describe '#update' do
Expand Down Expand Up @@ -286,29 +263,4 @@
end
end
end

describe '#should_render_threatmetrix_js?' do
it 'returns true if the JS should be disabled for the user' do
allow(IdentityConfig.store).to receive(:proofing_device_profiling).
and_return(:enabled)
allow(IdentityConfig.store).to receive(:idv_tmx_test_js_disabled_emails).
and_return([user.email_addresses.first.email])

expect(controller.should_render_threatmetrix_js?).to eq(false)
end

it 'returns true if the JS should not be disabled for the user' do
allow(IdentityConfig.store).to receive(:proofing_device_profiling).
and_return(:enabled)

expect(controller.should_render_threatmetrix_js?).to eq(true)
end

it 'returns false if TMx profiling is disabled' do
allow(IdentityConfig.store).to receive(:proofing_device_profiling).
and_return(:disabled)

expect(controller.should_render_threatmetrix_js?).to eq(false)
end
end
end