-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
use iframe to sandbox generated html #1295
Conversation
Isn’t there a sanitize option in marked to prevent XSS? Or did we already remove that? |
Yes we do have a sanitize option. But I don't want the demo to show sanitize output if the user isn't looking for that. Plus I think we should deprecate that option. Descussion #1232 |
Ok if that's the case, should we add this iframe solution to the USING_ADVANCED.md docs to make it the preferred method of sanitizing rather than the |
The iframe solution wouldn't work well in most situations. I think we should recommend something like DOMPurify if they are displaying user generated content.
|
Why use it here? Maybe the demo should use DOMPurify? |
Because it's a demo. I don't want the user to see sanitized output if they don't specify the sanitize option |
@UziTech That makes sense. @joshbruce or @davisjam can you take a look at this? |
Hey! Sorry been kinda quiet - lots going on with the day job. Would like @davisjam to take a look just in there's any security weirdness though I don't think there should be (brain a little fried). |
Thanks for the security disclaimer notice, appreciate the awareness you set for users 👍 |
README.md
Outdated
## Usage | ||
## Usage | ||
|
||
### Warning: 🚨 Marked does not sanitize the output HTML by default 🚨 |
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.
Could link to the docs on sanitize
here.
I don't see the
This sounds a bit circular to me. Thoughts on:
|
I still say we deprecate the DOMPurify.sanitize(marked(...)); like in #1232 (comment) marked should be all about converting markdown to HTML and let other packages handle the sanitizing and displaying the HTML. |
I'm going to merge this because it addresses sanitization of marked.js.org and we shouldn't leave this XSS vulnerability lingering any longer. If anyone wants to update the docs to make this sanitation process clearer, feel free to submit a new PR. Thanks! |
use iframe to sandbox generated html
Description
Contributor
Committer
In most cases, this should be a different person than the contributor.