-
Notifications
You must be signed in to change notification settings - Fork 565
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
Fix for checklist rendering problem #714
Conversation
Thanks for the patch @Jackymancs4! If there another way we can accomplish this with the existing |
const xssConfig = { | ||
onTag(tag, html) { | ||
if (tag === 'input') { | ||
if (html.includes('type="checkbox"')) return html; |
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.
we would definitely want to lock this down. right now it appears like if the input is a checkbox then we'll also allow XSS attacks in other unrelated fields of the same HTML
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.
Can you articulate more? I'm very interested if I missed something.
Without whitelisting this, rendering checkboxes is near impossible.
Also, strictly allowing only checkbox type input seems pretty harmless..
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.
I can actually improve sanitization of <input>
, stripping it from all the non-type attributes, if that was the problem.
Like, enforcing that only <input type="checkbox disabled>
are returned.
Nope, I already extensively studied the code and it seems impossible to me, because of this line
Well, I think it's a possible way, but I'm not able to see any real gain doing so.
Actually, my fork is not a patch, but a complete rewrite of the code according to the more recent showdown extension interface. And I'm planning to improve testing coverage. Also, the original repo has been unmantained for almost three years. I can try, of course. |
Just tried this out, thanks for the fix @Jackymancs4. We are indeed allowing any input with a There's also a small conflict with |
We should also see about this, or maybe put the fork in one of our repos. |
Trying to address #694, #314, #681
Hello,
after some investigation I found that the problem was indeed the sanitization of html performed by https://github.com/leizongmin/js-xss through https://github.com/VisionistInc/showdown-xss-filter.
js-xss
provides powerful filtering API, butshowdown-xss-filter
forces only the default behavior that kills every type of input and form.Since
showdown-xss-filter
has pretty old dependencies, I'm going to maintain (mainly for personal use) an updated fork that enables all of js-xss configurations.This PR includes a whitelisting configuration that allows only checklist rendering, while performing xss validation on everything else.
Test: