Our company was planning to use Knockoutjs but I found this link discussing security issues in KnockoutJS. They are saying that people can easily inject malicious code in data-bind attribute.
For example:
<script src="http://knockoutjs.com/downloads/knockout-2.3.0.js"></script>
<div data-bind="x:alert(1)" />
<script>
ko.applyBindings();
</script>
I do not have very good understanding about XSS attacks, and I do not know how many ways people can inject malicious code in web site.
Can anyone tell me when a page is rendered on a client PC, then how people can inject this
<div data-bind="x:alert(1)" />just to get it work? Can anyone tell me how hackers can inject this in a page opened in browser?Can anyone tell me what other security issues there are for knockoutjs?
If it is not very safe then I will not use it.
I also got links discussing a bit about how to better secure knockoutjs:
- http://brianmhunt.github.io/articles/knockout-plus-content-security-policy/
- https://github.com/brianmhunt/knockout-secure-binding
Is anyone aware how to get fully secured knockoutjs? Because I have seen the tutorial for KnockoutJS and felt the learning curve is not high.
htmlbinding. - janfoehtextbinding so it's recommended to use thetextand be very careful when using thehtmlas it allows for xss so only use it if you trust the html being output - Wayne Elleryelement.value=viewModel.value- Wayne Ellery