Skip to content

Commit 82ffd5d

Browse files
committed
fix: sanitize logs before feeding to p tag
1 parent 4709d17 commit 82ffd5d

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.1.8-beta-5",
3+
"version": "0.1.8-beta-6",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CICDHistory/LogStageAccordion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import DOMPurify from 'dompurify'
12
import { ZERO_TIME_STRING } from '@Common/Constants'
23
import { getTimeDifference } from '@Shared/Helpers'
34
import { LogStageAccordionProps } from './types'
@@ -63,7 +64,7 @@ const LogStageAccordion = ({
6364
className="mono fs-14 mb-0-imp cn-0 dc__word-break"
6465
// eslint-disable-next-line react/no-danger
6566
dangerouslySetInnerHTML={{
66-
__html: log,
67+
__html: DOMPurify.sanitize(log),
6768
}}
6869
/>
6970
</div>

src/Shared/Components/CICDHistory/LogsRenderer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { useParams } from 'react-router'
1818
import { useEffect, useRef, useState } from 'react'
1919
import AnsiUp from 'ansi_up'
20+
import DOMPurify from 'dompurify'
2021
import { ANSI_UP_REGEX } from '@Shared/constants'
2122
import {
2223
Progressing,
@@ -436,7 +437,7 @@ export const LogsRenderer = ({
436437
className="mono fs-14 mb-0-imp"
437438
// eslint-disable-next-line react/no-danger
438439
dangerouslySetInnerHTML={{
439-
__html: log,
440+
__html: DOMPurify.sanitize(log),
440441
}}
441442
/>
442443
</div>

0 commit comments

Comments
 (0)