From 758965d177d75f529bb88e24564a0bdb5e406fc6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 27 Sep 2016 20:22:53 -0400 Subject: Filter out escape sequences and any other unusual characters when writing all messages to the console. This should protect against all attacks where the server sends back a malicious message. --- Tests.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Tests.hs') diff --git a/Tests.hs b/Tests.hs index 1b9bd0e..7955c7f 100644 --- a/Tests.hs +++ b/Tests.hs @@ -8,6 +8,7 @@ module Tests where import Types +import Output import Tunables import Encryption import Share @@ -16,7 +17,6 @@ import Storage.Local import Control.Exception import System.Directory import System.Posix.Temp -import System.IO import qualified Data.ByteString.UTF8 as BU8 import qualified Data.ByteString as B import qualified Data.Set as S @@ -36,22 +36,21 @@ testFailed = return . Left runTest :: Test -> IO Bool runTest (d, t) = do - putStr $ "testing: " ++ show d ++ " ..." - hFlush stdout + progress $ "testing: " ++ show d ++ " ..." r <- t case r of Right () -> do - putStrLn "ok" + say "ok" return True Left e -> do - putStrLn $ "failed: " ++ show e + say $ "failed: " ++ show e return False runTests :: IO () runTests = do r <- mapM runTest tests if all (== True) r - then putStrLn "All tests succeeded." + then say "All tests succeeded." else error "Tests failed. Report a bug!" tests :: [Test] -- cgit v1.2.3