user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [RFC] mda: use PublicInbox::Address to extract emails
@ 2020-06-19 17:18 Eric Wong
  2020-07-07  7:15 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2020-06-19 17:18 UTC (permalink / raw)
  To: meta

I'm not sure why this wasn't done in Jun/July 2016 when I was
working on PublicInbox::Address to replace the DoS-vulnerable
Email::Address.

Nowadays, PublicInbox::Address allows using Email::Address::XS
which should be fast and robust.
---
 lib/PublicInbox/MDA.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/MDA.pm b/lib/PublicInbox/MDA.pm
index 57b436b9..fa4a2ad8 100644
--- a/lib/PublicInbox/MDA.pm
+++ b/lib/PublicInbox/MDA.pm
@@ -6,6 +6,7 @@ package PublicInbox::MDA;
 use strict;
 use warnings;
 use PublicInbox::MsgTime;
+use PublicInbox::Address;
 use constant MAX_SIZE => 1024 * 500; # same as spamc default, should be tunable
 use constant MAX_MID_SIZE => 244; # max term size - 1 in Xapian
 
@@ -62,7 +63,7 @@ sub alias_specified {
 	} @address;
 
 	foreach my $line ($simple->header('Cc'), $simple->header('To')) {
-		my @addrs = ($line =~ /([^,<\s]+\@[^,>\s]+)/g);
+		my @addrs = PublicInbox::Address::emails($line);
 		foreach my $addr (@addrs) {
 			if ($ok{lc(__drop_plus($addr))}) {
 				return 1;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC] mda: use PublicInbox::Address to extract emails
  2020-06-19 17:18 [RFC] mda: use PublicInbox::Address to extract emails Eric Wong
@ 2020-07-07  7:15 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2020-07-07  7:15 UTC (permalink / raw)
  To: meta

Eric Wong <e@yhbt.net> wrote:
> I'm not sure why this wasn't done in Jun/July 2016 when I was
> working on PublicInbox::Address to replace the DoS-vulnerable
> Email::Address.

*shrug* probably just a brain fart back in the day.

> Nowadays, PublicInbox::Address allows using Email::Address::XS
> which should be fast and robust.

Been kinda wondering if Perl 5.10 RE grammars can get the job
done w/o involving XS or having DoS vulnerabilities of non-XS
Email::Address...

Anyways, pushed as commit c0f3095c2f0fdf3409a2d7bc629230cd83a06f9f

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-07  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 17:18 [RFC] mda: use PublicInbox::Address to extract emails Eric Wong
2020-07-07  7:15 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).