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
|
@ -47,7 +47,7 @@ addRemote :: Annex RemoteName -> Annex Remote
|
|||
addRemote a = do
|
||||
name <- a
|
||||
remotesChanged
|
||||
maybe (error "failed to add remote") return
|
||||
maybe (giveup "failed to add remote") return
|
||||
=<< Remote.byName (Just name)
|
||||
|
||||
{- Inits a rsync special remote, and returns its name. -}
|
||||
|
@ -94,7 +94,7 @@ initSpecialRemote name remotetype mcreds config = go 0
|
|||
enableSpecialRemote :: SpecialRemoteMaker
|
||||
enableSpecialRemote name remotetype mcreds config =
|
||||
Annex.SpecialRemote.findExisting name >>= \case
|
||||
[] -> error $ "Cannot find a special remote named " ++ name
|
||||
[] -> giveup $ "Cannot find a special remote named " ++ name
|
||||
((u, c, mcu):_) -> setupSpecialRemote' False name remotetype config mcreds (Just u, R.Enable c, c) mcu
|
||||
|
||||
setupSpecialRemote :: RemoteName -> RemoteType -> R.RemoteConfig -> Maybe CredPair -> (Maybe UUID, R.SetupStage, R.RemoteConfig) -> Maybe (Annex.SpecialRemote.ConfigFrom UUID) -> Annex RemoteName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue