In our web app, we need to allow users to input rich text which is then presented to other users. We are looking for a simple WYSIWYG (JavaScript) editor that outputs a format which is backwards compatible with plain text (to support existing text in our database), has simple rich-text formatting support (bold/italic/underline/bullets/blockquote/etc) and a frontend renderer that accepts the output and can display it, while not being able to introduce any HTML tags at all. This will greatly diminish the chance of XSS. I could not find any major project that does this.
We are currently implementing the following to evade XSS:
- CSP
- iframe sandbox
- All important cookies are HttpOnly
- Using a renderer that does now render scripts, like markdown-it or react-markdown.
That being said, it still feels like here is a major gap in the ecosystem. There is no editor + renderer that works with something like reStructedText or BBCode, or some other format with no support for HTML tags or advanced functionality. Most editors and renderers work with Markdown, which is problematic. We'd love something super simple that will allow basic features with a minimal amount of exposed surface.
Does anyone have any recommendations on how to tackle this challenge?