mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
[Question] Protection against XXS with user-generated input. #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mloewent on GitHub (Jul 10, 2017).
Hi. I am wondering how I can protect against code execution using this library.
I want users to be able to add code snippets
<script>alert("hi");</script>, but to make sure they are encoded.Currently if a user writes a code snippet without putting it in a
code blockthe snippet will be executed. Is there any way this library can help protect against this?Thanks.
@mloewent commented on GitHub (Jul 10, 2017):
I have solved this by using a library to sanitize the HTML output of markdig, using a whitelist of HTML tags. Will leave this issue open in case you have any input.
@xoofx commented on GitHub (Jul 11, 2017):
Yes, it is recommended to use a sanitizer on the HTML output directly