You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2021/03/16 14:21:55 UTC

[Bug 7892] New: T_KAM_HTML_FONT_INVALID false positive for " !important"

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

            Bug ID: 7892
           Summary: T_KAM_HTML_FONT_INVALID false positive for "<color>
                    !important"
           Product: Spamassassin
           Version: 3.4.2
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Rules (Eval Tests)
          Assignee: dev@spamassassin.apache.org
          Reporter: tbsmark86@gmail.com
  Target Milestone: Undefined

The test eval:html_test('font_invalid_color') for the rule
T_KAM_HTML_FONT_INVALID triggers for the color value "black !important" in CSS
style attributes. (Or any other color value)

Since adding !important is valid for any CSS value you might consider simply
stripping of this postfix before parsing colors in
/lib/Mail/SpamAssassin/HTML.pm.


Note this is somewhat similar to:
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7778

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sidney@sidney.com

--- Comment #2 from Sidney Markowitz <si...@sidney.com> ---
+1 on committing this to 3.4 branch.
We need one more vote.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

--- Comment #9 from Kent Oyer <ke...@mxguardian.net> ---
I hate to be picky but we should probably be more liberal with the spaces
around the delimiter. The spec says there can be whitespace after the
delimiter:

    color ! important

Although the space before the delimiter is required, it's sometimes omitted:

    color!important

See the attached patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

--- Comment #10 from Sidney Markowitz <si...@sidney.com> ---
(In reply to Kent Oyer from comment #9)
> I hate to be picky but we should probably be more liberal with the spaces
> around the delimiter.

Noting for for readers that you have since opened bug bug 8210 for related
issues and it is being handled there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Kevin A. McGrail <km...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.6                       |4.0.1
                 CC|                            |kmcgrail@apache.org

--- Comment #6 from Kevin A. McGrail <km...@apache.org> ---
Marking as a 4.0.1 target

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Kent Oyer <ke...@mxguardian.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kent@mxguardian.net

--- Comment #8 from Kent Oyer <ke...@mxguardian.net> ---
Created attachment 5927
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5927&action=edit
css-important.patch

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Henrik Krohns <ap...@hege.li> ---
Committed

Sending        spamassassin-3.4/lib/Mail/SpamAssassin/HTML.pm
Transmitting file data .done
Committing transaction...
Committed revision 1888513.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apache@hege.li

--- Comment #1 from Henrik Krohns <ap...@hege.li> ---
Thanks, committed to trunk. 3.4 is currently in RTC mode, perhaps later there.

Sending        trunk/lib/Mail/SpamAssassin/HTML.pm
Transmitting file data .done
Committing transaction...
Committed revision 1887889.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.4.6

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|REOPENED                    |RESOLVED

--- Comment #7 from Henrik Krohns <ap...@hege.li> ---
Thanks, fixed per last comment

Sending        spamassassin-3.4/lib/Mail/SpamAssassin/HTML.pm
Sending        trunk/lib/Mail/SpamAssassin/HTML.pm
Transmitting file data ..done
Committing transaction...
Committed revision 1911441.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

Steadramon <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paul.stead@gmail.com

--- Comment #3 from Steadramon <pa...@gmail.com> ---
Looks fine here 

+1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7892] T_KAM_HTML_FONT_INVALID false positive for " !important"

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7892

tbsmark86@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---
                 CC|                            |tbsmark86@gmail.com

--- Comment #5 from tbsmark86@gmail.com ---
Patch finally arrived at my system - and ... it doesn't fix anything.
Sorryy for not looking at the patch at the time.

Note: I'am not really into perl at all so i may be wrong.
But for me it looks like this revision 1887889  seems to allow this:

   color: !important;

Because it's a simple copy & paste of the 7778 solution to allow the special
'inherit' value. However needed is this:

   color: white !important;
   background-color: white !important;


I guess a fix should look like this:

@@ -515,6 +515,9 @@
          if (/^\s*(background-)?color:\s*(.+?)\s*$/i) {
            my $whcolor = $1 ? 'bgcolor' : 'fgcolor';
            my $value = lc $2;
+           # Strip of trailing !important to prevent parsing as 'invalid
color'
+           # (Bug 7892)
+           $value =~ s/^([^\s]+)\s*!important$/$1/;

            if ($value =~ /rgb/) {
              $value =~ tr/0-9,//cd;
@@ -527,10 +530,6 @@
               # do nothing, just prevent parsing of the valid
               # CSS3 property value as 'invalid color' (Bug 7778)
             }
-            elsif ($value eq '!important') {
-              # do nothing, just prevent parsing of the valid
-              # CSS3 property value as 'invalid color' (Bug 7892)
-            }
            else {
              $new{$whcolor} = name_to_rgb($value);
            }

-- 
You are receiving this mail because:
You are the assignee for the bug.