Skip to content

Add note on a Content Security Policy that is WASM-compatible #248

@ezekg

Description

@ezekg

I was hitting some hard to debug WASM load issues in Chrome because I was using a restrictive CSP:

<meta
  http-equiv="content-security-policy"
  content="default-src 'self'; script-src 'self'; object-src 'none';"
/>

This resulted in the following rather confusing WASM load error:

Uncaught (in promise) StorkError: Error while loading WASM at /stork.wasm
    at new t (storkError.ts:3:5)
    at wasmManager.ts:33:13

Apparently, in Chrome, you have to add wasm-unsafe-eval or wasm-eval to load WASM:

<meta
  http-equiv="content-security-policy"
  content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval' 'wasm-eval'; object-src 'none';"
/>

One bummer is that, as far as I can tell, this is currently unsupported in Safari. Safari requires you to add unsafe-eval, which is a no-go and essentially eliminates all safeties of a good CSP.

Can we add this info to the docs for the next person?

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions