Bug 197759

Summary: Support wasm-unsafe-eval
Product: WebKit Reporter: Rob <rob>
Component: WebAssemblyAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: chi187, dave, dpaddock, fpizlo, hotaru, katherine_cheney, keith_miller, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac   
OS: macOS 10.14   
Attachments:
Description Flags
WASM and CSP test cases none

Description Rob 2019-05-09 16:48:53 PDT
The following issue mentions Chrome, but the same applies to Safari: https://github.com/WebAssembly/content-security-policy/issues/7

It's impossible to use wasm in Safari without the `unsafe-eval` directive. This proposal describes a new directive, `wasm-unsafe-eval`, that would allow executing arbitrary wasm code without having to also allow JS eval(): https://github.com/WebAssembly/content-security-policy/blob/master/proposals/CSP.md

Chrome has the following issue open to support that directive: https://bugs.chromium.org/p/chromium/issues/detail?id=948834

We would prefer to use the stream APIs with proper CSP support, but WK does not yet even have the stream functions: https://bugs.webkit.org/show_bug.cgi?id=173105

Given that and the fact that Chrome has the stream functions but not proper CSP support (https://bugs.chromium.org/p/chromium/issues/detail?id=961485), an acceptable alternative for now would be to support `wasm-unsafe-eval` in the `script-src` directive.

Note that Firefox and Edge allow wasm compilation and execution without any change to the CSP whatsoever. That behavior is effectively the same as adding `wasm-unsafe-eval` automatically. We aren't advocating that position either and would prefer to see those browsers disable wasm unless `wasm-unsafe-eval` is present or an acceptable SRI hash or origin is present.
Comment 1 Radar WebKit Bug Importer 2019-05-09 19:54:18 PDT
<rdar://problem/50649468>
Comment 2 Rob 2019-05-10 14:56:56 PDT
Created attachment 369601 [details]
WASM and CSP test cases

Here is a set of tests and a summary of major browser behavior.
Comment 3 Dasa Paddock 2021-09-29 14:59:16 PDT
It appears Chrome plans to include support for this in M96: https://groups.google.com/a/chromium.org/g/blink-dev/c/5U_SgZ3r8QI/m/pnOzK2S3BAAJ
Comment 4 Sergey Rubanov 2021-10-28 03:42:39 PDT
wasm CSP is on phase 3 now (as voted on October 26 2021 wasm CG meeting)
Comment 5 Kate Cheney 2022-03-10 11:12:08 PST

*** This bug has been marked as a duplicate of bug 235408 ***