From a3bdd6f47b5a0f7474d2b2da69eb4ccff995122c Mon Sep 17 00:00:00 2001 From: Sai Kumar Kotagiri Date: Fri, 12 Apr 2024 13:10:47 -0400 Subject: [PATCH] adds ssn to the sensitive parameters list (#3733) adds ssn to the sensitive parameters list so the value will be replaced with [FILTERED] in the logs --- .../initializers/filter_parameter_logging.rb | 7 ++++-- .../insured/individual_curam_document.feature | 1 + .../insured/consumer_roles_controller_spec.rb | 25 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 2587a0d8d6f..090a31048f0 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,7 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password, :question_answer, :password_confirmation, :new_password] +# Configure Rails to filter out sensitive parameters from the logs. +# The parameters :password, :question_answer, :password_confirmation, :new_password, and :ssn will be replaced with [FILTERED] in the logs. +Rails.application.config.filter_parameters += [:password, :question_answer, :password_confirmation, :new_password, :ssn] diff --git a/features/insured/individual_curam_document.feature b/features/insured/individual_curam_document.feature index 596f500c348..58f471c7ca1 100644 --- a/features/insured/individual_curam_document.feature +++ b/features/insured/individual_curam_document.feature @@ -42,6 +42,7 @@ Feature: Customers go to Curam to view notices and verifications Then there will be text to the left of the MEDICAID & TAX CREDITS button Then Hbx Admin logs out + @flaky Scenario: Broker can see the Navigation Button Given an individual market broker exists And a consumer role family exists with broker diff --git a/spec/controllers/insured/consumer_roles_controller_spec.rb b/spec/controllers/insured/consumer_roles_controller_spec.rb index ace82224fa8..4492b8bd414 100644 --- a/spec/controllers/insured/consumer_roles_controller_spec.rb +++ b/spec/controllers/insured/consumer_roles_controller_spec.rb @@ -105,6 +105,31 @@ allow(mock_resident_candidate).to receive(:valid?).and_return(false) end + context 'sensitive params are filtered in logs' do + let(:validation_result) { true } + let(:found_person) { [] } + + let(:person_parameters) do + { + 'dob' => '1990-01-01', + 'first_name' => 'dummy', + 'gender' => 'male', + 'last_name' => 'testing', + 'middle_name' => 'enroll', + 'name_sfx' => '', + 'ssn' => '111111111' + } + end + + let(:filtered_person_parameters) { person_parameters.merge('ssn' => '[FILTERED]') } + + it 'confirms the ssn param is filtered' do + post :match, params: { person: person_parameters } + expect(response).to have_http_status(:success) + expect(File.read('log/test.log')).to include(filtered_person_parameters.to_s) + end + end + context "given invalid parameters", dbclean: :after_each do let(:validation_result) { false } let(:found_person) { [] }