You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2004/04/11 10:31:12 UTC
svn commit: rev 9964 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin rules
Author: quinlan
Date: Sun Apr 11 01:31:10 2004
New Revision: 9964
Modified:
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
incubator/spamassassin/trunk/rules/20_html_tests.cf
incubator/spamassassin/trunk/rules/30_text_de.cf
incubator/spamassassin/trunk/rules/30_text_fr.cf
incubator/spamassassin/trunk/rules/30_text_pl.cf
incubator/spamassassin/trunk/rules/50_scores.cf
Log:
bug 3252: remove redundant HTML_FONTCOLOR_NAME
clean up HTML color tests (test both fg and bg, simplify naming)
remove low performing HTML_WITH_BGCOLOR
Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/HTML.pm Sun Apr 11 01:31:10 2004
@@ -726,20 +726,17 @@
# two different names for text color
my $color = name_to_rgb(lc($attr->{$name}));
$new{fgcolor} = $color;
- $self->html_font_color_tests($color);
+ $self->html_color_tests($color);
}
elsif ($name eq "size" && $attr->{size} =~ /^\s*([+-]\d+)/) {
# relative font size
$new{size} = $self->{basefont} + $1;
}
else {
- # overwrite
if ($name eq "bgcolor") {
+ # overwrite with hex value
$attr->{bgcolor} = name_to_rgb(lc($attr->{bgcolor}));
- # one test (text tests are done elsewhere)
- if ($tag eq "body" && $attr->{bgcolor} !~ /^\#?ffffff$/) {
- $self->{html}{bgcolor_nonwhite} = 1;
- }
+ $self->html_color_tests($attr->{bgcolor});
}
if ($name eq "size" && $attr->{size} !~ /^\s*([+-])(\d+)/) {
# attribute is malformed
@@ -787,16 +784,22 @@
return "hue_unknown";
}
-sub html_font_color_tests {
- my ($self, $c) = @_;
-
- if ($c =~ /^\#?[0-9a-f]{6}$/ && $c !~ /^\#?(?:00|33|66|80|99|cc|ff){3}$/) {
- $self->{html}{font_color_unsafe} = 1;
+# test HTML colors
+# Note: input needs to be the result of name_to_rgb()
+sub html_color_tests {
+ my ($self, $color) = @_;
+
+ if ($color =~ /^\#?[0-9a-f]{6}$/) {
+ # good hex value
+ if ($color !~ /^\#?(?:00|33|66|80|99|cc|ff){3}$/) {
+ $self->{html}{color_unsafe} = 1;
+ }
}
- if ($c !~ /^\#?[0-9a-f]{6}$/ && !exists $html_color{$c}) {
- $self->{html}{font_color_name} = 1;
+ else {
+ # name_to_rgb was unable to resolve name
+ $self->{html}{color_unknown} = 1;
}
- $self->{html}{"font_" . color_hue($c)} = 1;
+ $self->{html}{"color_" . color_hue($color)} = 1;
}
sub html_font_invisible {
@@ -831,7 +834,7 @@
# increases (near-invisible text is at about 0.95% of spam and
# 1.25% of HTML spam right now), but please test any changes first
if ($distance < 12) {
- $self->{html}{"font_near_invisible"} = 1;
+ $self->{html}{"font_low_contrast"} = 1;
$visible_for_bayes = 0;
}
}
Modified: incubator/spamassassin/trunk/rules/20_html_tests.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_html_tests.cf (original)
+++ incubator/spamassassin/trunk/rules/20_html_tests.cf Sun Apr 11 01:31:10 2004
@@ -104,41 +104,38 @@
body HTML_FONT_TINY eval:html_test('tiny_font')
describe HTML_FONT_TINY HTML has a tiny font
-body HTML_FONTCOLOR_UNSAFE eval:html_test('font_color_unsafe')
-describe HTML_FONTCOLOR_UNSAFE HTML font color not in safe 6x6x6 palette
-
-body HTML_FONTCOLOR_NAME eval:html_test('font_color_name')
-describe HTML_FONTCOLOR_NAME HTML font color has unusual name
-
body HTML_FONT_INVISIBLE eval:html_test('font_invisible')
describe HTML_FONT_INVISIBLE HTML font color is same as background
-body HTML_FONT_LOW_CONTRAST eval:html_test('font_near_invisible')
+body HTML_FONT_LOW_CONTRAST eval:html_test('font_low_contrast')
describe HTML_FONT_LOW_CONTRAST HTML font color similar to background
-body HTML_FONTCOLOR_GRAY eval:html_test('font_gray')
-describe HTML_FONTCOLOR_GRAY HTML font color is gray
+body HTML_COLOR_GRAY eval:html_test('color_gray')
+describe HTML_COLOR_GRAY HTML color is gray
-body HTML_FONTCOLOR_RED eval:html_test('font_red')
-describe HTML_FONTCOLOR_RED HTML font color is red
+body HTML_COLOR_RED eval:html_test('color_red')
+describe HTML_COLOR_RED HTML color is red
-body HTML_FONTCOLOR_YELLOW eval:html_test('font_yellow')
-describe HTML_FONTCOLOR_YELLOW HTML font color is yellow
+body HTML_COLOR_YELLOW eval:html_test('color_yellow')
+describe HTML_COLOR_YELLOW HTML color is yellow
-body HTML_FONTCOLOR_GREEN eval:html_test('font_green')
-describe HTML_FONTCOLOR_GREEN HTML font color is green
+body HTML_COLOR_GREEN eval:html_test('color_green')
+describe HTML_COLOR_GREEN HTML color is green
-body HTML_FONTCOLOR_CYAN eval:html_test('font_cyan')
-describe HTML_FONTCOLOR_CYAN HTML font color is cyan
+body HTML_COLOR_CYAN eval:html_test('color_cyan')
+describe HTML_COLOR_CYAN HTML color is cyan
-body HTML_FONTCOLOR_BLUE eval:html_test('font_blue')
-describe HTML_FONTCOLOR_BLUE HTML font color is blue
+body HTML_COLOR_BLUE eval:html_test('color_blue')
+describe HTML_COLOR_BLUE HTML color is blue
-body HTML_FONTCOLOR_MAGENTA eval:html_test('font_magenta')
-describe HTML_FONTCOLOR_MAGENTA HTML font color is magenta
+body HTML_COLOR_MAGENTA eval:html_test('color_magenta')
+describe HTML_COLOR_MAGENTA HTML color is magenta
-body HTML_FONTCOLOR_UNKNOWN eval:html_test('font_hue_unknown')
-describe HTML_FONTCOLOR_UNKNOWN HTML font color is unknown to us
+body HTML_COLOR_UNKNOWN eval:html_test('color_unknown')
+describe HTML_COLOR_UNKNOWN HTML color has unknown or unusual name
+
+body HTML_COLOR_UNSAFE eval:html_test('color_unsafe')
+describe HTML_COLOR_UNSAFE HTML color not in safe 6x6x6 palette
body HTML_FONT_FACE_BAD eval:html_test('font_face_bad')
describe HTML_FONT_FACE_BAD HTML font face is not a word
@@ -247,9 +244,6 @@
body HTML_WIN_OPEN eval:html_test('window_open')
describe HTML_WIN_OPEN Javascript to open a new window
-
-body HTML_WITH_BGCOLOR eval:html_test('bgcolor_nonwhite')
-describe HTML_WITH_BGCOLOR HTML mail with non-white background
body HTML_TAG_BALANCE_HTML eval:html_tag_balance('html', '!= 0')
describe HTML_TAG_BALANCE_HTML HTML has unbalanced "html" tags
Modified: incubator/spamassassin/trunk/rules/30_text_de.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/30_text_de.cf (original)
+++ incubator/spamassassin/trunk/rules/30_text_de.cf Sun Apr 11 01:31:10 2004
@@ -337,18 +337,17 @@
lang de describe HTML_EVENT HTML-Nachricht mit automatisch ausgef�hrten Programmanweisungen
lang de describe HTML_EVENT_UNSAFE HTML mit unsicheren, automatisch ausgef�hrten Programmanweisungen
lang de describe HTML_FONT_BIG gro�e Schriftart oder Schriftart�nderungen
-lang de describe HTML_FONTCOLOR_UNSAFE HTML-Schriftfarbe nicht aus �blicher Palette (6x6x6)
-lang de describe HTML_FONTCOLOR_NAME HTML-Schriftfarbe mit ungew�hnlichem Namen
+lang de describe HTML_COLOR_UNSAFE HTML-Schriftfarbe nicht aus �blicher Palette (6x6x6)
lang de describe HTML_FONT_INVISIBLE gleiche HTML-Schriftfarbe wie der Hintergrund
lang de describe HTML_FONT_LOW_CONTRAST HTML-Schriftfarbe �hnlich der Hintergrundfarbe
-lang de describe HTML_FONTCOLOR_GRAY HTML-Schriftfarbe Grau
-lang de describe HTML_FONTCOLOR_RED HTML-Schriftfarbe Rot
-lang de describe HTML_FONTCOLOR_YELLOW HTML-Schriftfarbe Gelb
-lang de describe HTML_FONTCOLOR_GREEN HTML-Schriftfarbe Gr�n
-lang de describe HTML_FONTCOLOR_CYAN HTML-Schriftfarbe Cyan
-lang de describe HTML_FONTCOLOR_BLUE HTML-Schriftfarbe Blau
-lang de describe HTML_FONTCOLOR_MAGENTA HTML-Schriftfarbe Magenta
-lang de describe HTML_FONTCOLOR_UNKNOWN unbekannte HTML-Schriftfarbe
+lang de describe HTML_COLOR_GRAY HTML-Schriftfarbe Grau
+lang de describe HTML_COLOR_RED HTML-Schriftfarbe Rot
+lang de describe HTML_COLOR_YELLOW HTML-Schriftfarbe Gelb
+lang de describe HTML_COLOR_GREEN HTML-Schriftfarbe Gr�n
+lang de describe HTML_COLOR_CYAN HTML-Schriftfarbe Cyan
+lang de describe HTML_COLOR_BLUE HTML-Schriftfarbe Blau
+lang de describe HTML_COLOR_MAGENTA HTML-Schriftfarbe Magenta
+lang de describe HTML_COLOR_UNKNOWN unbekannte HTML-Schriftfarbe
lang de describe HTML_FONT_FACE_BAD HTML-Schriftart inkorrekt angegeben
lang de describe HTML_FONT_FACE_ODD selten benutzte HTML-Schriftart
lang de describe HTML_FONT_FACE_CAPS Name der HTML-Schriftart mit zus�tzlichen Gro�buchstaben
Modified: incubator/spamassassin/trunk/rules/30_text_fr.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/30_text_fr.cf (original)
+++ incubator/spamassassin/trunk/rules/30_text_fr.cf Sun Apr 11 01:31:10 2004
@@ -303,16 +303,15 @@
lang fr describe HTML_EMBEDS HTML: Inclusion d'objets
lang fr describe HTML_EVENT_UNSAFE Le HTML contient du code auto-ex�cutable potentiellement dangereux
lang fr describe HTML_FONT_BIG Police de taille +2 ou 3 et davantage
-lang fr describe HTML_FONTCOLOR_BLUE Police HTML de couleur bleue
-lang fr describe HTML_FONTCOLOR_CYAN Police HTML de couleur cyan
-lang fr describe HTML_FONTCOLOR_GRAY Police HTML de couleur grise
-lang fr describe HTML_FONTCOLOR_GREEN Police HTML de couleur verte
-lang fr describe HTML_FONTCOLOR_MAGENTA Police HTML de couleur magenta
-lang fr describe HTML_FONTCOLOR_NAME Police HTML avec couleur de nom inhabituel
-lang fr describe HTML_FONTCOLOR_RED Police HTML de couleur reouge
-lang fr describe HTML_FONTCOLOR_UNKNOWN Police HTML de couleur inconnue
-lang fr describe HTML_FONTCOLOR_UNSAFE Couleur de police HTML hors de la palette 6x6x6 s�re
-lang fr describe HTML_FONTCOLOR_YELLOW Police HTML de couleur jaune
+lang fr describe HTML_COLOR_BLUE Police HTML de couleur bleue
+lang fr describe HTML_COLOR_CYAN Police HTML de couleur cyan
+lang fr describe HTML_COLOR_GRAY Police HTML de couleur grise
+lang fr describe HTML_COLOR_GREEN Police HTML de couleur verte
+lang fr describe HTML_COLOR_MAGENTA Police HTML de couleur magenta
+lang fr describe HTML_COLOR_RED Police HTML de couleur reouge
+lang fr describe HTML_COLOR_UNKNOWN Police HTML de couleur inconnue
+lang fr describe HTML_COLOR_UNSAFE Couleur de police HTML hors de la palette 6x6x6 s�re
+lang fr describe HTML_COLOR_YELLOW Police HTML de couleur jaune
lang fr describe HTML_FONT_FACE_BAD Le nom de la police HTML n'est pas un mot
lang fr describe HTML_FONT_FACE_CAPS Le nom de la police HTML comporte trop de majuscules
lang fr describe HTML_FONT_FACE_ODD Police HTML rarement utilis�e
Modified: incubator/spamassassin/trunk/rules/30_text_pl.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/30_text_pl.cf (original)
+++ incubator/spamassassin/trunk/rules/30_text_pl.cf Sun Apr 11 01:31:10 2004
@@ -330,16 +330,15 @@
lang pl describe HTML_EVENT HTML zawiera samoczynnie uruchamiaj�cy si� kod
lang pl describe HTML_EVENT_UNSAFE HTML zawiera niebezpieczny, samoczynnie uruchamiaj�cy si� kod
lang pl describe HTML_FONT_BIG HTML zawiera wielk� czcionk�
-lang pl describe HTML_FONTCOLOR_BLUE kolor czcionki w HTML jest niebieski
-lang pl describe HTML_FONTCOLOR_CYAN kolor czcionki w HTML jest cyjanowy
-lang pl describe HTML_FONTCOLOR_GRAY kolor czcionki w HTML jest szary
-lang pl describe HTML_FONTCOLOR_GREEN kolor czcionki w HTML jest zielony
-lang pl describe HTML_FONTCOLOR_MAGENTA kolor czcionki w HTML jest fuksynowy
-lang pl describe HTML_FONTCOLOR_NAME kolor czcionki w HTML posiada niespotykan� nazw�
-lang pl describe HTML_FONTCOLOR_RED kolor czcionki w HTML jest czerwony
-lang pl describe HTML_FONTCOLOR_UNKNOWN nieznany kolor czcionki w HTML
-lang pl describe HTML_FONTCOLOR_UNSAFE kolor czcionki w HTML nie jest z bezpiecznej palety 6x6x6
-lang pl describe HTML_FONTCOLOR_YELLOW kolor czcionki w HTML jest ��ty
+lang pl describe HTML_COLOR_BLUE kolor czcionki w HTML jest niebieski
+lang pl describe HTML_COLOR_CYAN kolor czcionki w HTML jest cyjanowy
+lang pl describe HTML_COLOR_GRAY kolor czcionki w HTML jest szary
+lang pl describe HTML_COLOR_GREEN kolor czcionki w HTML jest zielony
+lang pl describe HTML_COLOR_MAGENTA kolor czcionki w HTML jest fuksynowy
+lang pl describe HTML_COLOR_RED kolor czcionki w HTML jest czerwony
+lang pl describe HTML_COLOR_UNKNOWN nieznany kolor czcionki w HTML
+lang pl describe HTML_COLOR_UNSAFE kolor czcionki w HTML nie jest z bezpiecznej palety 6x6x6
+lang pl describe HTML_COLOR_YELLOW kolor czcionki w HTML jest ��ty
lang pl describe HTML_FONT_FACE_BAD HTMLowy opis czcionki nie jest s�owem
lang pl describe HTML_FONT_FACE_CAPS HTMLowy opis czcionki zawiera zb�dne wielkie litery
lang pl describe HTML_FONT_FACE_ODD HTMLowy opis czcionki nie jest zwykle u�ywany
Modified: incubator/spamassassin/trunk/rules/50_scores.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/50_scores.cf (original)
+++ incubator/spamassassin/trunk/rules/50_scores.cf Sun Apr 11 01:31:10 2004
@@ -231,11 +231,11 @@
score HTML_80_90 0.014 0.001 0.001 0.001
score HTML_90_100 0.308 1.073 0.001 1.187
score HTML_COMMENT_SAVED_URL 0.404 0.821 0.768 1.039
-score HTML_FONTCOLOR_BLUE 0.100
-score HTML_FONTCOLOR_GREEN 0.056 0.103 0.043 0.001
-score HTML_FONTCOLOR_RED 0.100 0.100 0.100 0.101
-score HTML_FONTCOLOR_UNKNOWN 0.100 0.100 0.283 0.100
-score HTML_FONTCOLOR_UNSAFE 0.100
+score HTML_COLOR_BLUE 0.100
+score HTML_COLOR_GREEN 0.056 0.103 0.043 0.001
+score HTML_COLOR_RED 0.100 0.100 0.100 0.101
+score HTML_COLOR_UNKNOWN 0.100 0.100 0.283 0.100
+score HTML_COLOR_UNSAFE 0.100
score HTML_FONT_BIG 0.271 0.100 0.270 0.267
score HTML_FONT_FACE_BAD 0.063 0.203 0.001 0.001
score HTML_FONT_FACE_ODD 0.185 0.001 0.001 0.001
@@ -573,7 +573,6 @@
score MIME_BOUND_DIGITS_4 0.001
score BLANK_LINES_90_100 0.001
score NO_FEE 0.001
-score HTML_WITH_BGCOLOR 0.001
score MISSING_HEADERS 0.001
score FULL_REFUND 0.001
score EXCUSE_15 0.001 0.708 0.001 0.001
@@ -593,7 +592,7 @@
score BTAMAIL_HEADER 2.900 0.001 0.001 0.001
score HTML_WIN_OPEN 0.001
score TO_NO_USER 1.662 1.498 1.597 0.001
-score HTML_FONTCOLOR_YELLOW 0.001
+score HTML_COLOR_YELLOW 0.001
score NIGERIAN_SUBJECT6 0.001
score RATWARE_SCREWUP_1 2.900 2.800 0.001 0.001
score SEX_FEST 1.966 0.001 0.001 0.001
@@ -635,7 +634,7 @@
score BILLION_DOLLARS 0.001
score WEALTH 0.001
score DATE_IN_PAST_48_96 0.001
-score HTML_FONTCOLOR_GRAY 0.001
+score HTML_COLOR_GRAY 0.001
score FURTHER_TRANSMISSIONS 0.001 2.800 0.001 0.001
score X_SERV_HOST_PRESENT 0.001 2.800 0.001 0.001
score HTML_SHOUTING6 0.001
@@ -643,13 +642,12 @@
score RATWARE_IMKTG 0.001
score EXCUSE_7 0.001
score HTML_TAG_BALANCE_HEAD 0.001
-score HTML_FONTCOLOR_CYAN 0.001
+score HTML_COLOR_CYAN 0.001
score FORWARD_LOOKING 2.200 0.001 0.001 0.001
score X_STORMPOST_TO 2.900 0.001 2.800 0.001
score FREE_INSTALL 1.225 1.661 2.399 0.001
score EARN_PER_WEEK 0.001
score INCOME 1.356 0.001 0.001 0.001
-score HTML_FONTCOLOR_NAME 0.001
score SUBJ_RIPPED 0.001
score TO_FILENAME 0.001
score HTML_EVENT 0.001
@@ -662,7 +660,7 @@
score NO_PURCHASE 0.001
score HTML_IMAGE_RATIO_02 0.001
score NA_DOLLARS 0.001 1.997 0.001 0.001
-score HTML_FONTCOLOR_MAGENTA 0.001
+score HTML_COLOR_MAGENTA 0.001
score HTML_IMAGE_AREA_06 0.001
score STOCK_PICK 0.001 1.248 0.001 0.001
score IP_LINK_PLUS 0.001