From 754f9828befff808a86f942f02e703daff30de41 Mon Sep 17 00:00:00 2001 From: Alice Fisher Date: Mon, 22 Jun 2026 22:03:20 +0000 Subject: [PATCH 1/3] disable street address filtering in find_share_failure --- lib/cdo/share_filtering.rb | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/cdo/share_filtering.rb b/lib/cdo/share_filtering.rb index 31445aa2ec3d4..65d1e1da16b54 100644 --- a/lib/cdo/share_filtering.rb +++ b/lib/cdo/share_filtering.rb @@ -63,20 +63,22 @@ def self.find_share_failure(program, locale, project_type, exceptions: false) failure = find_email_or_phone_failure(program_text, exceptions: exceptions) return failure if failure + # Temporarily disable address filtering to prevent false positives. + # TODO: re-enable this when we improve the user experience of the address filter. # Address: check each text block independently to prevent cross-block bleeding. - candidate = nil - texts.each do |text| - candidate = Geocoder.extract_address_candidate(text) - break if candidate - end - if candidate - address = Geocoder.find_potential_street_address(candidate) - if address - failure = ShareFailure.new(FailureType::ADDRESS, address) - raise PIIFilterException.new("Address PII Filter Violation", failure) if exceptions - return failure - end - end + # candidate = nil + # texts.each do |text| + # candidate = Geocoder.extract_address_candidate(text) + # break if candidate + # end + # if candidate + # address = Geocoder.find_potential_street_address(candidate) + # if address + # failure = ShareFailure.new(FailureType::ADDRESS, address) + # raise PIIFilterException.new("Address PII Filter Violation", failure) if exceptions + # return failure + # end + # end find_profanity_failure(program_text, locale, {}, exceptions: exceptions) end From 0f2e3da5ceba1a36ef23daa01e4ee255695b1f68 Mon Sep 17 00:00:00 2001 From: Alice Fisher Date: Mon, 22 Jun 2026 22:08:07 +0000 Subject: [PATCH 2/3] update tests --- .../controllers/activities_controller_test.rb | 24 ------------------- lib/test/cdo/test_share_filtering.rb | 21 +++------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/dashboard/test/controllers/activities_controller_test.rb b/dashboard/test/controllers/activities_controller_test.rb index eec8d5283732b..98f519cabc09d 100644 --- a/dashboard/test/controllers/activities_controller_test.rb +++ b/dashboard/test/controllers/activities_controller_test.rb @@ -835,30 +835,6 @@ def build_try_again_response(options = {}) assert_equal_expected_keys expected_response, JSON.parse(@response.body) end - test 'sharing program with street address returns error' do - Geocoder.stubs(:find_potential_street_address).returns('1600 Pennsylvania Ave NW Washington DC') - - assert_does_not_create(LevelSource) do - post :milestone, - params: @milestone_params.merge( - script_level_id: @playlab_script_level.id, - course_id: @playlab_script.original_unit_group_id, - program: studio_program_with_text('1600 Pennsylvania Ave NW Washington DC') - ) - end - assert_response :success - - expected_response = { - 'level_source' => nil, - 'share_failure' => { - 'message' => "It looks like there is an address in it. Try changing the text.", - 'contents' => '1600 Pennsylvania Ave NW Washington DC', - 'type' => 'address' - } - } - assert_equal_expected_keys expected_response, JSON.parse(@response.body) - end - test 'sharing when gatekeeper has disabled sharing does not work' do Gatekeeper.set('shareEnabled', where: {script_name: @playlab_script.name}, value: false) diff --git a/lib/test/cdo/test_share_filtering.rb b/lib/test/cdo/test_share_filtering.rb index 02d7fce41636f..6d934d2d46daf 100644 --- a/lib/test/cdo/test_share_filtering.rb +++ b/lib/test/cdo/test_share_filtering.rb @@ -103,7 +103,7 @@ def test_extract_address_candidate assert_equal Geocoder::MAX_ADDRESS_WORDS, candidate.split.length end - def test_find_share_failure_with_street_address + def test_find_share_failure_temporarily_ignores_street_address Geocoder. stubs(:find_potential_street_address). returns('1600 Pennsylvania Ave NW, Washington, DC 20500') @@ -112,23 +112,8 @@ def test_find_share_failure_with_street_address 'My Street Address', '1600 Pennsylvania Ave NW, Washington, DC 20500' ) - assert_equal( - ShareFailure.new( - ShareFiltering::FailureType::ADDRESS, - '1600 Pennsylvania Ave NW, Washington, DC 20500' - ), - ShareFiltering.find_share_failure(program, 'en', 'playlab') - ) - - assert_equal( - ShareFailure.new( - ShareFiltering::FailureType::ADDRESS, - '1600 Pennsylvania Ave NW, Washington, DC 20500' - ), - assert_raises(PIIFilterException) do - ShareFiltering.find_share_failure(program, 'en', 'playlab', exceptions: true) - end.share_failure - ) + assert_nil ShareFiltering.find_share_failure(program, 'en', 'playlab') + assert_nil ShareFiltering.find_share_failure(program, 'en', 'playlab', exceptions: true) end def test_find_share_failure_with_phone_number From a6e65ac64f111e26e357cd9fad4487053daf0235 Mon Sep 17 00:00:00 2001 From: Alice Fisher Date: Mon, 22 Jun 2026 22:13:48 +0000 Subject: [PATCH 3/3] remove commented code --- lib/cdo/share_filtering.rb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib/cdo/share_filtering.rb b/lib/cdo/share_filtering.rb index 65d1e1da16b54..8ef1dc7e2ffa2 100644 --- a/lib/cdo/share_filtering.rb +++ b/lib/cdo/share_filtering.rb @@ -65,21 +65,6 @@ def self.find_share_failure(program, locale, project_type, exceptions: false) # Temporarily disable address filtering to prevent false positives. # TODO: re-enable this when we improve the user experience of the address filter. - # Address: check each text block independently to prevent cross-block bleeding. - # candidate = nil - # texts.each do |text| - # candidate = Geocoder.extract_address_candidate(text) - # break if candidate - # end - # if candidate - # address = Geocoder.find_potential_street_address(candidate) - # if address - # failure = ShareFailure.new(FailureType::ADDRESS, address) - # raise PIIFilterException.new("Address PII Filter Violation", failure) if exceptions - # return failure - # end - # end - find_profanity_failure(program_text, locale, {}, exceptions: exceptions) end