diff --git a/frontend/package.json b/frontend/package.json index ff2698953e..86e552ab78 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,6 +16,7 @@ "@microsoft/fetch-event-source": "^2.0.1", "@phosphor-icons/react": "^2.0.13", "buffer": "^6.0.3", + "dompurify": "^3.0.8", "he": "^1.2.0", "highlight.js": "^11.9.0", "lodash.debounce": "^4.0.8", diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx index f0605a3721..4637b1cd78 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/index.jsx @@ -6,6 +6,8 @@ import { userFromStorage } from "@/utils/request"; import Citations from "../Citation"; import { AI_BACKGROUND_COLOR, USER_BACKGROUND_COLOR } from "@/utils/constants"; import { v4 } from "uuid"; +import createDOMPurify from "dompurify"; +const DOMPurify = createDOMPurify(window); const HistoricalMessage = forwardRef( ( @@ -45,7 +47,9 @@ const HistoricalMessage = forwardRef( ) : ( )} diff --git a/frontend/yarn.lock b/frontend/yarn.lock index e7b223df91..c9181f15f5 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1021,6 +1021,11 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dompurify@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.0.8.tgz#e0021ab1b09184bc8af7e35c7dd9063f43a8a437" + integrity sha512-b7uwreMYL2eZhrSCRC4ahLTeZcPZxSmYfmcQGXGkXiZSNW1X85v+SDM5KsWcpivIiUBH47Ji7NtyUdpLeF5JZQ== + electron-to-chromium@^1.4.535: version "1.4.576" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.576.tgz#0c6940fdc0d60f7e34bd742b29d8fa847c9294d1"