TagSpaces is an offline, open source, document manager with tagging support
chore: added sanitazation for map attribute
Ilian Sapundshiev6baa59d97c12
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsxindex 6c6997de4..030cb32bd 100644--- a/src/renderer/components/EntryProperties.tsx+++ b/src/renderer/components/EntryProperties.tsx@@ -58,6 +58,7 @@ import {fileNameValidation,getAllTags,openUrl,+ sanitizeAttribution,} from '-/services/utils-io';import { TS } from '-/tagspaces.namespace';import { generateClipboardLink } from '-/utils/dom';@@ -605,7 +606,7 @@ function EntryProperties({ tileServer }: Props) {>{tileServer ? (<ElectronTileLayer- attribution={tileServer.serverInfo}+ attribution={sanitizeAttribution(tileServer.serverInfo)}url={tileServer.serverURL}/>) : (diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex 40cd093b8..2472dcefc 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -722,6 +722,13 @@ export function openUrl(url: string): void {}}+export function sanitizeAttribution(html: string | undefined): string {+ return DOMPurify.sanitize(html ?? '', {+ ALLOWED_TAGS: ['a', 'b', 'i', 'em', 'strong', 'span'],+ ALLOWED_ATTR: ['href', 'title', 'target', 'rel'],+ });+}+export function openURLExternally(url: string, skipConfirmation = false) {if (skipConfirmation) {openUrl(url);