Skip to content

Commit

Permalink
SECURITY: Sanitize email id for use as mutex key
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq committed Jul 24, 2019
1 parent c4ff66e commit e9c0fb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/email/receiver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def initialize(mail_string, opts = {})

def process!
return if is_blacklisted?
DistributedMutex.synchronize(@message_id) do
id_hash = Digest::SHA1.hexdigest(@message_id)
DistributedMutex.synchronize("process_email_#{id_hash}") do
begin
return if IncomingEmail.exists?(message_id: @message_id)
ensure_valid_address_lists
Expand Down

0 comments on commit e9c0fb0

Please sign in to comment.