patch: Add dynamic execution flag to emcc build to allow for wasm-unsafe-eval in csp #263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should help address #131
If folks set CSP policies that block
unsafe-eval
scripts (i.e use ofnew Function()
oreval()
), they may have issues rendering Rives because our WASM (built using Emscripten) that has binding code to JS includes somenew Function()
code as part of Emscripten's inner-workings around binding. There's some effort on Emscripten's side to remove some of these pieces, but the guidance for consumers as seen in this issue is to allowwasm-unsafe-eval
in the CSP. This alone however still doesn't solve everything. We need to set thisDYNAMIC_EXECUTION=0
flag to prevent the use ofnew Function()
oreval()
in Emscripten's native binding code during build. The pairing of this fix in our WASM build setup, and the consumer settingwasm-unsafe-eval
should get Rives running in web apps if it were blocked before. While not perfect, it's better than settingunsafe-eval
for sure as a content policy.If this takes, we'll document this in our JS runtimes gitbook section