Language: JavaScript
Label: vulnerable
CWE: CWE-78 \u2014 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.

Code:
for(var g=[],n=2;n<d.length;n++){var q=mxUtils.trim(d[n]);"["!=q&&"]"!=q&&"%%"!=q.substring(0,2)&&"##"!=q.substring(0,2)&&(q=d[n].replace(/[-|>]/g," "),""!=mxUtils.trim(q)&&" "==q.charAt(0)&&g.push(q))}return"mindmap\nroot(("+mxUtils.trim(d[1])+"))\n"+g.join("\n")};EditorUi.prototype.extractMermaidDeclaration=function(d){"o\n\n"==d.substring(0,3)&&(d=d.substring(3));var g=d.split("```");g=1<g.length?g:d.split("<pre>");g=1<g.length?g:d.split("~~~");g=1<g.length?g:d.split("%%");g=1<g.length?g:d.split("(Begins)");
g=mxUtils.trim(1>=g.length?d:g[1]);var n=g.split("\n");if(0<n.length&&"mermaid"==mxUtils.trim(n[0])||1<n.length&&0<=mxUtils.indexOf(EditorUi.mermaidDiagramTypes,n[1]))n.shift(),g=mxUtils.trim(n.join("\n")),n=g.split("\n");var q=n[0].split(" ")[0].replace(/:$/,"");try{"mindmap"==q&&2<n.length&&(g=this.extractMermaidMindmap(n))}catch(t){}"@"!=q.charAt(0)&&0>mxUtils.indexOf(EditorUi.mermaidDiagramTypes,q)&&(g="classDiagram\n"+g);EditorUi.debug("EditorUi.extractMermaidDeclaration","\nlines:",n,"\ntype:",
q,"\nvalue:",d,"\ntext:",g);return g};EditorUi.prototype.removeMermaidComments=function(d){d=d.split("\n");for(var g=[],n=0;n<d.length;n++)"%%"!=d[n].substring(0,2)&&g.push(d[n]);return g.join("\n")};EditorUi.prototype.generateMermaidImage=function(d,g,n,q,t){d=this.removeMermaidComments(d);var v=mxUtils.bind(this,function(F){this.loadingMermaid=!1;null!=q?q(F):this.handleError(F)}),B=mxUtils.bind(this,function(){try{this.loadingMermaid=!1;g=null!=g?g:mxUtils.clone(EditorUi.defaultMermaidConfig);