filter out control characters in error messages
giveup changed to filter out control characters. (It is too low level to make it use StringContainingQuotedPath.) error still does not, but it should only be used for internal errors, where the message is not attacker-controlled. Changed a lot of existing error to giveup when it is not strictly an internal error. Of course, other exceptions can still be thrown, either by code in git-annex, or a library, that include some attacker-controlled value. This does not guard against those. Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
parent
063c00e4f7
commit
cd544e548b
69 changed files with 142 additions and 103 deletions
|
@ -11,6 +11,7 @@ module Utility.Base64 where
|
|||
|
||||
import Utility.FileSystemEncoding
|
||||
import Utility.QuickCheck
|
||||
import Utility.Exception
|
||||
|
||||
import qualified "sandi" Codec.Binary.Base64 as B64
|
||||
import Data.Maybe
|
||||
|
@ -36,12 +37,12 @@ fromB64Maybe' = either (const Nothing) Just . B64.decode
|
|||
fromB64 :: String -> String
|
||||
fromB64 = fromMaybe bad . fromB64Maybe
|
||||
where
|
||||
bad = error "bad base64 encoded data"
|
||||
bad = giveup "bad base64 encoded data"
|
||||
|
||||
fromB64' :: B.ByteString -> B.ByteString
|
||||
fromB64' = fromMaybe bad . fromB64Maybe'
|
||||
where
|
||||
bad = error "bad base64 encoded data"
|
||||
bad = giveup "bad base64 encoded data"
|
||||
|
||||
-- Only ascii strings are tested, because an arbitrary string may contain
|
||||
-- characters not encoded using the FileSystemEncoding, which would thus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue