Skip to content

Commit ac1de61

Browse files
Fix code scanning alert no. 28: Client-side cross-site scripting
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 7c087fa commit ac1de61

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
"public-ui-test": "extest setup-tests -e ./test-resources/extensions -c max -i && npm run test:prepare && extest run-tests out/test/ui/public-ui-test.js -o test/ui/settings.json -m test/ui/.mocharc.js -e ./test-resources/extensions -c max"
7575
},
7676
"dependencies": {
77-
"shelljs": "^0.8.5"
77+
"shelljs": "^0.8.5",
78+
"dompurify": "^3.2.1"
7879
},
7980
"devDependencies": {
8081
"@codemirror/lang-yaml": "^6.1.1",

src/webview/common/devfileListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Check } from '@mui/icons-material';
66
import { Box, Chip, Stack, Tooltip, Typography } from '@mui/material';
77
import * as React from 'react';
88
import validator from 'validator';
9+
import DOMPurify from 'dompurify';
910
import DevfileLogo from '../../../images/context/devfile.png';
1011
import { DevfileData, DevfileInfo } from '../../devfile-registry/devfileInfo';
1112

@@ -18,7 +19,7 @@ export type DevfileListItemProps = {
1819

1920
function checkedDevfileLogoUrl(logoUrl?: string) {
2021
if (logoUrl && validator.isURL(logoUrl)) {
21-
return logoUrl;
22+
return DOMPurify.sanitize(logoUrl);
2223
}
2324
return DevfileLogo;
2425
}

0 commit comments

Comments
 (0)