Commit dd533f9
[OGUI-1861] Allow
- Update Content-Security-Policy to permit `blob:` URLs for images only.
The changes allow for Blob-based images to be previewed or downloaded.
Other Blob types such as `script-src` are not permitted, mainly to prevent unwanted code execution via:
```js
const blob = new Blob(['console.log(\'executed\')'], { type: 'application/javascript' });
```
By default, Helmet's CSP middleware allows `"'self'", "data:"` in `img-src`, see: https://github.com/helmetjs/helmet/blob/dd6e18f735d61248f654df3960da80db7fb2120a/middlewares/content-security-policy/index.ts#L63.
Do note that `blob:` URLs are entirely local to the browser. When you create a blob URL using `URL.createObjectURL(blob)`, the browser generates an internal reference to an in-memory `Blob` or `MediaSource` object. It cannot be used to fetch resources from another website. For more information, please see the documentation: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/blob
---------
Co-authored-by: George Raduta <[email protected]>blob: in img-src CSP (#3237)1 parent 0a6b618 commit dd533f9
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | | - | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| 160 | + | |
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
| |||
0 commit comments