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

Make DotVVM CSP compliant #275

Open
djanosik opened this issue Nov 29, 2016 · 3 comments
Open

Make DotVVM CSP compliant #275

djanosik opened this issue Nov 29, 2016 · 3 comments

Comments

@djanosik
Copy link
Contributor

djanosik commented Nov 29, 2016

As of now every DotVVM application uses inline scripts and unsafe functions like new Function(...), eval(...), setTimeout(string), etc. It means you need to specify unsafe-inline and unsafe-eval options when you want to use CSP header to make your application secure.

This makes CSP practically useless and we should think about how to use DotVVM along with CSP restrictions.

I suggest to:

  • remove all inline scripts (how to handle templates?),
  • remove all inline event handlers, onclick, etc. (we will need to modify all controls),
  • make sure our knockout expressions work with tko.provider.
@tomasherceg tomasherceg added this to the DotVVM 2.0 Maybe milestone May 23, 2017
@exyi exyi removed the wontfix label Jul 15, 2017
@exyi
Copy link
Member

exyi commented Jul 15, 2017

I think we could use the in the script-src header to get rid of unsafe-inline and do it completely automatically using the resource system. The unsafe-eval condition is unfortunately not relaxed, but we could at least modify knockout.js to check hashes of the evaluated before evaluating them so that data-bind injection would not work.

The second step could be made with the VDOM upgrade #383, maybe it will be possible to eliminate the unsafe-eval condition and render all bindings in a render script.

@quigamdev quigamdev modified the milestones: DotVVM 2.0 Maybe, Future Sep 18, 2017
@exyi exyi modified the milestones: Future, VDOM Update Sep 26, 2017
@exyi
Copy link
Member

exyi commented Jan 6, 2018

Btw, nice post "why would you want CSP" - https://hackernoon.com/im-harvesting-credit-card-numbers-and-passwords-from-your-site-here-s-how-9a8cb347c5b5. Although it's not a perfect protection, it may help a lot.

@exyi
Copy link
Member

exyi commented Nov 4, 2021

https://content-security-policy.com/strict-dynamic/

With strict-dynamic in CSP 3 we might be actually able to finally implement it. This would solve the problem of loading new scripts / knockout expressions after a postback

@exyi exyi modified the milestones: VDOM Update, Version 5.0 Nov 5, 2021
@exyi exyi modified the milestones: Version 5.0, Future Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants