Is there a reason not to allow the HTML font tag in filter_xss_admin()? When letting admin's use TinyMCE for the contact form header text, they cannot color font using font tags in the current implementation.

CommentFileSizeAuthor
filter.module_25.patch1.31 KBRobRoy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

killes@www.drop.org’s picture

the reason is "don't use the font tag"

http://www.webreference.com/html/tutorial22/

RobRoy’s picture

Of course, I completely agree with you that the font tag should never be intentionally used and the thought of it makes me shudder and think back to 1992.

BUT I do still think that we should allow the font tag for filter_xss_admin() since its purpose is to prevent XSS attacks, not enforce "progressive" HTML. For situations when a client wants to use a WYSIWYG editor for the contact settings header, any font tags will be stripped. Just including the font tag in the allowed list doesn't mean we are advocating the use of it in the content. :P

killes@www.drop.org’s picture

Version: 4.7.3 » x.y.z

Moving this to HEAD to get more reviews.

Steven’s picture

Version: x.y.z » 5.x-dev
Status: Needs review » Closed (works as designed)

filter_xss_admin() also removes inline CSS. Removing the font tag is really no different.

RobRoy’s picture

Status: Closed (works as designed) » Needs review

Well, with inline CSS you could do a lot more damage than with the font tag. For some rich-text editors, it would be nice to allow the font tag. With inline CSS you could totally bork a site. I really see no harm in including font. If you show me some sort of "xss" vulnerability with the font tag, then I agree. But since this function is just supposed to filter xss or other harmful attacks, IMHO we should allow font.

drumm’s picture

Status: Needs review » Closed (works as designed)

Which WYSIWYG editors?

RobRoy’s picture

Status: Closed (works as designed) » Needs review

I encountered this with TinyMCE when a client was trying to change the color of some text and it kept reverting on save.

I really think that 'font' should be allowed. Unless someone tells me how 'font' could be used for an XSS attack, I think this should go in. Again, I agree that 'font' is horrible and should never be voluntarily used, but AFAICT it poses no XSS threat and this is just a political argument because 'font' sucks.

drumm’s picture

Version: 5.x-dev » 6.x-dev
StevenPatz’s picture

Status: Needs review » Reviewed & tested by the community

patch looks good and works as advertised.

Dries’s picture

Version: 6.x-dev » 5.x-dev

I've committed this just for the sake of getting some WYSIWYG editors to work. Plus, the font-tag is part of the XHTML standard. Might want to commit this to D5 too.

Dries’s picture

I rolled back this patch. Font is deprecated. Better to report this bug to the maintainers of the wysiwyg package.

chx’s picture

Title: Allow font tag in filter_xss_admin() » font tag
Project: Drupal core » TinyMCE
Version: 5.x-dev » master
Component: filter.module » Code
Status: Reviewed & tested by the community » Active

Not just that it's deprecated, it's totally omitted from XHTML Strict.

m1mic’s picture

From looking at this patch, it appears that it is attempting change the filter so that the font tag isn't removed from the underlying html. Moxie Code's TinyMCE has the ability to convert the deprecated font tags into inline styles. In the TinyMCE 5.x-dev module, the settings are in place for this to happen. If the admin goes to admin/settings/tinymce/edit/[enter profile name here] and goes to the Cleanup and Output section, there is the option to Convert font tags to styles. The trouble with this is that it doesn't actually work.

With the help of mlsamuelson, we came up with a patch (see http://drupal.org/node/126364) that corrects this bug. Using inline styles (inside of span tags) instead of font tags will make it validate as XHTML Strict.

Mupsi’s picture

Issue summary: View changes
Status: Active » Closed (outdated)