Bug 257048 - CSP: Support origins and hashes for WebAssembly
Summary: CSP: Support origins and hashes for WebAssembly
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-05-19 13:18 PDT by Rob
Modified: 2023-05-26 13:19 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rob 2023-05-19 13:18:05 PDT
My hopes for Bug 173105 were high, but sadly the only way to permit WASM in a CSP is still with either `unsafe-eval` or `wasm-unsafe-eval` (added with Bug 235408). That means that the strictest a developer can get with the CSP is to say that either all WASM or no WASM can be run. As with JavaScript, though, we (1Password) would like to limit what WASM can be run on our domain, either by request origin (for WASM streaming APIs) or by SRI hash (streaming or not).

The original proposal for this can be found here: https://github.com/WebAssembly/content-security-policy/blob/57b7b528bb5723b37e50497348e0432a7ad65c70/proposals/CSP.md#proposed-origin-bound-permission

Unfortunately, the current version of the proposal has backtracked to remove the parts about binding to the request origin or SRI hash, replacing them with a commentary on the suitability of "script-src": https://github.com/WebAssembly/content-security-policy/blob/dd75e5ba3d31aa50cda1216e7ae15170c72ce7c7/proposals/CSP.md#using-existing-csp-script-src-policies

I see the value in using a new directive like "wasm-src" instead of "script-src", but that doesn't change the need for _some_ way to bind to an origin or hash.

This issue is the WebKit counterpart to https://bugs.chromium.org/p/chromium/issues/detail?id=961485.
Comment 1 Anne van Kesteren 2023-05-22 10:48:44 PDT
This is a reasonable request, but ideally the standard changes first. From a quick search through https://github.com/w3c/webappsec-csp/issues it appears this isn't being discussed. I recommend starting a discussion there.
Comment 2 Radar WebKit Bug Importer 2023-05-26 13:19:17 PDT
<rdar://problem/109902189>