mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 02:49:40 +02:00
Fix for vulnerability
This commit is contained in:
@@ -62,6 +62,7 @@ import { log, setLogLevel } from './logger';
|
||||
import getStyles from './styles';
|
||||
import theme from './themes';
|
||||
import utils, { directiveSanitizer, assignWithDepth, sanitizeCss } from './utils';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
/**
|
||||
* @param text
|
||||
@@ -541,6 +542,10 @@ const render = function (id, _txt, cb, container) {
|
||||
)}" sandbox="allow-top-navigation-by-user-activation allow-popups">
|
||||
The “iframe” tag is not supported by your browser.
|
||||
</iframe>`;
|
||||
} else {
|
||||
if (cnf.securityLevel !== 'loose') {
|
||||
svgCode = DOMPurify.sanitize(svgCode, { ADD_TAGS: ['foreignobject'] });
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof cb !== 'undefined') {
|
||||
|
Reference in New Issue
Block a user