From 121a24d432fb2b10089acbc07586a3966335dda4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 13 Dec 2020 14:48:45 +0000 Subject: [PATCH] Test that css is not dangerous --- tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests.py b/tests.py index c6c08770..05cbd5b4 100644 --- a/tests.py +++ b/tests.py @@ -75,6 +75,7 @@ from inbox import guessHashtagCategory from content import htmlReplaceEmailQuote from content import htmlReplaceQuoteMarks from content import dangerousMarkup +from content import dangerousCSS from content import addWebLinks from content import replaceEmojiFromTags from content import addHtmlTags @@ -1984,6 +1985,17 @@ def testRemoveHtml(): assert(removeHtml(testStr) == 'This string has html.') +def testDangerousCSS(): + print('testDangerousCSS') + baseDir = os.getcwd() + for subdir, dirs, files in os.walk(baseDir): + for f in files: + if not f.endswith('.css'): + continue + assert not dangerousCSS(baseDir + '/' + f, False) + break + + def testDangerousMarkup(): print('testDangerousMarkup') allowLocalNetworkAccess = False @@ -2483,6 +2495,7 @@ def runAllTests(): testRemoveIdEnding() testJsonPostAllowsComments() runHtmlReplaceQuoteMarks() + testDangerousCSS() testDangerousMarkup() testRemoveHtml() testSiteIsActive()