Bug 478 - TO: header modification
Summary: TO: header modification
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Rules (show other bugs)
Version: 2.30
Hardware: All All
: P2 trivial
Target Milestone: 3.0.0
Assignee: Duncan Findlay
URL:
Whiteboard:
Keywords:
Depends on: 317
Blocks:
  Show dependency tree
 
Reported: 2002-06-19 22:18 UTC by Jeffrey Culverhouse
Modified: 2003-12-30 08:31 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status
Patch against the libs to replace the 'rewrite_subject' opject with a more general 'tag_header' patch None Malte S. Stretz [HasCLA]
Revised patch; successor of patch 204 patch None Malte S. Stretz [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Culverhouse 2002-06-19 22:18:11 UTC
Don't worry, no new headers... but...

Changing the Subject line can be bad when (on the very rare message) SA gets a 
false positive... if the user hits REPLY, they have to clean up the subject 
line, or pass along the new subject line back to the sender.

I think the least obtrusive place to mark a header that the cripple-ware MS 
Outlook Express could even filter on would be to TO header.  There could be a 
config variable of what to mark, and that could be appended to the end with () 
around it, making it a legal and ignored address comment.

Something like:

rewrite_to    1
to_tag        **SPAM**

and if a message is spam, the header would change from:

To: <baduser@spamsucks.com>
 into
To: <baduser@spamsucks.com> (**SPAM**)


This mark would not carry over in a REPLY, but could still be found during OE 
so-called filtering...

I know, trival and if I find time, perhaps I will *attempt* a patch and send 
it in, we'll see who gets to it first ;)


Thanks for an awesome product!
Comment 1 Malte S. Stretz 2002-06-23 12:21:48 UTC
I really like that I idea , so here's a patch (against the current CVS) to  
implement a function like this. It replaces the options 'rewrite_subject'  
and 'subject_tag' with 'tag_header' and 'tag_header_string'. You can set  
'tag_header' to a space separated list cotaining some of 'Subject'  
(= 'rewrite_subject 1'), 'From' and 'To' vs. 'none' (= 'rewrite_subject 0'). 
The To and From headers'll get the string attached as a comment. This might 
produce some not-so-RFC-compliant headers if there's already a comment present 
but that shouldn't break anything. 
Comment 2 Malte S. Stretz 2002-06-23 12:23:05 UTC
Created attachment 204 [details]
Patch against the libs to replace the 'rewrite_subject' opject with a more general 'tag_header'
Comment 3 Malte S. Stretz 2002-06-23 14:07:20 UTC
I just noticed a bug in my patch: $self->{tag_header} must be initialized with 
'Subject' (first character uppercase): 
-$self->{tag_header} = ['subject']; 
+$self->{tag_header} = ['Subject']; 
Comment 4 Malte S. Stretz 2002-06-23 14:20:06 UTC
Hmf. There's another possible gotcha. I'll attach a revised patch. 
Comment 5 Malte S. Stretz 2002-06-23 14:21:08 UTC
Created attachment 205 [details]
Revised patch; successor of patch 204
Comment 6 Daniel Quinlan 2002-07-14 20:24:08 UTC
I don't really like this idea.

I think the DEFAULT behavior should be as least obtrusive as possible -- just
add headers that will normally be invisible.  Anything settings that will
be obtrusive should be left to the local admin who can wisely choose what will
work best at his site and hopefully explain his choice (as our mail admin did
at my work, actually).

That patch I would be quite happy to accept.  :-)
Comment 7 Malte S. Stretz 2002-07-15 00:41:20 UTC
I don't like the default tagging of the subject, too. But it _is_ the current default, so I kept it (but I'd be very happy to change it to no-tagging- per-default :-). The optional tagging of From and/or To is something less intrusive than doing this to the Subject because these comments will go away if you reply to a message. 
Comment 8 Malte S. Stretz 2002-07-15 00:42:11 UTC
*argh* what happened to my wrapping? 
Comment 9 Daniel Quinlan 2002-07-15 10:59:17 UTC
Unfortunately, it's not true that the SPAM tag will go away if it's located
in the From: header.  My mailer retains those tags and I have to edit them
just the same as if it was tagged as SPAM the other way.

I think the best solution is to turn off obtrusive tags (like Subject: tagging)
by default, provide options for site administrators to turn them on, and also
provide a message encapsulation option (so the original can be extracted bit-
for-bit).  Speaking of message encapsulation, did that patch go into SA already?
Comment 10 Justin Mason 2002-08-20 15:42:50 UTC
I don't think *anyone* likes the default subject tagging.

will I change the default behaviour while we're making a release
with big UI changes anyway?
Comment 11 Craig Hughes 2002-08-23 03:24:42 UTC
*meekly raises hand at back of room*

I like subject tagging....

...but I think I'd like To: tagging even better.  I also don't mind it being off
by default.
Comment 12 Jeffrey Culverhouse 2002-09-10 19:11:48 UTC
I am new to development and patches and such, but how come this patch isn't part
of the 2.41 release or the 2.50 cvs??  Does it need time to be tested and
blessed first, or am I missing something... I know there has been a little
discussion about the default settings - is that what the wait is??  Just wonderin...
Comment 13 Justin Mason 2002-09-11 08:09:05 UTC
Dan was proposing to rewrite the whole tagging system,
so I left this until that happened.
Comment 14 Duncan Findlay 2003-12-29 11:33:28 UTC
I'm taking this one.

I plan on making a rewrite_header { from | to | subject } STRING option that
paralels add_header to a certain extent.

I will allow backwards compat, of course.
Comment 15 Duncan Findlay 2003-12-29 22:09:47 UTC
I've fixed this in SVN.

Changelog:
Adds rewrite_header option to allow tagging of Subject, To and From
headers. For To and From headers, markup will be in the form of an RFC
2822 Comment (in parentheses separated by a tab from the
address). (Closes bug 478)

As mentioned earlier, syntax is:
rewrite_header { from | to | subject } STRING

where STRING can contain TAGS.

Minor regression: removing markup of subject tagging with report_safe 0 only
works when the rewrite_header subject STRING option is given, rather than
automatically searching for the default *****SPAM***** if no subject_tag option
is given.

It probably wouldn't be too hard to add support for appending the subject tag.

Thanks to Malte for a few of the regexps which I stole from his patches.
Comment 16 Malte S. Stretz 2003-12-30 17:31:16 UTC
Duncan, you're my hero :) 
Comment 17 Duncan Findlay 2003-12-30 17:57:26 UTC
Subject: Re:  TO: header modification

> Duncan, you're my hero :) 
Aww... Thanks! But I did steal a lot of stuff from your patches :-)