Skip to content

Commit 09ba465

Browse files
flavorjonesclaude
andcommitted
Only send notification emails to verified users
Adds verified? check to bundling_emails? to prevent notification emails from being sent to users who have never authenticated. This closes the spam vector where bad actors could create users for known email addresses and trigger unwanted notifications by mentioning them. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e997078 commit 09ba465

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/models/user/settings.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def bundle_aggregation_period
2121
end
2222

2323
def bundling_emails?
24-
!bundle_email_never? && !user.system? && user.active?
24+
!bundle_email_never? && !user.system? && user.active? && user.verified?
2525
end
2626

2727
def timezone

test/models/user/settings_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,9 @@ class User::SettingsTest < ActiveSupport::TestCase
4949

5050
@user.update!(role: :member, active: false)
5151
assert_not @user.settings.bundling_emails?, "Inactive users should not receive bundled emails"
52+
53+
@user.update!(active: true)
54+
@user.update_column(:verified_at, nil)
55+
assert_not @user.settings.bundling_emails?, "Unverified users should not receive bundled emails"
5256
end
5357
end

0 commit comments

Comments
 (0)