-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Template unsafe-eval issue #2273
Comments
There is no reason to pass user input into |
Sorry to bother but what is the whole point of _.template? Any server-side data that is relevant is often some users input. And even the angular-way of re-rendering the page every time model is updated works OK. |
@jashkenas That response is a bit abstruse... Surely it should be possible to use Also presumably user input is the reason for |
Yeah, but it won't offer protection if someone won't know about |
Not that this really needs to be argued, but no. There is a very clear distinction between the template content that you write — that's what is evaluated — and the user input that is interpolated with |
The first of all was the question of how to bypass the unsafe-eval security rule. I can't use the templates because security policy restricts me to do so. And If I will keep unsafe-eval it might grow to serious security break one day or anouther. I don't want to have unsafe policies at all BUT I want to use templates. That is the main issue. |
If the security policy prevents you from using |
Yeah, it just sounds that simple but there are limitations to those methods. But if template is evaluated in sandbox and then security-policies applied(like no inline scripts or scripts not from whitelisted sources) than there is almost no risks and no limitations to the functionality. OK, I've got the point. I will research sandbox idea and will reply on what I got. |
Would precompiling the template avoid the issue(at least for the csp side of things)? |
Precompiling and using a webworker/iframe template service would be pretty damn secure as long as you're careful whats exposed to global scope.
Probably the most practical solution for your use |
Try this one |
I'm trying to minimize/eliminate risk of XSS on my site, so I've considered to implement Content-Security-Policy
Is there a way to get rid/bypass the unsafe-eval issue or minimize the risks? I'm considering few things:
Is there any luck of implementing safe mode into default template engine? What's my options?
PS needed to search but the topic seems old. Maybe it should be the case again? It seems like sandbox-mode should be fine.
The text was updated successfully, but these errors were encountered: