-
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
Make URL handling consistent between links and images #1359
Conversation
I think we are trying to get rid of the |
Even if that's the eventual goal, this change will still increase consistency, make it easier to remove sanitization later (only one place to change the code), and make sure all other URL munging (like baseUrl resolution) stays consistent between links and images. |
@UziTech I agree we should get rid of the sanitize option. But I think @aprotim has some valid points here. The way I understand this PR, it makes sure both link urls and image urls are sanitized in the same way. I would think everyone would benefit from this change. It just might send the wrong message if the release notes show we are making changes to the sanitizer and the next release it gets removed. |
Is the rename of this PR sufficient to address that concern, @styfle? |
I'm not super familiar with the flow here, so just making sure there's nothing else I'm supposed to do before these PRs get merged? |
test/new/images.md
Outdated
--- | ||
sanitize: true | ||
--- | ||
[URL](javascript:alert) |
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.
These are links, not images. !
are missing
Whoops! I definitely thought I'd changed those. Maybe I accidentally blew away my changes while I was trying to figure out how to do the branching right. Fixed? |
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.
Agree with @UziTech on sanitizer in general. Let's revisit when we get to 1.x
Marked version:
b6d5a67
Markdown flavor: all
Description
Expectation
With sanitization on, I'd expect
[Link](javascript:alert('xss'))
![Image](javascript:alert('xss'))
To result in
<p>Link
Image</p>
Result
<p>Link <img src="javascript:alert('xss')" alt="Image"></p>
What was attempted
marked("[Link](javascript:alert('xss'))\n![Image](javascript:alert('xss'))", {sanitize: true})
Contributor
Committer
In most cases, this should be a different person than the contributor.