@ckeditor/ckeditor5-engine 47.7.3 → 47.7.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-engine",
3
- "version": "47.7.3",
3
+ "version": "47.7.5-alpha.0",
4
4
  "description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
5
5
  "keywords": [
6
6
  "wysiwyg",
@@ -24,8 +24,8 @@
24
24
  "type": "module",
25
25
  "main": "src/index.js",
26
26
  "dependencies": {
27
- "@ckeditor/ckeditor5-utils": "47.7.3",
28
- "es-toolkit": "1.39.5"
27
+ "@ckeditor/ckeditor5-utils": "47.7.5-alpha.0",
28
+ "es-toolkit": "1.52.0"
29
29
  },
30
30
  "author": "CKSource (http://cksource.com/)",
31
31
  "license": "SEE LICENSE IN LICENSE.md",
@@ -217,9 +217,25 @@ export class ViewDomConverter {
217
217
  if (elementName === 'source' && attributeKey === 'srcset') {
218
218
  return true;
219
219
  }
220
- if (attributeValue.replace(/\s+/g, '').match(/^(javascript:|data:(image\/svg|text\/x?html))/i)) {
220
+ // eslint-disable-next-line no-control-regex
221
+ attributeValue = attributeValue.replace(/[\s\u0000-\u0020]+/g, '');
222
+ if (attributeValue.match(/^javascript:/i)) {
221
223
  return false;
222
224
  }
225
+ // Block all data: URIs except known-safe binary image, audio and video formats. Such a payload is
226
+ // decoded by an image decoder or a media player, so it cannot execute a script - not even when
227
+ // loaded in an iframe, embed or object element. Any XML-based or text-based MIME type (text/xml,
228
+ // application/xml, application/xhtml+xml, text/xsl, image/svg+xml, text/html, etc.) can.
229
+ //
230
+ // The subtype must end at a parameter (`;`) or at the data itself (`,`) - a prefix match would let
231
+ // `data:image/png+xml` through, and the HTML specification treats every `+xml` subtype as XML.
232
+ if (attributeValue.match(/^data:/i)) {
233
+ const isImage = attributeValue.match(/^data:image\/(png|jpeg|jpg|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon|apng|tiff|heic|heif|jxl)($|[;,])/i);
234
+ const isMedia = attributeValue.match(/^data:(audio|video)\/(mp4|mpeg|mp3|ogg|webm|wav|x-wav|aac|flac|quicktime|3gpp)($|[;,])/i);
235
+ if (!isImage && !isMedia) {
236
+ return false;
237
+ }
238
+ }
223
239
  return true;
224
240
  }
225
241
  /**