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

Form submission data doesn't get sanitized while being viewed in the CP #1796

Closed
aryehraber opened this Issue Feb 22, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@aryehraber

aryehraber commented Feb 22, 2018

Expected behaviour

A form submission with a code snippet won't execute while being viewed in the CP.

Actual behaviour

A form submission with a code snippet does execute in the CP.

Steps to reproduce

Formset:

fields:
  name:
    display: Full Name
  message:
    display: Message

Submission:

name: John Doe
message: |
  <script>
    alert('boom')
  </script>

Note

Had a 'real world' issue this morning where a visitor had submitted the following snippet (not with malicious intent) which caused the browser to redirect (and 404) whenever the form listing page was accessed. The comments field was added as a column, so was also getting executed there.

comments: |
  ...

  <!DOCTYPE html>
  <html>
  <meta http-equiv="Refresh" content="0; URL=/ui/login.jsf"/>
  <body></body>
  </html>
@jackmcdade

This comment has been minimized.

Show comment
Hide comment
@jackmcdade

jackmcdade Feb 23, 2018

Member

Hey nice catch. Curious that didn't get sanitized on the submission itself though. Very strange indeed. Fixed for next release!

Member

jackmcdade commented Feb 23, 2018

Hey nice catch. Curious that didn't get sanitized on the submission itself though. Very strange indeed. Fixed for next release!

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 12, 2018

Member

@aryehraber What Statamic version was this using?

Member

jasonvarga commented Mar 12, 2018

@aryehraber What Statamic version was this using?

@aryehraber

This comment has been minimized.

Show comment
Hide comment
@aryehraber

aryehraber Mar 12, 2018

@jasonvarga Pretty sure this was on latest at the time (so may well be a minor version or 2 ago)

If needed, can double check tomorrow.

aryehraber commented Mar 12, 2018

@jasonvarga Pretty sure this was on latest at the time (so may well be a minor version or 2 ago)

If needed, can double check tomorrow.

@jasonvarga

This comment has been minimized.

Show comment
Hide comment
@jasonvarga

jasonvarga Mar 12, 2018

Member

If you submit that HTML, does it still get saved to the YAML file unsanitized?

Member

jasonvarga commented Mar 12, 2018

If you submit that HTML, does it still get saved to the YAML file unsanitized?

@aryehraber

This comment has been minimized.

Show comment
Hide comment
@aryehraber

aryehraber Mar 12, 2018

Will try and test this week and get back to you!

aryehraber commented Mar 12, 2018

Will try and test this week and get back to you!

@jasonvarga jasonvarga closed this Mar 12, 2018

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