user/dev discussion of public-inbox itself
 help / color / mirror / 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	[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

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ http://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git