mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
security: svg xss fix
This commit is contained in:
parent
a0e323b89b
commit
750a659a9f
1 changed files with 39 additions and 1 deletions
|
|
@ -49,7 +49,45 @@
|
||||||
|
|
||||||
<div bind:this={sceneParentElement} class="relative {className}">
|
<div bind:this={sceneParentElement} class="relative {className}">
|
||||||
<div bind:this={sceneElement} class="flex h-full max-h-full justify-center items-center">
|
<div bind:this={sceneElement} class="flex h-full max-h-full justify-center items-center">
|
||||||
{@html svg}
|
{@html DOMPurify.sanitize(svg, {
|
||||||
|
USE_PROFILES: { svg: true, svgFilters: true }, // allow <svg>, <defs>, <filter>, etc.
|
||||||
|
WHOLE_DOCUMENT: false,
|
||||||
|
ADD_TAGS: ['style', 'foreignObject'], // include foreignObject if using HTML labels
|
||||||
|
ADD_ATTR: [
|
||||||
|
'class',
|
||||||
|
'style',
|
||||||
|
'id',
|
||||||
|
'data-*',
|
||||||
|
'viewBox',
|
||||||
|
'preserveAspectRatio',
|
||||||
|
// markers / arrows
|
||||||
|
'markerWidth',
|
||||||
|
'markerHeight',
|
||||||
|
'markerUnits',
|
||||||
|
'refX',
|
||||||
|
'refY',
|
||||||
|
'orient',
|
||||||
|
// hrefs (for gradients, markers, etc.)
|
||||||
|
'href',
|
||||||
|
'xlink:href',
|
||||||
|
// text positioning
|
||||||
|
'dominant-baseline',
|
||||||
|
'text-anchor',
|
||||||
|
// pattern / clip / mask units
|
||||||
|
'clipPathUnits',
|
||||||
|
'filterUnits',
|
||||||
|
'patternUnits',
|
||||||
|
'patternContentUnits',
|
||||||
|
'maskUnits',
|
||||||
|
// a11y niceties
|
||||||
|
'role',
|
||||||
|
'aria-label',
|
||||||
|
'aria-labelledby',
|
||||||
|
'aria-hidden',
|
||||||
|
'tabindex'
|
||||||
|
],
|
||||||
|
SANITIZE_DOM: true
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if content}
|
{#if content}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue