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

Add single quote to list of characters escaped #69

Open
pinterface opened this issue Apr 26, 2013 · 6 comments
Open

Add single quote to list of characters escaped #69

pinterface opened this issue Apr 26, 2013 · 6 comments
Labels
omission accidentally left unspecified

Comments

@pinterface
Copy link

interpolation.yml states that only four characters are escaped: & " < >. It should also include the single quote '. (It should probably also explicitly state whether an implementation can escape additional characters and still remain spec-compliant.)

Not escaping the single quote means <tag attr='{{var}}'> is unsafe, in spite of being semantically equivalent to <tag attr="{{val}}"> which is safe. That's confusing and a recipe for exploits!

Such a change should largely be compatible with mustache-in-the-wild: a number of mustache implementations /already/ escape the single quote (at least in some cases), so any shop which uses mustache in multiple languages is unlikely to be relying on the non-escaped-single-quote:
Mustache.js: escapes single quotes.
mustache (ruby): uses CGI. CGI doesn't escape single quotes in Ruby 1.9.x, but does in Ruby 2.0.
pystache: Single quotes escaped as of Python 3.2.
mustache.go: Escapes single quotes (as &apos;!).

@tchalvak
Copy link

+1 makes sense to me.

@nwhittaker
Copy link

+1

1 similar comment
@dasilvacontin
Copy link

+1

@jgonggrijp
Copy link
Member

This is still an omission as of 2023. I welcome a pull request to address this.

(My implementation, Wontache, escapes single quotes as well.)

@bobthecow
Copy link
Member

I think this should be the default, but will require a major version change. Let's tag things with backwards compatibility breaks that we'd like to do anyway?

@jgonggrijp
Copy link
Member

I would say "bugfix". Bug fixes are always breaking in a way, but we don't bump the major version for them, because the thing that stops working should not have worked in the first place.

I would be more hesitant with this stance if most implementations didn't escape single quotes yet. Given that the practice is already widespread, however, I feel this is just a fix for an omission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
omission accidentally left unspecified
Projects
None yet
Development

No branches or pull requests

6 participants