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

Is handlebars + helpers turing complete? #1381

Closed
sethgrid opened this issue Sep 5, 2017 · 3 comments
Closed

Is handlebars + helpers turing complete? #1381

sethgrid opened this issue Sep 5, 2017 · 3 comments

Comments

@sethgrid
Copy link

sethgrid commented Sep 5, 2017

Not sure where to ask, so I thought I'd start here: Can a combination of helpers lead to a turing complete situation within a handlebars template?

I ask because, if so, then anything can be done within a handlebars template. AKA a security nightmare. One of our engineers is thinking that we might need to have a handlebars parser service that runs server side in a container or chroot situation to prevent escaping and messing up or giving access to server information.

@nknapp
Copy link
Collaborator

nknapp commented Sep 11, 2017

If you allow your users to provide custom helper from the remote, and you execute Handlebars within nodejs on your server, then you have a security problem.

Apart from that, look at #1267. It shows a way to inject code even without helpers.

@sethgrid
Copy link
Author

In our case it would be Perl and/or Go parsing the template using an approved set of handlebar helpers. Thanks for the link.

@nknapp
Copy link
Collaborator

nknapp commented Feb 19, 2019

@sethgrid Late but better than never... Starting 4.0.13 and 4.1.0, issue #1267 is fixed. So, currently there is no known possibility to execute arbitrary code, just by fabricating a template.

That does not means there is none. JavaScript is a very dynamic language and Handlebars is compiled to JavaScript after all.

@nknapp nknapp closed this as completed Feb 19, 2019
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

No branches or pull requests

2 participants