Skip to content

TagSpaces is an offline, open source, document manager with tagging support

using dompurify for file and folder description content

Ilian Sapundshiev0ec46e12a9ca
diff --git a/app/components/EntryProperties.js b/app/components/EntryProperties.js
index f8421b31e..213769866 100644
--- a/app/components/EntryProperties.js
+++ b/app/components/EntryProperties.js
@@ -26,6 +26,7 @@ import Typography from '@material-ui/core/Typography';
import TextField from '@material-ui/core/TextField';
import Paper from '@material-ui/core/Paper';
import Button from '@material-ui/core/Button';
+import DOMPurify from 'dompurify';
import TagContainer from './TagContainer';
import TagDropContainer from './TagDropContainer';
import EntryTagMenu from './menus/EntryTagMenu';
@@ -550,7 +551,7 @@ class EntryProperties extends Component<Props, State> {
dangerouslySetInnerHTML={{
__html:
description !== ''
- ? marked(description)
+ ? marked(DOMPurify.sanitize(description))
: Pro ? 'Click to add description' : i18n.t('core:addDescription')
}}
onClick={() => {
diff --git a/package.json b/package.json
index 3c2e46d4f..ce615c30b 100644
--- a/package.json
+++ b/package.json
@@ -183,6 +183,7 @@
"aws-sdk": "^2.263.1",
"chokidar": "^2.0.4",
"classnames": "^2.2.5",
+ "dompurify": "^1.0.8",
"electron-debug": "^2.0.0",
"electron-window-state": "^5.0.2",
"exif-js": "^2.3.0",