Bug 5372 - Untrustworthy Received headers cannot match start-of-line anchor
Summary: Untrustworthy Received headers cannot match start-of-line anchor
Status: RESOLVED INVALID
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Rules (show other bugs)
Version: 3.1.0
Hardware: Other other
: P5 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-08 11:23 UTC by Bill Cole
Modified: 2007-03-09 04:14 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Cole 2007-03-08 11:23:35 UTC
Rules matching Received headers other than the first one which are not readily
parseable or maybe not worth parsing (i.e. untrustworthy) never match a pattern
starting with '^'

For example, this header from actual spam:

Received: by smtp.sisencenenged.com id htv5q204a2gi; Thu, 8 Mar 2007 00:38:45
-0800 (envelope-from <wegotthetab@muspclogeda.com>)

Will not match this test rule:

header TEST_RCVD_FORMAT1 Received =~ /^by smtp/

but will match:

header TEST_RCVD_FORMAT1 Received =~ /by smtp/

If I strip out the valid Received headers from the message so that the given one
is the only Received heaer, the anchored pattern matches.
Comment 1 Nick Leverton 2007-03-09 03:46:31 UTC
You need to tell Perl it's a multi-line field with the m modifier:

header TEST_RCVD_FORMAT1 Received =~ /^by smtp/m

Tested and works here.
Comment 2 Justin Mason 2007-03-09 04:14:22 UTC
thanks Nick.