hoeditor-web 2.0.103 → 2.0.104

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.
@@ -3,7 +3,7 @@
3
3
  /***/ 27856:
4
4
  /***/ (function(module) {
5
5
 
6
- /*! @license DOMPurify 2.3.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.8/LICENSE */
6
+ /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */
7
7
 
8
8
  (function (global, factory) {
9
9
  true ? module.exports = factory() :
@@ -159,7 +159,9 @@
159
159
  }
160
160
  /* Add properties to a lookup table */
161
161
 
162
- function addToSet(set, array) {
162
+ function addToSet(set, array, transformCaseFunc) {
163
+ transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
164
+
163
165
  if (setPrototypeOf) {
164
166
  // Make 'in' and truthy checks like Boolean(set.constructor)
165
167
  // independent of any properties defined on Object.prototype.
@@ -173,7 +175,7 @@
173
175
  var element = array[l];
174
176
 
175
177
  if (typeof element === 'string') {
176
- var lcElement = stringToLowerCase(element);
178
+ var lcElement = transformCaseFunc(element);
177
179
 
178
180
  if (lcElement !== element) {
179
181
  // Config presets (e.g. tags.js, attrs.js) are immutable.
@@ -302,6 +304,9 @@
302
304
  return trustedTypes.createPolicy(policyName, {
303
305
  createHTML: function createHTML(html) {
304
306
  return html;
307
+ },
308
+ createScriptURL: function createScriptURL(scriptUrl) {
309
+ return scriptUrl;
305
310
  }
306
311
  });
307
312
  } catch (_) {
@@ -325,7 +330,7 @@
325
330
  */
326
331
 
327
332
 
328
- DOMPurify.version = '2.3.8';
333
+ DOMPurify.version = '2.4.0';
329
334
  /**
330
335
  * Array of elements that DOMPurify removed during sanitation.
331
336
  * Empty if nothing was removed.
@@ -483,9 +488,27 @@
483
488
  * case Trusted Types are not supported */
484
489
 
485
490
  var RETURN_TRUSTED_TYPE = false;
486
- /* Output should be free from DOM clobbering attacks? */
491
+ /* Output should be free from DOM clobbering attacks?
492
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
493
+ */
487
494
 
488
495
  var SANITIZE_DOM = true;
496
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
497
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
498
+ *
499
+ * HTML/DOM spec rules that enable DOM Clobbering:
500
+ * - Named Access on Window (§7.3.3)
501
+ * - DOM Tree Accessors (§3.1.5)
502
+ * - Form Element Parent-Child Relations (§4.10.3)
503
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
504
+ * - HTMLCollection (§4.2.10.2)
505
+ *
506
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
507
+ * with a constant string, i.e., `user-content-`
508
+ */
509
+
510
+ var SANITIZE_NAMED_PROPS = false;
511
+ var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
489
512
  /* Keep element content when removing element? */
490
513
 
491
514
  var KEEP_CONTENT = true;
@@ -555,15 +578,29 @@
555
578
 
556
579
 
557
580
  cfg = clone(cfg);
581
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
582
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
583
+
584
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
585
+ return x;
586
+ } : stringToLowerCase;
558
587
  /* Set configuration parameters */
559
588
 
560
- ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
561
- ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
562
- URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
563
- DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
564
- FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;
565
- FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
566
- FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
589
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
590
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
591
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
592
+ cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
593
+ transformCaseFunc // eslint-disable-line indent
594
+ ) // eslint-disable-line indent
595
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
596
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
597
+ cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
598
+ transformCaseFunc // eslint-disable-line indent
599
+ ) // eslint-disable-line indent
600
+ : DEFAULT_DATA_URI_TAGS;
601
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
602
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
603
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
567
604
  USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
568
605
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
569
606
 
@@ -585,6 +622,8 @@
585
622
 
586
623
  SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
587
624
 
625
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
626
+
588
627
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
589
628
 
590
629
  IN_PLACE = cfg.IN_PLACE || false; // Default false
@@ -604,13 +643,6 @@
604
643
  CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
605
644
  }
606
645
 
607
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
608
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
609
-
610
- transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
611
- return x;
612
- } : stringToLowerCase;
613
-
614
646
  if (SAFE_FOR_TEMPLATES) {
615
647
  ALLOW_DATA_ATTR = false;
616
648
  }
@@ -656,7 +688,7 @@
656
688
  ALLOWED_TAGS = clone(ALLOWED_TAGS);
657
689
  }
658
690
 
659
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
691
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
660
692
  }
661
693
 
662
694
  if (cfg.ADD_ATTR) {
@@ -664,11 +696,11 @@
664
696
  ALLOWED_ATTR = clone(ALLOWED_ATTR);
665
697
  }
666
698
 
667
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
699
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
668
700
  }
669
701
 
