?
Solved

Storing bullet lists in database but no other tags  (especially javascript)

Posted on 2014-11-23
3
Medium Priority
?
200 Views
Last Modified: 2014-12-09
Hi

I have a website where the user wants to store some bullet pointed lists in the database

According to pages like this i can use rich text editors and they will store the html tags
http://www.kevinroth.com/rte/.

I am  a bit nervous as i always use striptags to get rid of html or code before it goes into the database
I could use striptags and allow lists? I appreciate this might remove any formatting they add so i might allow bold, italics and headers?

Is this 'safe'? Will is still keep javascript out?

Thanks experts
0
Comment
Question by:andieje
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 40460531
A quick look at the Kevin Roth site gives us this:
The Cross-Browser Rich Text Editor (RTE) is based on the designMode() functionality introduced in Internet Explorer 5, ...
Since IE5 is completely obsolete and unsupported by anyone any more, a more reasonable approach might be to learn about one of the modern textarea editors.  The two that are open-source and currently popular are TinyMCE (Used by WordPress) and CKEditor.  Once you dig into the internals of either of those packages you will quickly find ways to do almost everything you want with a rich text editor.

I have not used either in a few years, and technology is always advancing, but I know for sure that TinyMCE has the ability to restrict the types of tags that users can enter.  The docs for valid_elements and invalid_elements describe this.
0
 

Author Comment

by:andieje
ID: 40485709
to summise - it should be possible with the right editor?
0
 

Author Closing Comment

by:andieje
ID: 40489595
thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question