Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6685705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:05:16+00:00 2026-05-26T05:05:16+00:00

In my CMS application, administration users can add HTML content via a WYSIWYG editor

  • 0

In my CMS application, administration users can add HTML content via a WYSIWYG editor that gets filtered by HTMLPurifier. I am now wanting to add a message board functionality. I am planning on using the Zend StripTags Filter without a whitelist to remove all HTML, and then provide for rich markup by using Zend’s BBCode or Textile parsers.

These are my questions:

  1. Can XSS make it through StripTags if I have no whitelist?
  2. Does adding BBCode or Textile as an output parser reintroduce the possibility of XSS?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:05:16+00:00Added an answer on May 26, 2026 at 5:05 am

    After reading a post about Markdown here on SO, and another article linked in an answer to that post, it appears that reintroducing XSS into a document is not only possible, but trivial. To be secure, I will need to run content through HTMLPurifier as the final step in the output filter chain. Because I am concerned with the performance of HTMLPurifier as an output filter, I am looking into using Wibble instead.

    This still leaves the first question unanswered, but in my case, that step will be unnecessary.


    I discovered when trying to use them, that Zend’s BBCode and Textile are horribly buggy. I instead used PHP Markdown. Also, Wibble doesn’t seem like it’s production ready yet.

    I used two columns in my database: content and html. The content column holds the user-submitted text. When saving the record, I convert content to HTML with PHP Markdown, pass it through HTMLPurifier and then save that value to the html column. I am not converting will every view that way.


    Implementation Details

    I put PHP Markdown here: library/markdown.php. In my active record model, using Zend_Db_Table_Row_Abstract, I use the _insert() and _update() hooks to process the values before the record is saved:

    // prepare html based on the content
    require_once 'markdown.php';
    $flt = new My_Filter_HtmlPurifier();
    $this->html = $flt->filter(Markdown($this->content));
    

    Here is my HTMLPurifier filter:

    /**
     * Based on examples from http://blog.astrumfutura.com/archives/365-Example-Zend-Framework-Blog-Application-Tutorial-Part-8-Creating-and-Editing-Blog-Entries-with-a-dash-of-HTMLPurifier.html
     */
    require_once 'HTMLPurifier.includes.php';
    require_once 'HTMLPurifier.autoload.php';
    
    class My_Filter_HtmlPurifier implements Zend_Filter_Interface
    {
        /** @var HTMLPurifier */
        protected $_htmlPurifier;
    
        public function __construct($options = null)
        {
            // set up configuration
            $config = HTMLPurifier_Config::createDefault();
            $config->set('HTML.DefinitionID', 'My HTML Purifier Filter');
            $config->set('HTML.DefinitionRev', 3); // increment when configuration changes
    //        $config->set('Cache.DefinitionImpl', null); // comment out after finalizing the config
    
            // Doctype
            $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
    
            // Add support for object (flash) tags
            $config->set('HTML.SafeObject', true);
            $config->set('Output.FlashCompat', true); // IE Support
    
            // Custom Filters
            // Add support for iframes - YouTube, Vimeo...
            $config->set('Filter.Custom', array(new HTMLPurifier_Filter_MyIframe()));
    
            // Add support for anchor targets
            $config->set('Attr.AllowedFrameTargets', array('_blank', '_self', '_target', '_top'));
    
            // configure caching
            $cachePath = CUST_APP_PATH . '/../cache/htmlpurifier';
            if (!is_dir($cachePath)) {
                mkdir($cachePath, 0700, true);
            }
            $cachePath = realpath($cachePath);
            $config->set('Cache.SerializerPath', $cachePath);
    
            // allow for passed-in options
            if (!is_null($options)) {
                //$config = HTMLPurifier_Config::createDefault();
                foreach ($options as $option) {
                    $config->set($option[0], $option[1], $option[2]);
                }
            }
    
            // create the local instance
            $this->_htmlPurifier = new HTMLPurifier($config);
        }
    
        public function filter($value)
        {
            return $this->_htmlPurifier->purify($value);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you recommend a CMS framework that could be embedded into existing web application?
I'm writing a CMS application in PHP and one of the requirements is that
I am re-designing an application for a ASP.NET CMS that I really don't like.
I have an application that I would like to embed inside our companies CMS.
i am working on a web application that now requires a CMS. Could you
I have a CMS application that manages multiple websites, today whenever i change the
I have a Ruby on Rails application that will be a CMS in way
I want to build a mobile application that allows end users to sign up
I have an old Asp classic CMS application that powers several websites. It uses
In my application's CMS, I have an edit items form. The items users will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.