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