@descope/web-components-ui 3.27.5 → 3.27.6

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.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import MarkdownIt from 'markdown-it';
2
+ import DOMPurify from 'dompurify';
2
3
  import debounce$1 from 'lodash.debounce';
3
4
  import merge from 'lodash.merge';
4
5
  import Color from 'color';
@@ -6,7 +7,6 @@ import 'element-internals-polyfill';
6
7
  import '@vaadin/checkbox';
7
8
  import '@vaadin/text-field';
8
9
  import '@vaadin/combo-box';
9
- import DOMPurify from 'dompurify';
10
10
  import '@vaadin/button';
11
11
  import '@vaadin/popover/src/vaadin-popover';
12
12
  import '@vaadin/icons';
@@ -2574,6 +2574,16 @@ const decodeHTML = (html) => {
2574
2574
 
2575
2575
  const componentName$1B = getComponentName$1('enriched-text');
2576
2576
 
2577
+ const sanitizeConfig = {
2578
+ ADD_ATTR: ['target'],
2579
+ // Same scheme rule as markdown-it's link check, so custom-scheme links
2580
+ // (myapp://, slack://) keep working; DOMPurify's default list strips them.
2581
+ // `i` because markdown-it lowercases the URL before testing and DOMPurify does not.
2582
+ ALLOWED_URI_REGEXP:
2583
+ /^(?!(?:vbscript|javascript|file|data):)|^data:image\/(?:gif|png|jpeg|webp);/i,
2584
+ FORBID_TAGS: ['form', 'input', 'button', 'textarea', 'select', 'style'],
2585
+ };
2586
+
2577
2587
  class EnrichedText extends createBaseClass$1({
2578
2588
  componentName: componentName$1B,
2579
2589
  baseSelector: ':host > div',
@@ -2769,8 +2779,10 @@ class EnrichedText extends createBaseClass$1({
2769
2779
  console.warn('Not parsing invalid markdown token');
2770
2780
  }
2771
2781
 
2782
+ html = DOMPurify.sanitize(html, sanitizeConfig);
2783
+
2772
2784
  this.contentNode.innerHTML = html;
2773
- this.contentNode.firstChild?.setAttribute('part', 'content');
2785
+ this.contentNode.firstElementChild?.setAttribute('part', 'content');
2774
2786
  }
2775
2787
 
2776
2788
  onReadOnlyChange(isReadOnly) {