From 8556a9e4479276bf5d5f4b9ce8d38c0d59e42301 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 15 Mar 2021 19:10:19 -0400 Subject: [PATCH] Check of unsafe HTML in SVG files (#3250) * Check of unsafe HTML in SVG files Fixes #3249 * mention in index.html file * feedbacked --- filecheck/checker.js | 17 ++++++++++++++--- testing/tests/filecheck.test.js | 25 +++++++++++++++++++++++++ testing/tests/samplefiles/index.html | 3 +++ testing/tests/samplefiles/onhandler.svg | 3 +++ testing/tests/samplefiles/script.svg | 3 +++ 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 testing/tests/filecheck.test.js create mode 100644 testing/tests/samplefiles/index.html create mode 100644 testing/tests/samplefiles/onhandler.svg create mode 100644 testing/tests/samplefiles/script.svg diff --git a/filecheck/checker.js b/filecheck/checker.js index 4b9049656d82..bc892949fb87 100644 --- a/filecheck/checker.js +++ b/filecheck/checker.js @@ -62,9 +62,20 @@ async function checkFile(filePath, options) { throw new Error(`${filePath} does not appear to be an SVG`); } const $ = cheerio.load(content); - if ($("script").length) { - throw new Error(`${filePath} contains a