-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-x3vm-38hw-55wf
CSS Injection security issue
- Loading branch information
Showing
7 changed files
with
155 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { urlSnapshotTest } from '../../helpers/util'; | ||
|
||
describe('CSS injections', () => { | ||
it('should not allow CSS injections outside of the diagram', () => { | ||
urlSnapshotTest('http://localhost:9000/ghsa1.html', { | ||
logLevel: 1, | ||
flowchart: { htmlLabels: false }, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<html> | ||
<script> | ||
// %%{ init: { "logLevel":0, "themeVariables" : { "primaryColor": "#fff000","textColor": "green","apa":"} #target { background-color: crimson }" } } }%% | ||
</script> | ||
<body> | ||
<div id="target"> | ||
<h1>This element does not belong to the SVG but we can style it</h1> | ||
</div> | ||
<svg id="diagram"> | ||
</svg> | ||
|
||
<script src="./mermaid.js"></script> | ||
<script> | ||
mermaid.initialize({ startOnLoad: false, logLevel: 0 }); | ||
|
||
const graph = ` | ||
%%{ init: { "themeVariables" : { "textColor": "green;} #target { background-color: crimson }", "mainBkg": "#fff000" } } }%% | ||
graph TD | ||
A[Goose] | ||
`; | ||
|
||
const diagram = document.getElementById('diagram'); | ||
const svg = mermaid.render('diagram-svg', graph); | ||
diagram.innerHTML = svg; | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<html> | ||
<script> | ||
// %%{ init: { "logLevel":0, "themeVariables" : { "primaryColor": "#fff000","textColor": "green","apa":"} #target { background-color: crimson }" } } }%% | ||
</script> | ||
<body> | ||
<div id="target"> | ||
<h1>This element does not belong to the SVG but we can style it</h1> | ||
</div> | ||
<svg id="diagram"> | ||
</svg> | ||
|
||
<script src="./mermaid.js"></script> | ||
<script> | ||
mermaid.initialize({ startOnLoad: false, logLevel: 0 }); | ||
|
||
const graph = ` | ||
%%{ init: { "fontFamily" : "&125; * { background: red }" } }%% | ||
graph TD | ||
A[Goose] | ||
`; | ||
|
||
const diagram = document.getElementById('diagram'); | ||
const svg = mermaid.render('diagram-svg', graph); | ||
diagram.innerHTML = svg; | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters