Skip to content

Commit 78939db

Browse files
committed
Remove alias parts from additional yahoo domains
1 parent 7497bda commit 78939db

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* Fastmail alias subdomain email addresses are now normalized when
1111
`hash_address` is used. For example, `[email protected]` will
1212
13+
* Additional `yahoo.com` email addresses now have aliases removed from
14+
their local part when `hash_address` is used. For example,
15+
`[email protected]` will become `[email protected]` for additional
16+
`yahoo.com` domains.
1317

1418
## v2.4.0 (2024-01-12)
1519

lib/minfraud/components/email.rb

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def clean_email_address(address)
9090

9191
domain = clean_domain(domain)
9292

93-
if domain == 'yahoo.com'
93+
if YAHOO_DOMAINS.key?(domain)
9494
local_part.sub!(/\A([^-]+)-.*\z/, '\1')
9595
else
9696
local_part.sub!(/\A([^+]+)\+.*\z/, '\1')
@@ -261,6 +261,63 @@ def clean_email_address(address)
261261
}.freeze
262262
private_constant :FASTMAIL_DOMAINS
263263

264+
YAHOO_DOMAINS = {
265+
'y7mail.com' => true,
266+
'yahoo.at' => true,
267+
'yahoo.be' => true,
268+
'yahoo.bg' => true,
269+
'yahoo.ca' => true,
270+
'yahoo.cl' => true,
271+
'yahoo.co.id' => true,
272+
'yahoo.co.il' => true,
273+
'yahoo.co.in' => true,
274+
'yahoo.co.kr' => true,
275+
'yahoo.co.nz' => true,
276+
'yahoo.co.th' => true,
277+
'yahoo.co.uk' => true,
278+
'yahoo.co.za' => true,
279+
'yahoo.com' => true,
280+
'yahoo.com.ar' => true,
281+
'yahoo.com.au' => true,
282+
'yahoo.com.br' => true,
283+
'yahoo.com.co' => true,
284+
'yahoo.com.hk' => true,
285+
'yahoo.com.hr' => true,
286+
'yahoo.com.mx' => true,
287+
'yahoo.com.my' => true,
288+
'yahoo.com.pe' => true,
289+
'yahoo.com.ph' => true,
290+
'yahoo.com.sg' => true,
291+
'yahoo.com.tr' => true,
292+
'yahoo.com.tw' => true,
293+
'yahoo.com.ua' => true,
294+
'yahoo.com.ve' => true,
295+
'yahoo.com.vn' => true,
296+
'yahoo.cz' => true,
297+
'yahoo.de' => true,
298+
'yahoo.dk' => true,
299+
'yahoo.ee' => true,
300+
'yahoo.es' => true,
301+
'yahoo.fi' => true,
302+
'yahoo.fr' => true,
303+
'yahoo.gr' => true,
304+
'yahoo.hu' => true,
305+
'yahoo.ie' => true,
306+
'yahoo.in' => true,
307+
'yahoo.it' => true,
308+
'yahoo.lt' => true,
309+
'yahoo.lv' => true,
310+
'yahoo.nl' => true,
311+
'yahoo.no' => true,
312+
'yahoo.pl' => true,
313+
'yahoo.pt' => true,
314+
'yahoo.ro' => true,
315+
'yahoo.se' => true,
316+
'yahoo.sk' => true,
317+
'ymail.com' => true,
318+
}.freeze
319+
private_constant :YAHOO_DOMAINS
320+
264321
def clean_domain(domain)
265322
domain = domain.strip
266323

spec/components/email_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
{ input: '[email protected]', output: '[email protected]' },
7575
{ input: '[email protected]', output: '[email protected]' },
7676
{ input: '[email protected]', output: '[email protected]' },
77+
{ input: '[email protected]', output: '[email protected]' },
7778
]
7879

7980
tests.each do |i|

0 commit comments

Comments
 (0)