CVE-2024-38527: Insufficient Information (NVD-CWE-noinfo)
value: ZenUML is JavaScript-based diagramming tool that requires no server, using Markdown-inspired text definitions and a renderer to create and modify sequence diagrams. Markdown-based comments in the ZenUML diagram syntax are susceptible to Cross-site Scripting (XSS). The comment feature allows the user to attach small notes for reference. This feature allows the user to enter in their comment in markdown comment, allowing them to use common markdown features, such as `**` for bolded text. However, the markdown text is currently not sanitized before rendering, allowing an attacker to enter a malicious payload for the comment which leads to XSS. This puts existing applications that use ZenUML unsandboxed at risk of arbitrary JavaScript execution when rendering user-controlled diagrams. This vulnerability was patched in version 3.23.25,
CWE description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
Published: 2024-06-26T20:15Z
Repository: https://github.com/mermaid-js/zenuml-core
Language: JSON
Files changed: package.json, pnpm-lock.yaml, src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Comment/Comment.vue
Commit date: 2024-06-26 14:46:28 +1000
Commit message: Fixed an XSS vulnerability.

Diff: diff --git a/package.json b/package.json
index 48cb234d..abd8b66e 100644
--- a/package.json
+++ b/package.json
@@ -47,10 +47,11 @@
     "@types/ramda": "^0.28.20",
     "@vue/compat": "^3.4.27",
     "antlr4": "~4.11.0",
     "color-string": "^1.5.5",
     "dom-to-image-more": "^2.13.0",
+    "dompurify": "^3.1.5",
     "file-saver": "^2.0.5",
     "highlight.js": "^10.7.3",
     "html-to-image": "^1.11.3",
     "lodash": "^4.17.21",
     "marked": "^4.0.10",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index be7c23bb..f3787a5c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -26,10 +26,13 @@ dependencies:
     specifier: ^1.5.5
     version: 1.5.5
   dom-to-image-more:
     specifier: ^2.13.0
     version: 2.13.0
+  dompurify:
+    specifier: ^3.1.5
+    version: 3.1.5
   file-saver:
     specifier: ^2.0.5
     version: 2.0.5
   highlight.js:
     specifier: ^10.7.3
@@ -78,11 +81,11 @@ devDependencies:
   "@types/lodash":
     specifier: ^4.14.191
     version: 4.14.191
   "@types/node":
     specifier: latest
-    version: 20.13.0
+    version: 20.14.9
   "@typescript-eslint/eslint-plugin":
     specifier: ^6.7.4
     version: 6.7.4(@typescript-eslint/parser@6.7.4)(eslint@8.30.0)(typescript@4.9.4)
   "@typescript-eslint/parser":
     specifier: ^6.7.4
@@ -159,17 +162,17 @@ devDependencies:
   terser-webpack-plugin:
     specifier: ^3.1.0
     version: 3.1.0(webpack@5.91.0)
   ts-node:
     specifier: ^10.9.1
-    version: 10.9.1(@types/node@20.13.0)(typescript@4.9.4)
+    version: 10.9.1(@types/node@20.14.9)(typescript@4.9.4)
   typescript:
     specifier: ^4.9.4
     version: 4.9.4
   vite:
     specifier: ^3.2.10
-    version: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
+    version: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
   vite-plugin-css-injected-by-js:
     specifier: ^2.2.0
     version: 2.2.0(vite@3.2.10)
   vite-svg-loader:
     specifier: ^4.0.0
@@ -2960,14 +2963,14 @@ packages:
       {
         integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==,
       }
     dev: true
 
-  /@types/node@20.13.0:
+  /@types/node@20.14.9:
     resolution:
       {
-        integrity: sha512-FM6AOb3khNkNIXPnHFDYaHerSv8uN22C91z098AnGccVu+Pcdhi+pNUFDi0iLmPIsVE0JBD0KVS7mzUYt4nRzQ==,
+        integrity: sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==,
       }
     dependencies:
       undici-types: 5.26.5
 
   /@types/ramda@0.28.20:
@@ -3005,11 +3008,11 @@ packages:
       {
         integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==,
       }
     requiresBuild: true
     dependencies:
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
     dev: true
     optional: true
 
   /@typescript-eslint/eslint-plugin@6.7.4(@typescript-eslint/parser@6.7.4)(eslint@8.30.0)(typescript@4.9.4):
     resolution:
@@ -3174,11 +3177,11 @@ packages:
     engines: { node: ^14.18.0 || >=16.0.0 }
     peerDependencies:
       vite: ^4.0.0
       vue: ^3.2.25
     dependencies:
