From d536e9f27bb96ed8f741368416b29a788cc0882a Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 14 Feb 2020 15:44:13 +0000 Subject: [PATCH] node tests: Add tests for escaped attributes in vdom. --- frontend_tests/node_tests/vdom.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/frontend_tests/node_tests/vdom.js b/frontend_tests/node_tests/vdom.js index b5b081c275..aea5a748fd 100644 --- a/frontend_tests/node_tests/vdom.js +++ b/frontend_tests/node_tests/vdom.js @@ -22,7 +22,31 @@ run_test('basics', () => { ); }); -run_test('attributes', () => { +run_test('attribute escaping', () => { + // So far most of the time our attributes are + // hard-coded classes like "expanded_private_messages", + // but we need to be defensive about future code + // that might use data from possibly malicious users. + const opts = { + keyed_nodes: [], + attrs: [ + ['class', '">something evil
\n\n' + ); +}); + +run_test('attribute updates', () => { const opts = { keyed_nodes: [], attrs: [