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

Now HTML escapes single quotes #45

Merged
merged 1 commit into from
Sep 28, 2016
Merged

Now HTML escapes single quotes #45

merged 1 commit into from
Sep 28, 2016

Conversation

jimmythompson
Copy link
Contributor

Using a moustache inside a HTML attribute wrapped with single quotes will allow a user to execute malicious JavaScript because Clostache doesn't escape single quotes.

Example: <a href='/user/{{username}}'>{{username}}</a> can be easily escaped if username was set to foo' onmouseover='alert(1).

We should also be escaping more characters due to the crazy nature in which people can write renderable HTML, but single quoted attributes is a pretty common thing.

Reference: http://wonko.com/post/html-escaping

@fhd fhd mentioned this pull request Sep 28, 2016
@fhd fhd merged commit dd80366 into fhd:master Sep 28, 2016
@fhd
Copy link
Owner

fhd commented Sep 28, 2016

Thanks! Sorry for letting this sit so long 😞 You're right, the escaping logic is a bit naive, I've added an issue for rethinking it: #53.

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.

2 participants