-
Notifications
You must be signed in to change notification settings - Fork 33
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
add CSP policy note #78
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should explain more why script-src
suffices here and perhaps also how this is different from importing JSON.
I think the idea is that JavaScript module scripts and Wasm module scripts would have equivalent power in terms of API access and therefore treating them as interchangeable is okay. From the JS side that's at least supported by JS having pretty much full Wasm access. I don't really know how Wasm module scripts are going to work, but last I checked they were not really limited in any capacity.
Given import {foo} from "./myModule.wasm";
perhaps the idea is they would not at all be a different type from JavaScript module scripts?
Wasm modules are more limited than JS modules because they do not have direct access to the JS global object and to the DOM, however:
Due to (1) it would be possible to have a more relaxed policy for Wasm, but its fallback should definitely be script-src and thus I agree it makes sense as a starting point. |
|
That makes me think they should be a separate type from JavaScript module scripts then.
I think that would mean these things:
|
@annevk this is a great point, I agree with you about the |
Adding to what @guybedford said, it seems like, if we succeed with enabling tight WebAssembly+JS/Web-platform integration (enabled by ESM-integration and perhaps one day built-in modules and Web IDL reflected as built-in modules), then |
I don't think that follows from what was said above. If your |
Wasm may not have a built-in global object, but it's easy enough for wasm to get a hold of the global object (literally as an |
You'd have to constrain via |
It is also worth noting WebAssembly may well be enabling builtins to be provided through the default ESM integration compilation in future for example via https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md#using-builtins, where the compilation under the ESM integration would in future enable features like this. String functions likely aren't a security concern, but this list may well grow in functionality in place of the intrinsic and global access JS has already. |
Isn't the sandboxed compute environment for WASM similar to shadow realms in terms of capability? I'm not sure if qualifying this as a wasm vs script feature is the right approach, perhaps there should be a policy for sandboxed execution, whether it's wasm or js. |
Maybe? From our perspective it's important that different module formats have different identifiers and cannot be interchanged (except perhaps if you explicitly opt into that). |
Since the Wasm CSP proposal is Phase 3, it seems prudent to make a note now as to how the ESM Integration interacts with the CSP proposal. Depending on which progresses into the spec first, the correct rebasing of specification can then happen at that time, but at least this ensures there is no ambiguity in this area for now as implementations seek to progress.