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

Antler old variable is not sanitized #1521

rrelmy opened this Issue Jul 24, 2017 · 2 comments


None yet
2 participants

rrelmy commented Jul 24, 2017

Not directly a feature request. I totally understand that could only be done in v3 or later
Or, it could be a setting that we can opt-in to (thanks aryeh for the input) :-)

Expected behaviour

Variable output through should be escaped unless otherwise stated.
Because nobody can write XSS proof code.

I assumed that behaviour because most other template language do it too.
Blade, Mustache, Twig (not sure about the default but in drupal for example) etc.

Actual behaviour

{{ get:q }} leads to XSS Update: not since 2.1.19
{{ old:myvar }} in form leads to XSS

It took me quite some time to realise this behaviour.
And I think most people are not knowing it

Steps to reproduce

  1. Create a form with an {{ old }} variable
  2. Submit the form with some XSS content like "><h1>Oops

This comment has been minimized.


jasonvarga commented Jul 28, 2017

Adding {{ get:q }} to my template and visiting ?q=<script>alert(%27I%20am%20evil%27);</script> outputs &lt;script&gt;alert('I am evil');&lt;/script&gt;

What version are you on?


This comment has been minimized.

rrelmy commented Aug 4, 2017

My bad, I tried to simplify the reproduction without testing it …
Indeed the get, post and get_post variables are sanitized by default since statamic 2.1.19.

At the time of opening the issue I had a form with the old variable which is not sanitized.
And remembered old times before 2.1.19

The documentation gives examples which are prone to XSS attacks

@rrelmy rrelmy changed the title from FR: Antler output should be escaped by default to FR: Antler old variable is not sanitized Aug 4, 2017

@jasonvarga jasonvarga changed the title from FR: Antler old variable is not sanitized to Antler old variable is not sanitized Aug 10, 2017

@jasonvarga jasonvarga closed this Aug 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment