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

img attribute is getting removed #35

Open
snap9 opened this issue Jan 30, 2017 · 3 comments
Open

img attribute is getting removed #35

snap9 opened this issue Jan 30, 2017 · 3 comments

Comments

@snap9
Copy link

snap9 commented Jan 30, 2017

I'm using imgsrc to support high-resolution display images: https://webkit.org/demos/srcset/

Since Markdown has no built-in support for this, I'm writing out the HTML manually:

<img src="image.jpg" srcset="image-1x.jpg 1x, image-2x.jpg 2x, image-3x.jpg 3x">

But your Markdown library strips this down to

<img src="image.jpg">

It just gets rid of the srcset. Why, and how can I solve this?

@snoyberg
Copy link
Owner

Looks like the Cross Site Scripting (XSS) protection is kicking in. You can configure that via msXssProtect:

https://www.stackage.org/haddock/lts-7.18/markdown-0.1.16/Text-Markdown.html#v:msXssProtect

@snap9
Copy link
Author

snap9 commented Jan 30, 2017

@snoyberg This worked. But do you think XSS should disable srcset? That's hardly a security risk. I thought XSS was only supposed to ban dangerous things like <script>.

@snoyberg
Copy link
Owner

I'm not sure if there are XSS implications to the srcset attribute. If you'd like it added to the whitelist, the relevant package for discussion would be:

https://github.com/yesodweb/haskell-xss-sanitize

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

No branches or pull requests

2 participants