Skip to content

Add single quote to list of characters escaped #69

@pinterface

Description

@pinterface

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;!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    omissionaccidentally left unspecified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions