From 3d22fa5d2435de5acc18de6f88474a6e8675a60e Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Tue, 8 Jun 2021 20:08:04 +0200 Subject: [PATCH] =?UTF-8?q?2122=20Bl=C3=B6ockling=20javascript=20urls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress/integration/other/xss.spec.js | 5 ++ cypress/platform/xss5.html | 99 +++++++++++++++++++++++++++ src/diagrams/common/common.js | 4 ++ 3 files changed, 108 insertions(+) create mode 100644 cypress/platform/xss5.html diff --git a/cypress/integration/other/xss.spec.js b/cypress/integration/other/xss.spec.js index 830be4f8e..842eab36f 100644 --- a/cypress/integration/other/xss.spec.js +++ b/cypress/integration/other/xss.spec.js @@ -58,5 +58,10 @@ describe('XSS', () => { cy.wait(1000); cy.get('#the-malware').should('not.exist'); }) + it('should not allow maniplulating antiscript to run javascript', () => { + cy.visit('http://localhost:9000/xss5.html'); + cy.wait(1000); + cy.get('#the-malware').should('not.exist'); + }) }) diff --git a/cypress/platform/xss5.html b/cypress/platform/xss5.html new file mode 100644 index 000000000..9d3ad4da6 --- /dev/null +++ b/cypress/platform/xss5.html @@ -0,0 +1,99 @@ + + + + + + + + + +
Security check
+
+
+
+ + + + + diff --git a/src/diagrams/common/common.js b/src/diagrams/common/common.js index 4e26efca8..885f350de 100644 --- a/src/diagrams/common/common.js +++ b/src/diagrams/common/common.js @@ -26,6 +26,10 @@ export const removeScript = txt => { break; } } + + rs = rs.replace('javascript:', '#'); + rs = rs.replace('