Possible inject arbitrary `CSS` into the generated graph affecting the container HTML
An attacker is able to inject arbitrary `CSS` into the generated graph allowing them to change the styling of elements outside of the generated graph, and potentially exfiltrate sensitive information by using specially crafted `CSS` selectors.The following example shows how an attacker can exfiltrate the contents of an input field by bruteforcing the `value` attribute one character at a time. Whenever there is an actual match, an `http` request will be made by the browser in order to "load" a background image that will let an attacker know what's the value of the character.Patches_Has the problem been patched? What versions should users upgrade to?_Workarounds_Is there a way for users to fix or remediate the vulnerability without upgrading?_References_Are there any links users can visit to find out more?_For more informationIf you have any questions or comments about this advisory:Open an issue in [example link to repo](http://example.com)Email us at [example email address](mailto:example@example.com)Productmermaid.jsTested Version[v9.1.1](https://github.com/mermaid-js/mermaid/releases/tag/9.1.1)DetailsIssue 1: Multiple CSS Injection (`GHSL-2022-036`)By supplying a carefully crafted `textColor` theme variable, an attacker can inject arbitrary `CSS` rules into the document. In the following snippet we can see that `getStyles` does not sanitize any of the theme variables leaving the door open for `CSS` injection._Snippet from [src/styles.js](https://github.com/mermaid-js/mermaid/blob/9eae97ddab1b6eca58d2fd4af62357d2f4d8d1f7/src/styles.js#L35):_For example, if we set `textColor` to `"green;} #target { background-color: crimson }"` the resulting `CSS` will contain a new selector `#target` that will apply a `crimson` background color to an arbitrary element.In the proof of concept above we used the `textColor` variable to inject `CSS`, but there are multiple functions that can potentially be abused to change the style of the document. Some of them are in the following list but we encourage mantainers to look for additional injection points:https://github.com/mermaid-js/mermaid/blob/5d30d465354f804e361d7a041ec46da6bb5d583b/src/mermaidAPI.js#L393https://github.com/mermaid-js/mermaid/blob/5d30d465354f804e361d7a041ec46da6bb5d583b/src/styles.js#L35ImpactThis issue may lead to `Information Disclosure` via CSS selectors and functions able to generate HTTP requests. This also allows an attacker to change the document in ways which may lead a user to perform unintended actions, such as clicking on a link, etc.RemediationEnsure that user input is adequately escaped before embedding it in CSS blocks.