Are allowing <b>, <p>, <i> tags safe for XSS hacks?

Discussion in 'JavaScript' started by SGBoise, Aug 12, 2008.

  1. #1
    Hello,

    I want to allow people to be able to do simple formats when they write comments in my script. Right now I remove all the tags to prevent XSS attacks.

    I was just wondering if I allowed <b>, <p>, <i>, or <br> tags if those can be used for XSS attacks?
     
    SGBoise, Aug 12, 2008 IP
  2. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #2
    this is a php problem, but can be solved with javascript too.
    You could write a menu with your custom codes, like bbcodes, then with javascript to replace in page by example with <b> </b>.
    Search examples about how to use match in javascript, or regex in javascript.
     
    hip_hop_x, Aug 12, 2008 IP