mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-17 11:14:12 +01:00
#2219 Frezing object to protect the prototype
This commit is contained in:
@@ -57,9 +57,8 @@ subgraph CompositeState
|
|||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="width: 100%; height: 20%;">
|
<div class="mermaid" style="width: 100%; height: 20%;">
|
||||||
%%{init: { '__proto__': {'vuln': 'test'}} }%%
|
%%{init: { 'prototype': {'__proto__': {'vuln': 'test'}}} }%%
|
||||||
%%{init: { '__proto__': {'vuln': 'test'}} }%%
|
%%{init: { 'prototype': {'__proto__': {'vuln': 'test'}}} }%%
|
||||||
|
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
Alice->>Bob: Hi Bob
|
Alice->>Bob: Hi Bob
|
||||||
Bob->>Alice: Hi Alice
|
Bob->>Alice: Hi Alice
|
||||||
|
|||||||
@@ -44,6 +44,13 @@
|
|||||||
graph LR
|
graph LR
|
||||||
A --> B
|
A --> B
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mermaid">
|
||||||
|
%%{init: { 'prototype': {'__proto__': {'polluted': 'test'}}} }%%
|
||||||
|
%%{init: { 'prototype': {'__proto__': {'polluted': 'test'}}} }%%
|
||||||
|
sequenceDiagram
|
||||||
|
Alice->>Bob: Hi Bob
|
||||||
|
Bob->>Alice: Hi Alice
|
||||||
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script src="./mermaid.js"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
|
|||||||
12
src/utils.js
12
src/utils.js
@@ -77,8 +77,20 @@ export const detectInit = function (text, cnf) {
|
|||||||
log.debug('sanitize deleting prototype option', args[key]);
|
log.debug('sanitize deleting prototype option', args[key]);
|
||||||
delete args[argKey][key];
|
delete args[argKey][key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.indexOf('proto') >= 0) {
|
||||||
|
log.debug('sanitize deleting prototype option', args[key]);
|
||||||
|
delete args[argKey][key];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key.indexOf('constr') >= 0) {
|
||||||
|
log.debug('sanitize deleting prototype option', args[key]);
|
||||||
|
delete args[argKey][key];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Object.freeze(Object.prototype);
|
||||||
|
Object.freeze(Object);
|
||||||
results = assignWithDepth(results, [...args]);
|
results = assignWithDepth(results, [...args]);
|
||||||
} else {
|
} else {
|
||||||
results = inits.args;
|
results = inits.args;
|
||||||
|
|||||||
Reference in New Issue
Block a user