Skip to content
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

Filter HTML _after_ Markdown to HTML conversion #2216

Merged
merged 1 commit into from
Oct 20, 2019
Merged

Filter HTML _after_ Markdown to HTML conversion #2216

merged 1 commit into from
Oct 20, 2019

Conversation

PatrickCronin
Copy link
Contributor

@PatrickCronin PatrickCronin commented Oct 20, 2019

(Description added post-merge.)

Looks like my previous PR introduced a security vulnerability that resulted from a poor order of operations when converting Markdown to HTML. The original PR filtered out undesirable HTML from raw Markdown before converting the result to HTML. Carefully crafted Markdown can be written to take advantage of this to run arbitrary JS, and likely do other undesirable things.

This PR reverses the order of the conversion: first the raw Markdown is converted to HTML, and then the result is processed through the HTML filter. In this way, we block this attack vector. Thanks to @rafl for pointing out the issue! (And apologies for creating the security hole in the first place.)

@oalders
Copy link
Member

oalders commented Oct 20, 2019

Thanks @PatrickCronin!

@oalders oalders merged commit dd28228 into metacpan:master Oct 20, 2019
@PatrickCronin PatrickCronin deleted the pcronin/filter-html-after branch October 20, 2019 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants