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

Cannot load DotLottieReact player inside a web extension due to WASM CSP policy #434

Open
maxwelljmckee opened this issue Dec 17, 2024 · 1 comment

Comments

@maxwelljmckee
Copy link

maxwelljmckee commented Dec 17, 2024

Overview

I'm trying to add a lottie animation to my chrome web extension, but it fails because the CSP policy does not allow for the web assembly module to be loaded. This is the error output I'm seeing:

Primary WASM load failed from https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm. Error: Aborted(CompileError: WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because neither 'wasm-eval' nor 'unsafe-eval' is an allowed source of script in the following Content Security Policy directive: "script-src 'self'"). Build with -sASSERTIONS for more info.

However, when I add the recommended CSP specifications to my extension manifest, chrome will not allow it to be compiled due to insufficient security standards:

Failed to load extension
File
~/dev/browser_extension/dist/chrome
Error
'content_security_policy.extension_pages': Insecure CSP value "wasm-unsafe-eval" in directive 'script-src'.
Could not load manifest.

Is there a Lottie solution that doesn't use WebAssembly to load a player? Are there any workarounds for this use case?

@maxwelljmckee maxwelljmckee changed the title Cannot load DotLottieReact play inside a web extension due to WASM CSP policy Cannot load DotLottieReact player inside a web extension due to WASM CSP policy Dec 18, 2024
@theashraf
Copy link
Member

@maxwelljmckee You can have a look at this comment #337 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants