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
Sanitize mdstrip #1351
Sanitize mdstrip #1351
Conversation
Maybe simply use |
Hum, actually we should not replace |
New version with |
@@ -100,6 +107,7 @@ def mdstrip(value, length=None, end='…'): | |||
value = value.split(EXCERPT_TOKEN, 1)[0] | |||
rendered = md(value) | |||
text = do_striptags(rendered) | |||
text = bleach_clean(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working. I'm just wondering whether this should after or before the do_striptags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow do_striptags
would reintroduce the injection. I tested because it seemed more logical but...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to me, I was just wondering the reasonning 👍
@@ -100,6 +107,7 @@ def mdstrip(value, length=None, end='…'): | |||
value = value.split(EXCERPT_TOKEN, 1)[0] | |||
rendered = md(value) | |||
text = do_striptags(rendered) | |||
text = bleach_clean(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to me, I was just wondering the reasonning 👍
Jinja
do_striptags
result is not safe to piped into asafe
filter, for example when we outputjson_ld
.Not totally sure about the impact of this on the rest of the site, but some nasty things happening on a reuse do not happen anymore and the reuse stil displays fine.