-      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
+      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
       vue: 3.4.27(typescript@4.9.4)
     dev: true
 
   /@vue/compat@3.4.27(vue@3.4.27):
     resolution:
@@ -5083,10 +5086,17 @@ packages:
     engines: { node: ">= 4" }
     dependencies:
       domelementtype: 2.3.0
     dev: true
 
+  /dompurify@3.1.5:
+    resolution:
+      {
+        integrity: sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA==,
+      }
+    dev: false
+
   /domutils@3.1.0:
     resolution:
       {
         integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==,
       }
@@ -6931,11 +6941,11 @@ packages:
       {
         integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==,
       }
     engines: { node: ">= 10.13.0" }
     dependencies:
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
       merge-stream: 2.0.0
       supports-color: 7.2.0
     dev: true
 
   /jest-worker@27.5.1:
@@ -6943,11 +6953,11 @@ packages:
       {
         integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==,
       }
     engines: { node: ">= 10.13.0" }
     dependencies:
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
       merge-stream: 2.0.0
       supports-color: 8.1.1
     dev: true
 
   /jimp@0.10.3:
@@ -8363,11 +8373,11 @@ packages:
       ts-node:
         optional: true
     dependencies:
       lilconfig: 2.0.6
       postcss: 8.4.31
-      ts-node: 10.9.1(@types/node@20.13.0)(typescript@4.9.4)
+      ts-node: 10.9.1(@types/node@20.14.9)(typescript@4.9.4)
       yaml: 1.10.2
     dev: false
 
   /postcss-nested@6.0.0(postcss@8.4.31):
     resolution:
@@ -9729,11 +9739,11 @@ packages:
       typescript: ">=4.2.0"
     dependencies:
       typescript: 4.9.4
     dev: true
 
-  /ts-node@10.9.1(@types/node@20.13.0)(typescript@4.9.4):
+  /ts-node@10.9.1(@types/node@20.14.9)(typescript@4.9.4):
     resolution:
       {
         integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==,
       }
     hasBin: true
@@ -9751,11 +9761,11 @@ packages:
       "@cspotcode/source-map-support": 0.8.1
       "@tsconfig/node10": 1.0.9
       "@tsconfig/node12": 1.0.11
       "@tsconfig/node14": 1.0.3
       "@tsconfig/node16": 1.0.3
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
       acorn: 8.8.1
       acorn-walk: 8.2.0
       arg: 4.1.3
       create-require: 1.1.1
       diff: 4.0.2
@@ -10061,11 +10071,11 @@ packages:
       assert-plus: 1.0.0
       core-util-is: 1.0.2
       extsprintf: 1.3.0
     dev: true
 
-  /vite-node@0.26.1(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0):
+  /vite-node@0.26.1(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0):
     resolution:
       {
         integrity: sha512-5FJSKZZJz48zFRKHE55WyevZe61hLMQEsqGn+ungfd60kxEztFybZ3yG9ToGFtOWNCCy7Vn5EVuXD8bdeHOSdw==,
       }
     engines: { node: ">=v14.16.0" }
@@ -10074,11 +10084,11 @@ packages:
       debug: 4.3.4(supports-color@8.1.1)
       mlly: 1.0.0
       pathe: 0.2.0
       source-map: 0.6.1
       source-map-support: 0.5.21
-      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
+      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
     transitivePeerDependencies:
       - "@types/node"
       - less
       - sass
       - stylus
@@ -10093,11 +10103,11 @@ packages:
         integrity: sha512-SRGuyY1WUHj7cPzv7AIE0bG5Cb+vioxuq3CkFc1j0b8z5Cy3rXLG8SwxjriylFcZAY7tH2jU4i1bsCJRE/ou6g==,
       }
     peerDependencies:
       vite: ">2.0.0-0"
     dependencies:
-      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
+      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
     dev: true
 
   /vite-svg-loader@4.0.0:
     resolution:
       {
@@ -10106,11 +10116,11 @@ packages:
     dependencies:
       "@vue/compiler-sfc": 3.4.27
       svgo: 3.0.2
     dev: true
 
-  /vite@3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0):
+  /vite@3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0):
     resolution:
       {
         integrity: sha512-Dx3olBo/ODNiMVk/cA5Yft9Ws+snLOXrhLtrI3F4XLt4syz2Yg8fayZMWScPKoz12v5BUv7VEmQHnsfpY80fYw==,
       }
     engines: { node: ^14.18.0 || >=16.0.0 }
