php - WMD Markdown and server-side -


I have worked on the last 2 days, and I do not get the security data to be solved with security data, I would like to On the site HTML / XML and lt; Be able to post code> (with WMD)

At the moment, I use stock data in Markdown format, but if I disable JavaScript, the user can easily push the XSS. If I use strip_tags or html_entities all the data to user HTML / XML & lt; Code> How can I do this?

In my opinion, I want html_entities , just the code between pre / pre, but how?! My data is in Markdown.

After that, what can I do to deny XSS properties:

  & lt; Img src = "javascript: alert ('xss');" / & Gt; To "clean" your HTML, you can use a device like   

Actually, it allows you to specify which tags / attributes are allowed only to keep them.

It also produces valid (X) HTML code as output - which is good.

You can see that there is an example that is almost XSS posted by you, BTW; -)

For example, you can try with some HTML like this:

Testing & lt; Img src = "javascript: evil ();" Onload = "evil ();" / & Gt; Trial & lt; Img src = "http://www.google.com/a.Png" / & gt; Test2

Output is:

  Test Test A .png  Test2  

The img tag is not placed with the XSS; The second has it;

This can not solve all your problems, but if you are providing users the ability to input HTML, is it definitely useful (Do I have to say this Dare to be "should it"?)


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -