@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.
@@ -4222,6 +4222,16 @@ const decodeHTML = (html) => {
4222
4222
 
4223
4223
  const componentName$1s = getComponentName('enriched-text');
4224
4224
 
4225
+ const sanitizeConfig = {
4226
+ ADD_ATTR: ['target'],
4227
+ // Same scheme rule as markdown-it's link check, so custom-scheme links
4228
+ // (myapp://, slack://) keep working; DOMPurify's default list strips them.
4229
+ // `i` because markdown-it lowercases the URL before testing and DOMPurify does not.
4230
+ ALLOWED_URI_REGEXP:
4231
+ /^(?!(?:vbscript|javascript|file|data):)|^data:image\/(?:gif|png|jpeg|webp);/i,
4232
+ FORBID_TAGS: ['form', 'input', 'button', 'textarea', 'select', 'style'],
4233
+ };
4234
+
4225
4235
  class EnrichedText extends createBaseClass$1({
4226
4236
  componentName: componentName$1s,
4227
4237
  baseSelector: ':host > div',
@@ -4417,8 +4427,10 @@ class EnrichedText extends createBaseClass$1({
4417
4427
  console.warn('Not parsing invalid markdown token');
4418
4428
  }
4419
4429
 
4430
+ html = DOMPurify.sanitize(html, sanitizeConfig);
4431
+
4420
4432
  this.contentNode.innerHTML = html;
4421
- this.contentNode.firstChild?.setAttribute('part', 'content');
4433
+ this.contentNode.firstElementChild?.setAttribute('part', 'content');
4422
4434
  }
4423
4435
 
4424
4436
  onReadOnlyChange(isReadOnly) {