diff --git a/cypress/integration/other/xss.spec.js b/cypress/integration/other/xss.spec.js index 529eee16d..f605e98dc 100644 --- a/cypress/integration/other/xss.spec.js +++ b/cypress/integration/other/xss.spec.js @@ -110,4 +110,9 @@ describe('XSS', () => { cy.wait(1000); cy.get('#the-malware').should('not.exist'); }); + it('should sanitize cardinalities properly in class diagrams', () => { + cy.visit('http://localhost:9000/xss18.html'); + cy.wait(1000); + cy.get('#the-malware').should('not.exist'); + }); }); diff --git a/cypress/platform/xss18.html b/cypress/platform/xss18.html new file mode 100644 index 000000000..5dc7df621 --- /dev/null +++ b/cypress/platform/xss18.html @@ -0,0 +1,105 @@ + + + + + + + + + +
Security check
+
+
+
+ + + + + diff --git a/src/diagrams/class/classDb.js b/src/diagrams/class/classDb.js index 34d839dab..ba33b5f77 100644 --- a/src/diagrams/class/classDb.js +++ b/src/diagrams/class/classDb.js @@ -96,6 +96,16 @@ export const addRelation = function (relation) { relation.id1 = splitClassNameAndType(relation.id1).className; relation.id2 = splitClassNameAndType(relation.id2).className; + relation.relationTitle1 = common.sanitizeText( + relation.relationTitle1.trim(), + configApi.getConfig() + ); + + relation.relationTitle2 = common.sanitizeText( + relation.relationTitle2.trim(), + configApi.getConfig() + ); + relations.push(relation); };