Skip to content

Commit

Permalink
fix: Fix stored XSS when rendering tooltips (#4770)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolodato authored Oct 25, 2024
1 parent b9fbe52 commit 96f62c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/web/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { FC, ReactElement, ReactNode, useRef } from 'react'
import ReactTooltip, { TooltipProps as _TooltipProps } from 'react-tooltip'
import Utils from 'common/utils/utils'
import classNames from 'classnames'
import { sanitize } from 'dompurify'

export type TooltipProps = {
title: ReactNode
Expand Down Expand Up @@ -44,7 +45,7 @@ const Tooltip: FC<TooltipProps> = ({
) : (
<div
style={{ wordBreak: 'break-word' }}
dangerouslySetInnerHTML={{ __html: children }}
dangerouslySetInnerHTML={{ __html: sanitize(children) }}
/>
)}
</ReactTooltip>
Expand Down

0 comments on commit 96f62c7

Please sign in to comment.