670
702
  if (cfg.ADD_URI_SAFE_ATTR) {
671
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
703
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
672
704
  }
673
705
 
674
706
  if (cfg.FORBID_CONTENTS) {
@@ -676,7 +708,7 @@
676
708
  FORBID_CONTENTS = clone(FORBID_CONTENTS);
677
709
  }
678
710
 
679
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
711
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
680
712
  }
681
713
  /* Add #text in case KEEP_CONTENT is set to true */
682
714
 
@@ -1248,6 +1280,34 @@
1248
1280
  if (!_isValidAttribute(lcTag, lcName, value)) {
1249
1281
  continue;
1250
1282
  }
1283
+ /* Full DOM Clobbering protection via namespace isolation,
1284
+ * Prefix id and name attributes with `user-content-`
1285
+ */
1286
+
1287
+
1288
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1289
+ // Remove the attribute with this value
1290
+ _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
1291
+
1292
+
1293
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1294
+ }
1295
+ /* Handle attributes that require Trusted Types */
1296
+
1297
+
1298
+ if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1299
+ if (namespaceURI) ; else {
1300
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1301
+ case 'TrustedHTML':
1302
+ value = trustedTypesPolicy.createHTML(value);
1303
+ break;
1304
+
1305
+ case 'TrustedScriptURL':
1306
+ value = trustedTypesPolicy.createScriptURL(value);
1307
+ break;
1308
+ }
1309
+ }
1310
+ }
1251
1311
  /* Handle invalid data-* attribute set by try-catching it */
1252
1312
 
1253
1313
 
@@ -1318,7 +1378,8 @@
1318
1378
  // eslint-disable-next-line complexity
1319
1379
 
1320
1380
 
1321
- DOMPurify.sanitize = function (dirty, cfg) {
1381
+ DOMPurify.sanitize = function (dirty) {
1382
+ var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1322
1383
  var body;
1323
1384
  var importedNode;
1324
1385
  var currentNode;
@@ -8,12 +8,12 @@
8
8
  /* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
9
9
  var $ = __webpack_require__(82109);
10
10
  var uncurryThis = __webpack_require__(1702);
11
- var $IndexOf = (__webpack_require__(41318).indexOf);
11
+ var $indexOf = (__webpack_require__(41318).indexOf);
12
12
  var arrayMethodIsStrict = __webpack_require__(9341);
13
13
 
14
- var un$IndexOf = uncurryThis([].indexOf);
14
+ var nativeIndexOf = uncurryThis([].indexOf);
15
15
 
16
- var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
16
+ var NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;
17
17
  var STRICT_METHOD = arrayMethodIsStrict('indexOf');
18
18
 
19
19
  // `Array.prototype.indexOf` method
@@ -23,8 +23,8 @@ $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
23
23
  var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
24
24
  return NEGATIVE_ZERO
25
25
  // convert -0 to +0
26
- ? un$IndexOf(this, searchElement, fromIndex) || 0
27
- : $IndexOf(this, searchElement, fromIndex);
26
+ ? nativeIndexOf(this, searchElement, fromIndex) || 0
27
+ : $indexOf(this, searchElement, fromIndex);
28
28
  }
29
29
  });
30
30
 
@@ -68,7 +68,7 @@ var $ = __webpack_require__(82109);
68
68
  var uncurryThis = __webpack_require__(1702);
69
69
  var isArray = __webpack_require__(43157);
70
70
 
71
- var un$Reverse = uncurryThis([].reverse);
71
+ var nativeReverse = uncurryThis([].reverse);
72
72
  var test = [1, 2];
73
73
 
74
74
  // `Array.prototype.reverse` method
@@ -79,7 +79,7 @@ $({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()
79
79
  reverse: function reverse() {
80
80
  // eslint-disable-next-line no-self-assign -- dirty hack
81
81
  if (isArray(this)) this.length = this.length;
82
- return un$Reverse(this);
82
+ return nativeReverse(this);
83
83
  }
84
84
  });
85
85
 
@@ -620,7 +620,7 @@ __webpack_require__.d(__webpack_exports__, {
620
620
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.js
621
621
  var es_promise = __webpack_require__(88674);
622
622
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
623
- var asyncToGenerator = __webpack_require__(39873);
623
+ var asyncToGenerator = __webpack_require__(81448);
624
624
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
625
625
  var es_string_match = __webpack_require__(4723);
626
626
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
@@ -632,7 +632,7 @@ var es_array_iterator = __webpack_require__(66992);
632
632
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
633
633
  var web_dom_collections_iterator = __webpack_require__(33948);
634
634
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
635
- var defineProperty = __webpack_require__(7067);
635
+ var defineProperty = __webpack_require__(78255);
636
636
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.reduce.js
637
637
  var es_array_reduce = __webpack_require__(85827);
638
638
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.ends-with.js