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

Sanitization issues in custom HTML infowindows #3010

Closed
iriberri opened this issue Apr 3, 2015 · 9 comments · Fixed by #3059
Closed

Sanitization issues in custom HTML infowindows #3010

iriberri opened this issue Apr 3, 2015 · 9 comments · Fixed by #3059
Assignees
Milestone

Comments

@iriberri
Copy link
Contributor

iriberri commented Apr 3, 2015

Hey, people have reported a couple of issues these days when they use code inside their custom infowindows:

  • IMG tags which contain URL with & characters are broken due to escaping
  • target="_blank" tags have stopped working too
@saleiva saleiva added this to the Guarroman milestone Apr 4, 2015
@javisantana
Copy link
Contributor

@viddo is there a reason to now allow target and img tags with &?

@viddo
Copy link
Contributor

viddo commented Apr 6, 2015

  • All attributes are escaped by default, but a browser should be capable of handling that. I've been fiddling around in local dev env and have not been able to break it. Can you give some example of an img URL, @iriberri ?
  • The target attribute is disallowed by default, but I can't find any good motivation for why that is. I can change the policy to allow it.

@iriberri
Copy link
Contributor Author

iriberri commented Apr 6, 2015

Sure, I won't share them publicly but: SB/4981277 -- they can be found in the first message.

@iriberri
Copy link
Contributor Author

iriberri commented Apr 6, 2015

@iriberri
Copy link
Contributor Author

iriberri commented Apr 6, 2015

@viddo
Copy link
Contributor

viddo commented Apr 6, 2015

The target issue will be solved here, CartoDB/carto.js#428 I'll reply to that thread on stackexchange, thx!

Re: the img isssue far it seem to be an issue on embeds only for some reason, still investigating...

@viddo
Copy link
Contributor

viddo commented Apr 6, 2015

The img-issue is due to the Mustache's escaping, using the unescaped output (triple angle brackets, i.e. <img src={{{ img_url }}} ...) makes the image to be rendered as expected. Custom templates are filtered through the sanitize step anyways so it's safe to do. No code change is necessary.

@iriberri
Copy link
Contributor Author

iriberri commented Apr 6, 2015

Extra info about '&' escaping in URLs, they get converted to:

image

@iriberri
Copy link
Contributor Author

iriberri commented Apr 6, 2015

Great, I'll let the users know. Thanks!

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 a pull request may close this issue.

5 participants