Skip to content

Commit 7516541

Browse files
committed
Disallow the empty uuid
1 parent 9231a16 commit 7516541

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/minfraud/components/report/transaction.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,17 @@ def validate
9595
validate_uuid('minfraud_id', @minfraud_id)
9696

9797
if ip_address.nil? &&
98-
minfraud_id.nil? &&
98+
(minfraud_id.nil? || is_empty_uuid(minfraud_id)) &&
9999
(maxmind_id.nil? || maxmind_id.empty?) &&
100100
(transaction_id.nil? || transaction_id.empty?)
101101
raise ArgumentError, 'At least one of the following is required: ip_address, minfraud_id, maxmind_id, transaction_id.'
102102
end
103103
end
104+
105+
def is_empty_uuid(value)
106+
stripped_value = value.to_s.gsub('-', '')
107+
return stripped_value == '0' * 32
108+
end
104109
end
105110
end
106111
end

0 commit comments

Comments
 (0)