Request to Remove or Address unsafe-eval
Usage in Yoga Layout
#1767
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi Yoga Layout Team,
I am currently using
@react-pdf/renderer
(version^4.1.5
) in my project, which depends onyoga-layout
. During development, I've encountered issues related to the usage ofunsafe-eval
withinyoga-layout
.Problem
The inclusion of
unsafe-eval
poses significant security risks and violates stricter Content Security Policies (CSPs), which are becoming increasingly common in modern web applications. This makes it challenging to useyoga-layout
in secure environments without relaxing CSP rules, which isn't always an acceptable solution.Steps to Reproduce
@react-pdf/renderer
(which usesyoga-layout
) into a project.unsafe-eval
.yoga-layout
.Let me know if additional details, examples, or assistance with refactoring would be helpful. Thank you for all the effort you’ve put into maintaining this essential library!
Best regards,
Michele
I didn’t look closely at this, but it seems to come from Emscripten (possibly embind), so bindings would need to change.
I have the same issue and it would be amazing to see it resolved !
I found this issue regarding
unsafe-eval
and embind https://github.com/emscripten-core/emscripten/issues/20994. It might be interesting“DYNAMIC_EXECUTION=0” may depend on moving from “embind” usage to direct calls (which last I looked should theoretically be pretty doable given we already have a stable C API).
Would also be a big performance win.
See https://github.com/facebook/yoga/issues/1545 and https://github.com/facebook/yoga/issues/1507
I looked quickly into it and it seems there are no call to
eval
andDYNAMIC_EXECUTION=0
is used in https://github.com/facebook/yoga/blob/main/javascript/CMakeLists.txt#L39The
unsafe-eval
is raised byWebAssembly.instantiate
so there is no getting around it I guessFor now the only way of running WebAssembly with CSPs is to use
wasm-unsafe-eval
since hashes are not supported