Bug 2608 - HABEAS_SWE fails with out of order headers
Summary: HABEAS_SWE fails with out of order headers
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 2.60
Hardware: All All
: P5 normal
Target Milestone: 2.62
Assignee: Daniel Quinlan
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-18 19:27 UTC by Dan Kohn
Modified: 2004-01-08 06:56 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status
patch against EvalTests.pm patch None Malte S. Stretz [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Kohn 2003-10-18 19:27:26 UTC
Habeas has gotten multiple reports of people's individual Habeas warranted 
mail not getting recognized by SpamAssassin because the headers are out of 
order.  Specifically, I believe the default Apple Mail configuration tends to 
produce headers in a random order.  Of course, RFC 2822 does not mandate that 
headers stay in order, although we would certainly prefer for them to.

Please add a line before the if statement that sorts the headers (from 
EvalTests.pm below):

  $self->{habeas_swe} = 0;

  my $all = $self->get('ALL');
  if ($all =~ /\n(X-Habeas-SWE-1:.{0,512}X-Habeas-SWE-9:[^\n]{0,64}\n)/si) {
    my $text = $1;
    $text =~ tr/A-Z/a-z/;
    $text =~ tr/ / /s;
    $text =~ s/\/?>/\/>/;
    if (sha1($text) eq "42ab3d716380503f66c4d44017c7f37b04458a9a") {
      $self->{habeas_swe} = 1;
    }
  }
  return $self->{habeas_swe};
}

Habeas directions for embedding the headers in the Apple Mail application are 
at <http://www.habeas.com/configurationPages/macmail-out.htm>.  We don't 
understand why it puts them out of order.

For your testing, here is one set of headers from a support ticket filed with 
us:

X-Habeas-SWE-6: email in exchange for a license for this Habeas
X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
X-Habeas-SWE-4: Copyright 2002 Habeas (tm)
X-Habeas-SWE-3: like Habeas SWE (tm)
X-Habeas-SWE-2: brightly anticipated
X-Habeas-SWE-1: winter into spring
X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant

Daniel, thanks in advance for your help on this.
Comment 1 Malte S. Stretz 2003-10-19 14:55:17 UTC
Created attachment 1502 [details]
patch against EvalTests.pm

This is probably the cleanes sultion: Pull one header after another and let our
routines handle any magic possibly introduced by some mailer. The checksum is
different because the header names themselves aren't taken into account. This
logic is also a bit more tolernat against whitespaces, I assume the order of
line breaks isn't important in the copyrighted haiku?
Comment 2 Daniel Quinlan 2003-10-19 17:43:20 UTC
looking into this
Comment 3 Theo Van Dinter 2003-12-26 23:10:04 UTC
any update on this?  seems like something we should fix for 2.62 if we can.
Comment 4 Malte S. Stretz 2003-12-31 04:32:11 UTC
Dan told me in PM that the line breaks really aren't relevant, so I'd go and 
commit my patch if it is +1'd. 
Comment 5 Theo Van Dinter 2003-12-31 09:12:16 UTC
+1
Comment 6 Justin Mason 2004-01-07 16:48:22 UTC
+1
Comment 7 Theo Van Dinter 2004-01-08 15:56:49 UTC
ok, committed to head and 2.62