@@ -10134,11 +10144,11 @@ packages:
       sugarss:
         optional: true
       terser:
         optional: true
     dependencies:
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
       esbuild: 0.15.18
       less: 4.1.3
       postcss: 8.4.31
       resolve: 1.22.1
       rollup: 2.79.1
@@ -10172,11 +10182,11 @@ packages:
       jsdom:
         optional: true
     dependencies:
       "@types/chai": 4.3.4
       "@types/chai-subset": 1.3.3
-      "@types/node": 20.13.0
+      "@types/node": 20.14.9
       acorn: 8.8.1
       acorn-walk: 8.2.0
       chai: 4.3.7
       debug: 4.3.4(supports-color@8.1.1)
       jsdom: 20.0.3
@@ -10184,12 +10194,12 @@ packages:
       source-map: 0.6.1
       strip-literal: 1.0.0
       tinybench: 2.3.1
       tinypool: 0.3.0
       tinyspy: 1.0.2
-      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
-      vite-node: 0.26.1(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
+      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
+      vite-node: 0.26.1(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
     transitivePeerDependencies:
       - less
       - sass
       - stylus
       - sugarss
diff --git a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Comment/Comment.vue b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Comment/Comment.vue
index 00b2fb09..3076e96e 100644
--- a/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Comment/Comment.vue
+++ b/src/components/DiagramFrame/SeqDiagram/MessageLayer/Block/Statement/Comment/Comment.vue
@@ -6,10 +6,12 @@
   </div>
 </template>
 
 <script type="text/babel">
 import { marked } from "marked";
+import DOMPurify from "dompurify";
+
 import highlightjs from "highlight.js/lib/core";
 
 // Languages import
 import plaintext from "highlight.js/lib/languages/plaintext";
 import javascript from "highlight.js/lib/languages/javascript";
@@ -59,14 +61,14 @@ marked.use({ renderer });
 export default {
   name: "comment",
   props: ["comment", "commentObj"],
   computed: {
     markedComment() {
-      return (
+      const dirtyHTML =
         (this.commentObj?.text && marked.parse(this.commentObj?.text)) ||
-        (this.comment && marked.parse(this.comment))
-      );
+        (this.comment && marked.parse(this.comment));
+      return DOMPurify.sanitize(dirtyHTML);
     },
     commentStyle() {
       return this.commentObj?.commentStyle;
     },
     classNames() {

Vulnerable code:     version: 20.13.0
    version: 10.9.1(@types/node@20.13.0)(typescript@4.9.4)
    version: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
  /@types/node@20.13.0:
        integrity: sha512-FM6AOb3khNkNIXPnHFDYaHerSv8uN22C91z098AnGccVu+Pcdhi+pNUFDi0iLmPIsVE0JBD0KVS7mzUYt4nRzQ==,
      "@types/node": 20.13.0
      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
      "@types/node": 20.13.0
      "@types/node": 20.13.0
      ts-node: 10.9.1(@types/node@20.13.0)(typescript@4.9.4)
  /ts-node@10.9.1(@types/node@20.13.0)(typescript@4.9.4):
      "@types/node": 20.13.0
  /vite-node@0.26.1(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0):
      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
  /vite@3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0):
      "@types/node": 20.13.0
      "@types/node": 20.13.0
      vite: 3.2.10(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
      vite-node: 0.26.1(@types/node@20.13.0)(less@4.1.3)(sass@1.57.0)
      return (
        (this.comment && marked.parse(this.comment))
      );
Fixed code:     "dompurify": "^3.1.5",
  dompurify:
    specifier: ^3.1.5
    version: 3.1.5
    version: 20.14.9
    version: 10.9.1(@types/node@20.14.9)(typescript@4.9.4)
    version: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
  /@types/node@20.14.9:
        integrity: sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==,
      "@types/node": 20.14.9
      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
  /dompurify@3.1.5:
    resolution:
      {
        integrity: sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA==,
      }
    dev: false

      "@types/node": 20.14.9
      "@types/node": 20.14.9
      ts-node: 10.9.1(@types/node@20.14.9)(typescript@4.9.4)
  /ts-node@10.9.1(@types/node@20.14.9)(typescript@4.9.4):
      "@types/node": 20.14.9
  /vite-node@0.26.1(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0):
      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
  /vite@3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0):
      "@types/node": 20.14.9
      "@types/node": 20.14.9
      vite: 3.2.10(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
      vite-node: 0.26.1(@types/node@20.14.9)(less@4.1.3)(sass@1.57.0)
import DOMPurify from "dompurify";

      const dirtyHTML =
        (this.comment && marked.parse(this.comment));
      return DOMPurify.sanitize(dirtyHTML);