marked-element icon indicating copy to clipboard operation
marked-element copied to clipboard

The marked-element in insecure by default

Open therealmik opened this issue 8 years ago • 3 comments

Description

The marked-element has sanitize set to false by default, meaning that users of it are vulnerable to XSS unless it occurs to them to add the word sanitize.

It would be more sensible to add a noSanitize property (that defaults to false), and people that really trust their markdown can set it.

It will be obvious to people who need no-sanitize that something's wrong, and most likely no harm will come to them as a result, unlike the current situation.

Expected outcome

That Polymer projects are not vulnerable to XSS

Actual outcome

Users of the marked-element need to ensure they pass the sanitize attribute to their tags, or they'll be vulnerable to XSS when using user-generated markdown.

therealmik avatar Oct 25 '16 21:10 therealmik

These properties are driven by the marked library API. I would bring it up over there. I don't know enough about the details about it.

stramel avatar Apr 01 '17 05:04 stramel

I'm not proposing an upstream change, just proposing that we enable secure markdown by default, and allow people that want allow arbitrary html (including scripts) to pass a no-sanitize for rendering trusted markdown.

This poor default has caused numerous XSS vulnerabilities.

So the proposal is simply to remove the sanitize boolean property, and create a noSanitize property that has the inverse meaning.

therealmik avatar Apr 01 '17 05:04 therealmik

This is a property of the used markdown lib? Sounds like a sensible default. ;) If there is agreement we should take this in, I can make up a PR for it. Thanks for the indepth report btw

sebs avatar May 29 '17 13:05 sebs