Skip to content

CSP compliant build #334

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

Closed
yyx990803 opened this issue Jul 1, 2014 · 5 comments · Fixed by turkdevops/vue#1 · 4 remaining pull requests
Closed

CSP compliant build #334

yyx990803 opened this issue Jul 1, 2014 · 5 comments · Fixed by turkdevops/vue#1 · 4 remaining pull requests

Comments

@yyx990803
Copy link
Member

Basically use a different exp-parser that uses Esprima. Since size doesn't matter that much in CSP-enforcing environments, the extra code is an acceptable tradeoff.

@cecchi
Copy link

cecchi commented Jul 1, 2014

I'd also consider acorn.js as an alternative, potentially slightly faster, parser to Esprima.

I played with shimming/modifying exp-parser today but couldn't get far. Esprima/Acorn are solid for parsing javascript syntax into an object or even instrumenting it as a string, but doesn't get us much closer to the goal of actually executing it without a breaking a strict "unsafe-eval" CSP.

Maybe I'm missing something -- any ideas?

@yyx990803
Copy link
Member Author

I haven't got time to dig into this yet, but take a look at https://github.com/substack/static-eval and https://github.com/polymer/polymer-expressions

@cecchi
Copy link

cecchi commented Jul 1, 2014

Definitely useful; thanks for the references.

@cecchi
Copy link

cecchi commented Jul 3, 2014

For what it's worth, I was able to get it working in a strict CSP environment using a "browserified" version of the "notevil" package.

I don't have the time right now to test it thoroughly and it could be heavily optimized, but it get's the job done for anyone looking for a quick and dirty solution. It may be a good starting point for a more complete implementation.

Commit: cecchi@d1caa52

@yyx990803
Copy link
Member Author

0.11 CSP compliant build is now available in the csp branch: https://github.com/yyx990803/vue/tree/csp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment