-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
2.6-csp branch to support inline-templates with CSP enabled #9895
Comments
I have tried to apply notevil by following this commit 94cf00d which was done in the vue 1.28-csp branch. I have copied the notevil.js file from the commit above and added the commits from notevil@1.1.0 to it: mmckegg/notevil@939b3f6 This results in an error (with or without the 1.1.0 code):
With statements are still present in Vue code: I found this issue concerning them: #4115 (comment) I have tried the following in my dev env which has CSP enabled, but also did not render anything (probably expected behaviour as nothing is returned when with statements are encountered):
As I mentioned there are no visible errors and nothing renders. The DOM is removed but Vue did not replace it with it's own DOM. When using breakpoints in Firefox I find the following error: It would be awesome if someone with a little more knowledge of inner workings of Vue and/or notevil could work out how to fix this. |
Also opened an issue at the notevil repo: mmckegg/notevil#33 |
Did not find any information regarding CSP in the vue3 guide, was this resolved or is this part missing? |
What problem does this feature solve?
Using inline-templates when CSP is enabled is currently impossible due to new Function() being used in the compiler in the full build.
In all posts that I could find regarding this issue the runtime only build is suggested. However when you are working on a project where you cannot move all templates to render functions, or precompile to render functions, this is not possible.
To us inline-templates are a very important part of the "progressive framework" idea. This allows us to utilize the full power of Vue while not forcing a refactor upon our entire backend to use API's when we want to upgrade Vue to v2 (even though they ideally should).
For Vue 1.28 there is a specific csp branch which utilises notevil. I want to do the same for Vue 2.6.
I will try to provide a working fork, although I could use some help on this (it's my first time working with the vue source code)
What does the proposed API look like?
1 branch, v2.6.x-csp, will be made where
new Function()
will be replaced bynotevil.Function()
to safely eval expressions.Just like v1.28-csp, notevil will be included in the codebase.
Currently I have found
new Function()
in src/compiler/to-function.js:15 38 and src/compiler/no-error.js:86 95 which have to be refactored tonotevil.Function()
calls.The text was updated successfully, but these errors were encountered: