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...@bugzilla.spamassassin.org on 2012/02/17 20:24:24 UTC

[Bug 6760] New: HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

             Bug #: 6760
           Summary: HTML_FONT_LOW_CONTRAST doesn't handle 3 character
                    color shorthand
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamassassin
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: Darxus@ChaosReigns.com
    Classification: Unclassified


Created attachment 5043
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5043
Patch to fix this problem, against trunk

Reported here:
http://old.nabble.com/White-text-on-white-background-td33339764.html

I've verified that a color of #789 was being converted to #070809, and is no
converted to #778899.  I have not yet verified this successfully triggers
HTML_FONT_LOW_CONTRAST in the reported case.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] [review] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

Darxus <Da...@ChaosReigns.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.4.0
            Summary|HTML_FONT_LOW_CONTRAST      |[review]
                   |doesn't handle 3 character  |HTML_FONT_LOW_CONTRAST
                   |color shorthand             |doesn't handle 3 character
                   |                            |color shorthand

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

Darxus <Da...@ChaosReigns.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Darxus@ChaosReigns.com

--- Comment #1 from Darxus <Da...@ChaosReigns.com> 2012-02-17 19:47:22 UTC ---
It looks to me like spamassassin hits HTML_FONT_LOW_CONTRAST when the
foreground and background colors are *close*, but does *nothing* when they're
the same.  It triggers HTML_FONT_LOW_CONTRAST on exactly matching colors,
including the report this bug was opened for, if you add this in addition to my
last patch:

   # invisibility
   if (substr($fg,-6) eq substr($bg,-6)) {
+    $self->put_results(font_low_contrast => 1);
     return 1;
   }
   # near-invisibility

Is this the right thing to do, or am I missing something?

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] [review] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

--- Comment #3 from Kevin A. McGrail <km...@pccc.com> 2012-03-08 23:37:50 UTC ---
Created attachment 5045
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5045
Example HTML file of some of the color research I did

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] [review] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

--- Comment #4 from Kevin A. McGrail <km...@pccc.com> 2012-03-08 23:41:11 UTC ---
Created attachment 5046
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5046
Patch to change name_to_rgb substantially, revised HTML_FONT_LOW_CONTRAST rule
and invisibility modification, tests for more colors

As discussed, this was a bit of a can of worms.  The color parsing that existed
seemed grossly outdated.

I've chosen to return invalid instead of a color code for certain things.  For
things longer than 6 chars, I didn't because someone might type an extra f, for
example.

We might look to implement a rule for invalid color codes perhaps?

Thanks to Darxus for his groundwork on this patch.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] [review] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@pccc.com

--- Comment #2 from Kevin A. McGrail <km...@pccc.com> 2012-03-08 22:04:05 UTC ---
Sorry for the delay on reviewing this.  You appear to have unraveled a bit of a
can of worms.

OK, so let's deal with the issues one at a time.

First: Should #789 be 070809 or 778899? 

Well, it should be 778899 and
http://stackoverflow.com/questions/2899197/does-style-color-fff-render-as-f0f0f0-or-ffffff
has a good answer verifying this.

However, it should only be 778899 for CSS implementations.  

This means that name_to_rgb is fundamentally flawed as are several tests in
t/html_colors.t

>From reading, these flaws are the basis on JGC's research from 2004 into IE
parsing bugs.  Those flaws are really no longer relevant.

I am not sure if want to dig into the CSS vs normal HTML.


Second: I agree.  The check for low contrast should include near and identical
colors.


I'll attach some patches and research in a little while.  Still running tests.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6760] [review] HTML_FONT_LOW_CONTRAST doesn't handle 3 character color shorthand

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6760

Kevin A. McGrail <km...@pccc.com> changed:

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

--- Comment #5 from Kevin A. McGrail <km...@pccc.com> 2012-03-21 22:32:01 UTC ---
No comments for a trunk commit in a decent amount of time so I've committed the
changes.

svn commit -m 'Patch to change name_to_rgb substantially, revised
HTML_FONT_LOW_CONTRAST rule and invisibility modification, tests for more
colors - bug 6760'
Sending        lib/Mail/SpamAssassin/HTML.pm
Sending        rules/20_html_tests.cf
Sending        t/html_colors.t
Transmitting file data ...
Committed revision 1303367.

I also added the code changes and a rule for a framework to score for a invalid
color

svn commit -m 'Adding a test rule for invalid html font colors and the
underlying code - continuation of bug 6760'  lib/Mail/SpamAssassin/HTML.pm
rulesrc/sandbox/kmcgrail/20_html_tests.cf  
Sending        lib/Mail/SpamAssassin/HTML.pm
Adding         rulesrc/sandbox/kmcgrail/20_html_tests.cf
Transmitting file data ..
Committed revision 1303608.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.