Ticket #76 (closed defect: fixed)

Opened 4 years ago

Last modified 7 months ago

Add "exact match" option to Magnets

Reported by: amatubu Assigned to: amatubu
Priority: normal Milestone: 1.1.2
Component: unknown Version: 1.0.1
Severity: normal Keywords:
Cc:

Description

(This feature request is transferred from SF.net: http://sourceforge.net/tracker/index.php?func=detail&aid=1526015&group_id=63137&atid=502959)

I think magnets for whole e-mail address should match the exact same address only. For example, a magnet for 'test@example.com' should match exact 'test@example.com' but it should not match 'nottest@example.com'.

And, the domain magnet is not working as expect. For example, a magnet for 'example.com' matches 'badexample.com' and 'example.com.jp'. This is a bug. The magnet for 'example.com' should match 'test@example.com' or 'test@sub.example.com' only.

--- Original message ---

I've recently discovered that spammers are getting around my magnets by making their "from" email address the same as some of my user accounts, but adding a few characters in front. Since I magnet some of my key user accounts (ie janedoe@mysite.com), and spammers regularly try to use the names on your site (harvested long ago, when we still displayed email addresses on the site), I've now found them sending mail "from" things like yyzjanedoe@mysite.com. This causes the magnet to still match, and forward through spam.

Perhaps there is a way to make a magnet match exactly, but I haven't been able to locate it in the documentation.

I'd like to see an "exact match" option on magnets so that spammers can't work around them in the above- mentioned way.

-Natalie

Change History

07/22/08 16:05:49 changed by amatubu

  • owner set to amatubu.

09/09/10 07:17:59 changed by PApopfile

In the file bayes.pm, there is a subroutine "sub magnet_match_helper".

It includes the code that determines whether a magnet gets used and sets a flag, as well as setting the id of the magnet that matched.

It currently reads, in part, as follows:

foreach my $m (@magnets) {

my ( $magnet, $id ) = @{$m}; $magnet = lc($magnet);

for my $i (0..(length($match)-length($magnet))) {

if ( substr( $match, $i, length($magnet)) eq $magnet ) {

$self->{magnet_used} = 1; $self->{magnet_detail} = $id;

return 1;

}

}

}

Perhaps you can allow for magnets that begin with the '=' character to require an exact match between $match and $magnet (less the '=' character, of course). I believe this can be done by replacing the above "for" loop with this:

if ( substr( $magnet, 0, 1) eq '=') {

if ( $match eq substr( $magnet, 1, length($magnet)-1) ) {

$self->{magnet_used} = 1; $self->{magnet_detail} = $id;

return 1;

}

else for my $i (0..(length($match)-length($magnet))) {

if ( substr( $match, $i, length($magnet)) eq $magnet ) {

$self->{magnet_used} = 1; $self->{magnet_detail} = $id;

return 1;

}

}

}

Don't trust my PERL or my typing. I also don't know what assumptions are made elsewhere that $magnet would not start with '='.

09/09/10 18:58:55 changed by amatubu

  • status changed from new to closed.
  • resolution set to fixed.

Fixed. [3666]

Naoki

09/09/10 19:03:32 changed by amatubu

  • milestone set to 1.1.2.

07/10/11 14:33:39 changed by amatubu

This new feature will be included in POPFile v1.1.2.

The release candidate 2 of v1.1.2 is now available for testing:

http://getpopfile.org/discussion/3/369

Naoki