Is Markdown (with strip_tags) sufficient to stop XSS attacks?

后端 未结 7 1081
温柔的废话
温柔的废话 2020-12-16 01:31

I\'m working on a web application that allows users to type short descriptions of items in a catalog. I\'m allowing Markdown in my textareas so users can do some HTML format

7条回答
  •  春和景丽
    2020-12-16 02:12

    Will allowing markdown present any security threats? Can markdown be XSSed, even though it has no tags?

    It's almost impossible to make absolute statements in that regard - who can say what the markdown parser can be tricked into with sufficiently malformed input?

    However, the risk is probably very low, since it is a relatively simple syntax. The most obvious angle of attack would be javascript: URLs in links or images - probably not allowed by the parser, but it's something I'd check out.

提交回复
热议问题