@ckeditor/ckeditor5-engine 47.7.3-alpha.0 → 47.7.4
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/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/view/domconverter.js +17 -1
package/dist/index.js
CHANGED
|
@@ -9812,9 +9812,25 @@ const UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE = 'data-ck-unsafe-element';
|
|
|
9812
9812
|
if (elementName === 'source' && attributeKey === 'srcset') {
|
|
9813
9813
|
return true;
|
|
9814
9814
|
}
|
|
9815
|
-
|
|
9815
|
+
// eslint-disable-next-line no-control-regex
|
|
9816
|
+
attributeValue = attributeValue.replace(/[\s\u0000-\u0020]+/g, '');
|
|
9817
|
+
if (attributeValue.match(/^javascript:/i)) {
|
|
9816
9818
|
return false;
|
|
9817
9819
|
}
|
|
9820
|
+
// Block all data: URIs except known-safe binary image, audio and video formats. Such a payload is
|
|
9821
|
+
// decoded by an image decoder or a media player, so it cannot execute a script - not even when
|
|
9822
|
+
// loaded in an iframe, embed or object element. Any XML-based or text-based MIME type (text/xml,
|
|
9823
|
+
// application/xml, application/xhtml+xml, text/xsl, image/svg+xml, text/html, etc.) can.
|
|
9824
|
+
//
|
|
9825
|
+
// The subtype must end at a parameter (`;`) or at the data itself (`,`) - a prefix match would let
|
|
9826
|
+
// `data:image/png+xml` through, and the HTML specification treats every `+xml` subtype as XML.
|
|
9827
|
+
if (attributeValue.match(/^data:/i)) {
|
|
9828
|
+
const isImage = attributeValue.match(/^data:image\/(png|jpeg|jpg|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon|apng|tiff|heic|heif|jxl)($|[;,])/i);
|
|
9829
|
+
const isMedia = attributeValue.match(/^data:(audio|video)\/(mp4|mpeg|mp3|ogg|webm|wav|x-wav|aac|flac|quicktime|3gpp)($|[;,])/i);
|
|
9830
|
+
if (!isImage && !isMedia) {
|
|
9831
|
+
return false;
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9818
9834
|
return true;
|
|
9819
9835
|
}
|
|
9820
9836
|
/**
|