Skip to content

Commit ef9c012

Browse files
committed
fix(security): sanitize notification HTML to
prevent XSS. Closes #3123
1 parent 4b4c9a7 commit ef9c012

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

frontend/package-lock.json

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

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"classnames": "^2.5.1",
1313
"date-fns": "^4.1.0",
1414
"date-fns-tz": "^3.2.0",
15+
"dompurify": "^3.3.1",
1516
"flag-icons": "^7.2.3",
1617
"formik": "^2.4.6",
1718
"http-proxy-middleware": "^2.0.6",

frontend/src/components/jobs/notification/NotificationsList.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import PropTypes from "prop-types";
3+
import DOMPurify from "dompurify";
34
import {
45
ListGroup,
56
ListGroupItem,
@@ -43,7 +44,9 @@ export default function NotificationsList({ notifications, refetchFn }) {
4344
</div>
4445
<ListGroupItemText
4546
className="text-light"
46-
dangerouslySetInnerHTML={{ __html: notif?.body }}
47+
dangerouslySetInnerHTML={{
48+
__html: DOMPurify.sanitize(notif?.body),
49+
}}
4750
/>
4851
<div className="d-flex">
4952
{notif?.read === false && (

0 commit comments

Comments
 (0)