-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclosed HTML comments not being escaped with safe_mode='escape'
#563
Comments
Unclosed `<!--` in the vulnerability details sections aren't escaped due to a [problem with markdown2](trentm/python-markdown2#563). Temporarily manually escaped these.
Thanks for spotting this. I've opened a PR for the incomplete HTML comments.
The library currently regards the contents of any HTML tag as HTML and will not process it as markdown. We do have an extra called Looking on babelmark, most other MD processors leave the HTML comment intact, except for markdown-it which escapes the comment tag and then processes the contents. It's feasible that we could escape the comment tag, sanitise the contents (to remove any commented out HTML) and then process it as markdown. |
…-mode Fix incomplete comments in safe mode not being escaped (#563)
Thanks for fixing this!
Personally, I find having this behaviour when To bring it back to this issue, I'm wondering if the unclosed comment fix will result in everything after the |
From my testing, this doesn't happen. Incomplete tags are handled differently to normal HTML. Normal HTML is escaped and the contents are hashed to prevent further processing. Incomplete tags just have the tag escaped and the contents left in place.
This makes sense, and the difference in treatment between complete and incomplete HTML tags is a bit confusing. I'll look into this |
Describe the bug
Converting a string containing an unclosed
<!--
tag withsafe_mode='escape'
does not replace<
with<
. This causes the whole html document to be commented out when attempting to render.There's also something odd about how markdown is being rendered inside of comments
To Reproduce
Expected behavior
<!--
should always be replaced with<!--
.It's also inconsistent whether it puts
<em>
tags around the 'commented' section. I believe it should be replacing it in both cases:Debug info
Version of library being used: 2.4.12
Any extras being used: None
The text was updated successfully, but these errors were encountered: