Skip to content

Commit b302a00

Browse files
Fix code scanning alert no. 3: DOM text reinterpreted as HTML (#1545)
Signed-off-by: Priyankar Pal <[email protected]> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent d7bfc6d commit b302a00

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/plays/custommemesgenerator/Meme.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import axios from 'axios';
3+
import DOMPurify from 'dompurify';
34

45
export default function Meme() {
56
const [memesData, setMemesData] = useState([]);
@@ -27,6 +28,7 @@ export default function Meme() {
2728
const memesArray = memesData;
2829
let randomIndex = Math.floor(Math.random() * memesArray.length);
2930
let newUrl = memesArray[randomIndex].url;
31+
newUrl = DOMPurify.sanitize(newUrl);
3032

3133
setMeme((prevMeme) => ({
3234
...prevMeme,

0 commit comments

Comments
 (0)