@eshal-bot/chat-widget 0.1.115 → 0.1.116

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.
@@ -88003,6 +88003,23 @@
88003
88003
  return t;
88004
88004
  }
88005
88005
 
88006
+ /**
88007
+ * EV-2850 (WAPT) - the agent's `eshal-ui`/`eshal-chart` fence output can be
88008
+ * influenced by the end user's own message or by prompt-injection planted in
88009
+ * a knowledge-base document. A2uiBlock renders `href`/`src` values straight
88010
+ * from that JSON with no filtering - a `javascript:` action URL renders as a
88011
+ * legitimate-looking button that executes attacker JS in the visitor's page
88012
+ * when clicked (an authenticated victim's session cookie, DOM, etc. are all
88013
+ * in scope; no account needed to trigger it).
88014
+ *
88015
+ * Every `href`/`src` sink in A2uiBlock must go through this first. Only
88016
+ * absolute http(s) URLs pass; anything else (javascript:, data:, vbscript:,
88017
+ * a bare relative path, non-string) is dropped rather than rendered.
88018
+ */
88019
+ function safeUrl(u) {
88020
+ return typeof u === 'string' && /^https?:\/\//i.test(u) ? u : undefined;
88021
+ }
88022
+
88006
88023
  function A2uiBlock(_ref) {
88007
88024
  let {
88008
88025
  spec,
@@ -88669,8 +88686,8 @@
88669
88686
  display: 'flex',
88670
88687
  flexDirection: 'column'
88671
88688
  },
88672
- children: [item.image && /*#__PURE__*/jsxRuntimeExports.jsx("img", {
88673
- src: item.image,
88689
+ children: [safeUrl(item.image) && /*#__PURE__*/jsxRuntimeExports.jsx("img", {
88690
+ src: safeUrl(item.image),
88674
88691
  alt: item.name || '',
88675
88692
  referrerPolicy: "no-referrer",
88676
88693
  onError: e => {
@@ -88787,8 +88804,8 @@
88787
88804
  fontWeight: 700,
88788
88805
  fontSize: 16
88789
88806
  },
88790
- children: spec.avatar ? /*#__PURE__*/jsxRuntimeExports.jsx("img", {
88791
- src: spec.avatar,
88807
+ children: safeUrl(spec.avatar) ? /*#__PURE__*/jsxRuntimeExports.jsx("img", {
88808
+ src: safeUrl(spec.avatar),
88792
88809
  alt: spec.name || '',
88793
88810
  referrerPolicy: "no-referrer",
88794
88811
  onError: e => {
@@ -88864,9 +88881,10 @@
88864
88881
  },
88865
88882
  children: actions.map((a, i) => {
88866
88883
  const primary = a.variant !== 'secondary';
88867
- if (a.url) {
88884
+ const url = safeUrl(a.url);
88885
+ if (url) {
88868
88886
  return /*#__PURE__*/jsxRuntimeExports.jsx("a", {
88869
- href: a.url,
88887
+ href: url,
88870
88888
  target: "_blank",
88871
88889
  rel: "noopener noreferrer",
88872
88890
  style: secondaryButtonStyle(isDark, false),
@@ -89231,7 +89249,7 @@
89231
89249
  background: isDark ? '#111827' : '#f9fafb'
89232
89250
  },
89233
89251
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("img", {
89234
- src: img.url,
89252
+ src: safeUrl(img.url),
89235
89253
  alt: img.caption || "Image ".concat(i + 1),
89236
89254
  referrerPolicy: "no-referrer",
89237
89255
  onError: e => {