-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Content Security Policy | ||
|
||
## WebAssembly CSP | ||
|
||
InfiSearch runs using WebAssembly. If you are using a restrictive content security policy, WebAssembly as a whole currently unfortunately requires adding the `script-src: 'unsafe-eval';` directive. | ||
|
||
This error will show up in chrome for example as the following extremely detailed error message: | ||
|
||
|
||
> Uncaught (in promise) CompileError: WebAssembly.instantiateStreaming(): | ||
> Refused to compile or instantiate WebAssembly module because 'unsafe-eval' | ||
> is not an allowed source of script in the following Content Security Policy directive: '...' | ||
Support for a more specific `script-src: 'wasm-unsafe-eval';` directive has landed in Chrome, Edge and Firefox, but is still pending in Safari. | ||
|
||
## WebWorker CSP | ||
|
||
InfiSearch also utilises a [blob URL](https://stackoverflow.com/questions/30864573/what-is-a-blob-url-and-why-it-is-used) to load its WebWorker. This shouldn't pose as much of a security concern since blob URLs can only be created by scripts already executing within the browser. | ||
|
||
To whitelist this, add the `script-src: blob:;` directive. | ||
|
||
## CDN CSP | ||
|
||
Naturally, if you load InfiSearch assets from CDN, you will also need to whitelist this in the `script-src: cdn.jsdelivr.net;` and `style-src: cdn.jsdelivr.net;` directives. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters