javascript - How do I remedy Browser CSP errors when using underscore.js -


i have been working on web application past couple of years , have gone make more secure adding content security policy.

i have been able remedy of issues have found, have been unable solve 1 remaining issue. csp complains error message whenever templating occurs in underscore.js believe makes use of no-no; being js code "new function(...)".

i have seen other recommendations on web, being basically:

  • use engine precompile template, eg grunt-inline-template-compile useful when have template strings inline, mine in actual html in tags, wouldn't possible without drastic content moving around.
  • switch templating engine, option more appealing previous afraid break many lines of templating syntax of underscore , huge job in itself.

are there other options people aware of?

try setting content-security-policy header unsafe-eval scripts domain temporary workaround. http://content-security-policy.com/ move template engine such handlebars possible. can have templates in separate html files , compile them javascript part of build. gives nice separation between html , js develop performance in browser users in production version


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -